refactor: empty positions
This commit is contained in:
parent
a0c8383be0
commit
1c1dd0a393
|
@ -939,6 +939,7 @@ void Gui::computeDisplay(){
|
||||||
//printf("selection.isComandable()\n");
|
//printf("selection.isComandable()\n");
|
||||||
|
|
||||||
if(selectingBuilding == false){
|
if(selectingBuilding == false){
|
||||||
|
vector<int> emptyPosIndexes = {};
|
||||||
|
|
||||||
//cancel button
|
//cancel button
|
||||||
const Unit *u= selection.getFrontUnit();
|
const Unit *u= selection.getFrontUnit();
|
||||||
|
@ -974,9 +975,7 @@ void Gui::computeDisplay(){
|
||||||
int displayPos= i;
|
int displayPos= i;
|
||||||
const CommandType *ct= ut->getCommandTypeSorted(i);
|
const CommandType *ct= ut->getCommandTypeSorted(i);
|
||||||
if(ct == NULL) {
|
if(ct == NULL) {
|
||||||
display.setDownImage(displayPos, ut->getCancelImage());
|
emptyPosIndexes.push_back(displayPos);
|
||||||
display.setCommandType(displayPos, ct);
|
|
||||||
display.setDownLighted(displayPos,false);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(ct->getClass() == ccMorph) {
|
if(ct->getClass() == ccMorph) {
|
||||||
|
@ -1030,11 +1029,8 @@ void Gui::computeDisplay(){
|
||||||
int basicPos = CommandHelper::getRowPos(crBasics);
|
int basicPos = CommandHelper::getRowPos(crBasics);
|
||||||
|
|
||||||
// First row is always empty
|
// First row is always empty
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++)
|
||||||
display.setDownImage(i, ut->getCancelImage());
|
emptyPosIndexes.push_back(i);
|
||||||
display.setCommandType(i, NULL);
|
|
||||||
display.setDownLighted(i,false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// only basics can be shared
|
// only basics can be shared
|
||||||
for(auto &&cc : CommandHelper::getBasicsCC()){
|
for(auto &&cc : CommandHelper::getBasicsCC()){
|
||||||
|
@ -1058,12 +1054,15 @@ void Gui::computeDisplay(){
|
||||||
}
|
}
|
||||||
display.setCommandClass(basicPos + ccPos, cc);
|
display.setCommandClass(basicPos + ccPos, cc);
|
||||||
} else {
|
} else {
|
||||||
display.setDownImage(basicPos+ccPos, ut->getCancelImage());
|
emptyPosIndexes.push_back(basicPos+ccPos);
|
||||||
display.setCommandType(basicPos+ccPos, NULL);
|
|
||||||
display.setDownLighted(basicPos+ccPos,false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (int i : emptyPosIndexes ) {
|
||||||
|
display.setDownImage(i, ut->getCancelImage());
|
||||||
|
display.setCommandType(i, NULL);
|
||||||
|
display.setDownLighted(i,false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (activeCommandType != NULL && activeCommandType->getClass() == ccBuild) {
|
else if (activeCommandType != NULL && activeCommandType->getClass() == ccBuild) {
|
||||||
const Unit *u = selection.getFrontUnit();
|
const Unit *u = selection.getFrontUnit();
|
||||||
|
|
Loading…
Reference in New Issue