make queued commandcount configurable

This commit is contained in:
Mark Vejvoda 2011-04-28 00:16:26 +00:00
parent 4a20646d37
commit c747a7c037
2 changed files with 16 additions and 17 deletions

View File

@ -234,7 +234,8 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos, const UnitType
setModelFacing(placeFacing); setModelFacing(placeFacing);
Config &config= Config::getInstance(); Config &config= Config::getInstance();
showUnitParticles= config.getBool("UnitParticles","true"); showUnitParticles = config.getBool("UnitParticles","true");
maxQueuedCommandDisplayCount = config.getInt("MaxQueuedCommandDisplayCount","5");
lastPos= pos; lastPos= pos;
progress= 0; progress= 0;
@ -1460,35 +1461,32 @@ string Unit::getDesc() const {
} }
//consumable production //consumable production
for(int i=0; i<getType()->getCostCount(); ++i){ for(int i=0; i < getType()->getCostCount(); ++i) {
const Resource *r= getType()->getCost(i); const Resource *r= getType()->getCost(i);
if(r->getType()->getClass()==rcConsumable){ if(r->getType()->getClass() == rcConsumable) {
str+= "\n"; 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(); str+= intToStr(abs(r->getAmount())) + " " + r->getType()->getName();
} }
} }
//command info //command info
if(commands.empty() == false) { if(commands.empty() == false) {
str+= "\n" + commands.front()->getCommandType()->getName(); str += "\n" + lang.get("OrdersOnQueue") + ": " + intToStr(commands.size());
if(commands.size() > 1) { Commands::const_iterator it= commands.begin();
str += "\n" + lang.get("OrdersOnQueue") + ": " + intToStr(commands.size()); for(unsigned int i = 0; i < min((size_t)maxQueuedCommandDisplayCount,commands.size()); ++i) {
Commands::const_iterator it= commands.begin(); const CommandType *ct = (*it)->getCommandType();
for(unsigned int i = 1; i < min((size_t)6,commands.size()); ++i) { //str += "\n" + ct->getDesc(this->getTotalUpgrade());
const CommandType *ct = (*it)->getCommandType(); str += "\n#" + intToStr(i+1) + " " + ct->getName();
//str += "\n" + ct->getDesc(this->getTotalUpgrade()); it++;
str += "\n#" + intToStr(i+1) + " " + ct->getName();
it++;
}
} }
} }
else { else {
//can store //can store
if(getType()->getStoredResourceCount()>0){ if(getType()->getStoredResourceCount() > 0) {
for(int i=0; i<getType()->getStoredResourceCount(); ++i){ for(int i = 0; i < getType()->getStoredResourceCount(); ++i) {
const Resource *r= getType()->getStoredResource(i); const Resource *r= getType()->getStoredResource(i);
str+= "\n"+lang.get("Store")+": "; str+= "\n" + lang.get("Store") + ": ";
str+= intToStr(r->getAmount()) + " " + r->getType()->getName(); str+= intToStr(r->getAmount()) + " " + r->getType()->getName();
} }
} }

View File

@ -339,6 +339,7 @@ private:
uint32 lastPathfindFailedFrame; uint32 lastPathfindFailedFrame;
Vec2i lastPathfindFailedPos; Vec2i lastPathfindFailedPos;
bool usePathfinderExtendedMaxNodes; bool usePathfinderExtendedMaxNodes;
int maxQueuedCommandDisplayCount;
public: public:
Unit(int id, UnitPathInterface *path, const Vec2i &pos, const UnitType *type, Faction *faction, Map *map, CardinalDir placeFacing); Unit(int id, UnitPathInterface *path, const Vec2i &pos, const UnitType *type, Faction *faction, Map *map, CardinalDir placeFacing);