Attack key ("a") cycles through attack types if you have a uniform selection of units

This commit is contained in:
Titus Tscharntke 2013-02-22 23:31:55 +00:00
parent af89f4c5ed
commit 2bc2555c22
1 changed files with 21 additions and 0 deletions

View File

@ -613,6 +613,27 @@ void Gui::mouseDownDisplayUnitSkills(int posDisplay) {
//uniform selection
if(selection.isUniform()) {
const CommandType *ct = display.getCommandType(posDisplay);
if(activeCommandClass == ccAttack)
{// try to switch to next attack type
int maxI=unit->getType()->getCommandTypeCount();
int i=activeCommandType->getId();
int k=i+1;
while(k!=i)
{
if(k>=maxI)
{
k=0;
}
const CommandType *ctype=display.getCommandType(k);
if(ctype->getClass() == ccAttack)
{
posDisplay=k;
break;
}
k++;
}
}
if(ct != NULL && unit->getFaction()->reqsOk(ct)) {
activeCommandType= display.getCommandType(posDisplay);
activeCommandClass= activeCommandType->getClass();