From c747a7c0374bbab4c7bc13240571d2713a35d95f Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 28 Apr 2011 00:16:26 +0000 Subject: [PATCH] make queued commandcount configurable --- source/glest_game/type_instances/unit.cpp | 32 +++++++++++------------ source/glest_game/type_instances/unit.h | 1 + 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index d2982a80..b47a1277 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -234,7 +234,8 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos, const UnitType setModelFacing(placeFacing); Config &config= Config::getInstance(); - showUnitParticles= config.getBool("UnitParticles","true"); + showUnitParticles = config.getBool("UnitParticles","true"); + maxQueuedCommandDisplayCount = config.getInt("MaxQueuedCommandDisplayCount","5"); lastPos= pos; progress= 0; @@ -1460,35 +1461,32 @@ string Unit::getDesc() const { } //consumable production - for(int i=0; igetCostCount(); ++i){ + for(int i=0; i < getType()->getCostCount(); ++i) { const Resource *r= getType()->getCost(i); - if(r->getType()->getClass()==rcConsumable){ + if(r->getType()->getClass() == rcConsumable) { str+= "\n"; - str+= r->getAmount()<0? lang.get("Produce")+": ": lang.get("Consume")+": "; + str+= r->getAmount() < 0 ? lang.get("Produce")+": ": lang.get("Consume")+": "; str+= intToStr(abs(r->getAmount())) + " " + r->getType()->getName(); } } //command info if(commands.empty() == false) { - str+= "\n" + commands.front()->getCommandType()->getName(); - if(commands.size() > 1) { - str += "\n" + lang.get("OrdersOnQueue") + ": " + intToStr(commands.size()); - Commands::const_iterator it= commands.begin(); - for(unsigned int i = 1; i < min((size_t)6,commands.size()); ++i) { - const CommandType *ct = (*it)->getCommandType(); - //str += "\n" + ct->getDesc(this->getTotalUpgrade()); - str += "\n#" + intToStr(i+1) + " " + ct->getName(); - it++; - } + str += "\n" + lang.get("OrdersOnQueue") + ": " + intToStr(commands.size()); + Commands::const_iterator it= commands.begin(); + for(unsigned int i = 0; i < min((size_t)maxQueuedCommandDisplayCount,commands.size()); ++i) { + const CommandType *ct = (*it)->getCommandType(); + //str += "\n" + ct->getDesc(this->getTotalUpgrade()); + str += "\n#" + intToStr(i+1) + " " + ct->getName(); + it++; } } else { //can store - if(getType()->getStoredResourceCount()>0){ - for(int i=0; igetStoredResourceCount(); ++i){ + if(getType()->getStoredResourceCount() > 0) { + for(int i = 0; i < getType()->getStoredResourceCount(); ++i) { const Resource *r= getType()->getStoredResource(i); - str+= "\n"+lang.get("Store")+": "; + str+= "\n" + lang.get("Store") + ": "; str+= intToStr(r->getAmount()) + " " + r->getType()->getName(); } } diff --git a/source/glest_game/type_instances/unit.h b/source/glest_game/type_instances/unit.h index 951e0176..50a616bd 100644 --- a/source/glest_game/type_instances/unit.h +++ b/source/glest_game/type_instances/unit.h @@ -339,6 +339,7 @@ private: uint32 lastPathfindFailedFrame; Vec2i lastPathfindFailedPos; bool usePathfinderExtendedMaxNodes; + int maxQueuedCommandDisplayCount; public: Unit(int id, UnitPathInterface *path, const Vec2i &pos, const UnitType *type, Faction *faction, Map *map, CardinalDir placeFacing);