fix: non-targed commands + TODO

This commit is contained in:
pavanvo 2022-08-27 16:19:54 +04:00
parent 37b6fbb12e
commit d2d691024e
No known key found for this signature in database
GPG Key ID: 34C1C36681B4AD84
2 changed files with 4 additions and 1 deletions

View File

@ -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;

View File

@ -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<const MorphCommandType*>((*result)->getCommandType());
}