produce commands are not ALWAYS queued! Behaviour should be like in original glest!
This commit is contained in:
parent
b99d37c02c
commit
5aa6092f1f
|
@ -827,19 +827,27 @@ CommandResult Unit::giveCommand(Command *command, bool tryQueue) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] Command is Queable\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] Command is Queable\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
if(command->getCommandType()->isQueuable() == qAlways && tryQueue){
|
||||||
|
// Its a produce or upgrade command called without queued key
|
||||||
|
// in this case we must NOT delete lower priority commands!
|
||||||
|
// we just queue it!
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
//Delete all lower-prioirty commands
|
//Delete all lower-prioirty commands
|
||||||
for (list<Command*>::iterator i = commands.begin(); i != commands.end();) {
|
for(list<Command*>::iterator i= commands.begin(); i != commands.end();){
|
||||||
if ((*i)->getPriority() < command_priority) {
|
if((*i)->getPriority() < command_priority){
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] Deleting lower priority command [%s]\n",__FILE__,__FUNCTION__,__LINE__,(*i)->toString().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled)
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] Deleting lower priority command [%s]\n",__FILE__,__FUNCTION__,__LINE__,(*i)->toString().c_str());
|
||||||
|
|
||||||
deleteQueuedCommand(*i);
|
deleteQueuedCommand(*i);
|
||||||
i = commands.erase(i);
|
i= commands.erase(i);
|
||||||
}
|
}
|
||||||
else {
|
else{
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
//cancel current command if it is not queuable
|
//cancel current command if it is not queuable
|
||||||
|
|
|
@ -317,6 +317,7 @@ public:
|
||||||
virtual string toString() const;
|
virtual string toString() const;
|
||||||
virtual const ProducibleType *getProduced() const;
|
virtual const ProducibleType *getProduced() const;
|
||||||
virtual Queueability isQueuable() const {return qAlways;}
|
virtual Queueability isQueuable() const {return qAlways;}
|
||||||
|
virtual int getTypePriority() const {return 15;}
|
||||||
|
|
||||||
//get
|
//get
|
||||||
const ProduceSkillType *getProduceSkillType() const {return produceSkillType;}
|
const ProduceSkillType *getProduceSkillType() const {return produceSkillType;}
|
||||||
|
@ -344,6 +345,7 @@ public:
|
||||||
virtual string getReqDesc() const;
|
virtual string getReqDesc() const;
|
||||||
virtual const ProducibleType *getProduced() const;
|
virtual const ProducibleType *getProduced() const;
|
||||||
virtual Queueability isQueuable() const {return qAlways;}
|
virtual Queueability isQueuable() const {return qAlways;}
|
||||||
|
virtual int getTypePriority() const {return 15;}
|
||||||
|
|
||||||
//get
|
//get
|
||||||
const UpgradeSkillType *getUpgradeSkillType() const {return upgradeSkillType;}
|
const UpgradeSkillType *getUpgradeSkillType() const {return upgradeSkillType;}
|
||||||
|
|
Loading…
Reference in New Issue