From d2d691024ef32c5f5e472a3dbd104c8791b6ff9b Mon Sep 17 00:00:00 2001 From: pavanvo Date: Sat, 27 Aug 2022 16:19:54 +0400 Subject: [PATCH] fix: non-targed commands + TODO --- source/glest_game/gui/gui.cpp | 3 +++ source/glest_game/type_instances/unit.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/glest_game/gui/gui.cpp b/source/glest_game/gui/gui.cpp index 8970e0c6..608a4beb 100644 --- a/source/glest_game/gui/gui.cpp +++ b/source/glest_game/gui/gui.cpp @@ -707,6 +707,9 @@ void Gui::mouseDownDisplayUnitSkills(int posDisplay) { if (activeCommandClass == ccAttack) { ct = selection.getUnitFromCC(ccAttack)->getType()->getFirstCtOfClass(activeCommandClass); } + auto mct= unit->getCurrMorphCt(); + if(mct) ct= mct->getMorphUnit()->getFirstCtOfClass(activeCommandClass); + if(activeCommandType!=NULL && activeCommandType->getClass()==ccBuild){ assert(selection.isUniform()); selectingBuilding= true; diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index c32daa83..bb1d543c 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -747,7 +747,7 @@ void Unit::cleanupAllParticlesystems() { const MorphCommandType* Unit::getCurrMorphCt() const { auto result = std::find_if(commands.rbegin(), commands.rend(),[](Command *i) - { return i->getCommandType()->getClass() == ccMorph? true: false; }); + { return i->getCommandType()->getClass() == ccMorph; });//TODO set CurrMorphCt on push comands instead of looping if(result != commands.rend()) { return static_cast((*result)->getCommandType()); }