From 2877db08a9aa70a8610903d607efcc83698f3a6a Mon Sep 17 00:00:00 2001 From: johns <> Date: Sun, 25 Feb 2001 19:03:38 +0000 Subject: [PATCH] Removed units, can't get a move command. Training debuging removed --- src/action/command.cpp | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/action/command.cpp b/src/action/command.cpp index 5a41702f1..cc5d04bba 100644 --- a/src/action/command.cpp +++ b/src/action/command.cpp @@ -285,22 +285,27 @@ global void CommandMove(Unit* unit,int x,int y,int flush) } ); - if( unit->Type->Building ) { - // FIXME: should find a better way for pending commands. - command=&unit->PendCommand; - } else if( !(command=GetNextCommand(unit,flush)) ) { - return; + // + // Check if unit is still valid? (NETWORK!) + // + if( !unit->Removed ) { + + if( unit->Type->Building ) { + // FIXME: should find a better way for pending commands. + command=&unit->PendCommand; + } else if( !(command=GetNextCommand(unit,flush)) ) { + return; + } + + command->Action=UnitActionMove; + ResetPath(*command); + command->Data.Move.Goal=NoUnitP; + command->Data.Move.Range=0; + command->Data.Move.SX=unit->X; + command->Data.Move.SY=unit->Y; + command->Data.Move.DX=x; + command->Data.Move.DY=y; } - - command->Action=UnitActionMove; - ResetPath(*command); - command->Data.Move.Goal=NoUnitP; - command->Data.Move.Range=0; - command->Data.Move.SX=unit->X; - command->Data.Move.SY=unit->Y; - command->Data.Move.DX=x; - command->Data.Move.DY=y; - #endif ClearSavedAction(unit); } @@ -884,10 +889,7 @@ global void CommandCancelTraining(Unit* unit,int slot) n=unit->Command.Data.Train.Count; if( unit->Command.Action==UnitActionTrain && slot<n ) { - DebugLevel0Fn("Cancel %d of %d - ",slot,n); PlayerAddUnitType(unit->Player,unit->Command.Data.Train.What[slot]); - DebugLevel0Fn("%d,%d,%d\n",unit->Player->Resources[GoldCost], - unit->Player->Resources[WoodCost],unit->Player->Resources[OilCost]); if ( --n ) { for( i = slot; i < n; i++ ) {