From 4f19451a6a6b536475cfb7cb5be15ea534ea36d5 Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Fri, 14 Sep 2012 23:46:01 +0000 Subject: [PATCH] dying units did not clear their fields the way it was meant :) --- source/glest_game/type_instances/unit.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 1b0530c0..c79736cb 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -1564,7 +1564,10 @@ void Unit::kill() { } //do the cleaning - map->clearUnitCells(this, pos); + //clear commands ( and their blocking fields ) + clearCommands(); + + map->clearUnitCells(this, pos, true); if(isBeingBuilt() == false) { faction->removeStore(type); } @@ -1572,8 +1575,6 @@ void Unit::kill() { notifyObservers(UnitObserver::eKill); - //clear commands - clearCommands(); UnitUpdater *unitUpdater = game->getWorld()->getUnitUpdater(); //unitUpdater->clearUnitPrecache(this); @@ -2951,12 +2952,11 @@ CommandResult Unit::undoCommand(Command *command){ throw megaglest_runtime_error(szBuf); } - if(this->currSkill->getClass() == scMorph){ + if(getCurrCommand() == command && this->currSkill->getClass() == scMorph ){ // clear cells of morphed unit and set those of current unit! map->clearUnitCells(this, this->getPos()); map->putUnitCells(this, this->getPos(),true); } - //return cost const ProducibleType *produced= command->getCommandType()->getProduced(); if(produced!=NULL){