/** ** The unit boards a transporter. ** ** @todo FIXME: the transporter must drive to the meating point. ** While waiting for the transporter the units must defend ** themselfs. ** ** @param unit Pointer to unit. */ global void HandleActionBoard(Unit* unit) { int i; Unit* goal; DebugLevel3Fn("%p(%d) SubAction %d\n" _C_ unit _C_ UnitNumber(unit) _C_ unit->SubAction); switch( unit->SubAction ) { // // Wait for transporter // case 201: // FIXME: show still animations DebugLevel3Fn("Waiting\n"); if( WaitForTransporter(unit) ) { unit->SubAction=202; } break; // // Enter transporter // case 202: EnterTransporter(unit); break; // // Move to transporter // case 0: NewResetPath(unit); unit->SubAction=1; // FALL THROUGH default: if( unit->SubAction<=200 ) { // FIXME: if near transporter wait for enter if( (i=MoveToTransporter(unit)) ) { if( i==PF_UNREACHABLE ) { if( ++unit->SubAction==200 ) { unit->Orders[0].Action=UnitActionStill; if( (goal=unit->Orders[0].Goal) ) { RefsDebugCheck(!goal->Refs); if( !--goal->Refs ) { RefsDebugCheck(!goal->Destroyed); if( goal->Destroyed ) { ReleaseUnit(goal); } } unit->Orders[0].Goal=NoUnitP; } unit->SubAction=0; } else { unit->Wait=unit->SubAction; } } else if( i==PF_REACHED ) { unit->SubAction=201; } } } break; } }
/** ** The unit boards a transporter. ** ** @todo FIXME: While waiting for the transporter the units must defend themselves. ** ** @param unit Pointer to unit. */ void HandleActionBoard(CUnit *unit) { int i; CUnit *goal; switch (unit->SubAction) { // // Wait for transporter // case 201: if (WaitForTransporter(unit)) { unit->SubAction = 202; } else { UnitShowAnimation(unit, unit->Type->Animations->Still); } break; // // Enter transporter // case 202: EnterTransporter(unit); break; // // Move to transporter // case 0: if (unit->Wait) { unit->Wait--; return; } NewResetPath(unit); unit->SubAction = 1; // FALL THROUGH default: if (unit->SubAction <= 200) { // FIXME: if near transporter wait for enter if ((i = MoveToTransporter(unit))) { if (i == PF_UNREACHABLE) { if (++unit->SubAction == 200) { unit->ClearAction(); if ((goal = unit->Orders[0]->Goal)) { goal->RefsDecrease(); unit->Orders[0]->Goal = NoUnitP; } } else { // // Try with a bigger range. // if (unit->Orders[0]->Range <= Map.Info.MapWidth || unit->Orders[0]->Range <= Map.Info.MapHeight) { unit->Orders[0]->Range++; unit->SubAction--; } } } else if (i == PF_REACHED) { unit->SubAction = 201; } } } break; } }