Skip to content

Commit 52c3628

Browse files
author
pavanvo
committed
fix: auto command for morph queue
1 parent e72e845 commit 52c3628

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/glest_game/game/commander.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,15 +314,15 @@ std::pair<CommandResult,string> Commander::tryGiveCommand(const Selection *selec
314314
currPos= world->getMap()->computeDestPos(refPos, unit->getPosNotThreadSafe(), pos);
315315

316316
//get command type
317-
const CommandType *commandType= unit->computeCommandType(pos, targetUnit);
317+
auto mct= unit->getCurrMorphCt();
318+
auto unitType= mct? mct->getMorphUnit(): NULL;
319+
const CommandType *commandType= unit->computeCommandType(pos, targetUnit, unitType);
318320

319321
//give commands
320322
if(commandType != NULL) {
321323
int targetId= targetUnit==NULL? Unit::invalidId: targetUnit->getId();
322324
int unitId= unit->getId();
323-
int unitTypeId= -1;
324-
auto mct= unit->getCurrMorphCt();
325-
if(mct) unitTypeId= mct->getMorphUnit()->getId();
325+
int unitTypeId= unitType? unitType->getId(): -1;
326326

327327
std::pair<CommandResult,string> resultCur(crFailUndefined,"");
328328

0 commit comments

Comments
 (0)