From 8bc5abbfd3eb904829a4e2495038669de6ea220b Mon Sep 17 00:00:00 2001 From: pavanvo Date: Tue, 6 Sep 2022 00:58:26 +0400 Subject: [PATCH] fix: auto command for morph queue --- source/glest_game/game/commander.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/glest_game/game/commander.cpp b/source/glest_game/game/commander.cpp index 2650e572..66cb45bc 100644 --- a/source/glest_game/game/commander.cpp +++ b/source/glest_game/game/commander.cpp @@ -314,15 +314,15 @@ std::pair Commander::tryGiveCommand(const Selection *selec currPos= world->getMap()->computeDestPos(refPos, unit->getPosNotThreadSafe(), pos); //get command type - const CommandType *commandType= unit->computeCommandType(pos, targetUnit); + auto mct= unit->getCurrMorphCt(); + auto unitType= mct? mct->getMorphUnit(): NULL; + const CommandType *commandType= unit->computeCommandType(pos, targetUnit, unitType); //give commands if(commandType != NULL) { int targetId= targetUnit==NULL? Unit::invalidId: targetUnit->getId(); int unitId= unit->getId(); - int unitTypeId= -1; - auto mct= unit->getCurrMorphCt(); - if(mct) unitTypeId= mct->getMorphUnit()->getId(); + int unitTypeId= unitType? unitType->getId(): -1; std::pair resultCur(crFailUndefined,"");