- bugfix for cancel icon displaying when unit has only the 'stop' command active
This commit is contained in:
parent
df3f56a451
commit
5cf0313c5a
|
@ -674,6 +674,8 @@ void Gui::computeInfoString(int posDisplay){
|
|||
|
||||
void Gui::computeDisplay() {
|
||||
|
||||
//printf("Start ===> computeDisplay()\n");
|
||||
|
||||
//init
|
||||
display.clear();
|
||||
|
||||
|
@ -694,29 +696,43 @@ void Gui::computeDisplay(){
|
|||
// ================ PART 2 ================
|
||||
|
||||
if(selectingPos || selectingMeetingPoint) {
|
||||
//printf("selectingPos || selectingMeetingPoint\n");
|
||||
display.setDownSelectedPos(activePos);
|
||||
}
|
||||
|
||||
if(selection.isComandable()) {
|
||||
if(!selectingBuilding){
|
||||
//printf("selection.isComandable()\n");
|
||||
|
||||
if(selectingBuilding == false) {
|
||||
|
||||
//cancel button
|
||||
const Unit *u= selection.getFrontUnit();
|
||||
const UnitType *ut= u->getType();
|
||||
if(selection.isCancelable()) {
|
||||
//printf("selection.isCancelable() commandcount = %d\n",selection.getUnit(0)->getCommandSize());
|
||||
if(selection.getUnit(0)->getCommandSize() > 0) {
|
||||
//printf("Current Command [%s]\n",selection.getUnit(0)->getCurrCommand()->toString().c_str());
|
||||
}
|
||||
|
||||
display.setDownImage(cancelPos, ut->getCancelImage());
|
||||
display.setDownLighted(cancelPos, true);
|
||||
}
|
||||
|
||||
//meeting point
|
||||
if(selection.isMeetable()) {
|
||||
//printf("selection.isMeetable()\n");
|
||||
|
||||
display.setDownImage(meetingPointPos, ut->getMeetingPointImage());
|
||||
display.setDownLighted(meetingPointPos, true);
|
||||
}
|
||||
|
||||
if(selection.isUniform()) {
|
||||
//printf("selection.isUniform()\n");
|
||||
|
||||
//uniform selection
|
||||
if(u->isBuilt()) {
|
||||
//printf("u->isBuilt()\n");
|
||||
|
||||
int morphPos= 8;
|
||||
for(int i=0; i<ut->getCommandTypeCount(); ++i) {
|
||||
int displayPos= i;
|
||||
|
@ -730,8 +746,9 @@ void Gui::computeDisplay(){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
//printf("selection.isUniform() == FALSE\n");
|
||||
|
||||
//non uniform selection
|
||||
int lastCommand= 0;
|
||||
for(int i=0; i<ccCount; ++i) {
|
||||
|
|
|
@ -142,7 +142,7 @@ bool Selection::isComandable() const{
|
|||
bool Selection::isCancelable() const{
|
||||
return
|
||||
selectedUnits.size() > 1 ||
|
||||
(selectedUnits.size()==1 && selectedUnits[0]->anyCommand());
|
||||
(selectedUnits.size() == 1 && selectedUnits[0]->anyCommand(true));
|
||||
}
|
||||
|
||||
bool Selection::isMeetable() const{
|
||||
|
|
|
@ -103,7 +103,7 @@ std::string Command::toString() const {
|
|||
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__, __LINE__);
|
||||
|
||||
result = ", stateType = " + intToStr(stateType) + ", stateValue = " + intToStr(stateValue);
|
||||
result += ", stateType = " + intToStr(stateType) + ", stateValue = " + intToStr(stateValue);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -673,8 +673,22 @@ Vec3f Unit::getCurrVectorFlat() const{
|
|||
// =================== Command list related ===================
|
||||
|
||||
//any command
|
||||
bool Unit::anyCommand() const{
|
||||
return !commands.empty();
|
||||
bool Unit::anyCommand(bool validateCommandtype) const {
|
||||
bool result = false;
|
||||
if(validateCommandtype == false) {
|
||||
result = (commands.empty() == false);
|
||||
}
|
||||
else {
|
||||
for(Commands::const_iterator it= commands.begin(); it != commands.end(); ++it) {
|
||||
const CommandType *ct = (*it)->getCommandType();
|
||||
if(ct != NULL && ct->getClass() != ccStop) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//return current command, assert that there is always one command
|
||||
|
|
|
@ -392,7 +392,7 @@ public:
|
|||
Vec3f getCurrVectorFlat() const;
|
||||
|
||||
//command related
|
||||
bool anyCommand() const;
|
||||
bool anyCommand(bool validateCommandtype=false) const;
|
||||
Command *getCurrCommand() const;
|
||||
void replaceCurrCommand(Command *cmd);
|
||||
int getCountOfProducedUnits(const UnitType *ut) const;
|
||||
|
|
Loading…
Reference in New Issue