Skip to content

Commit

Permalink
Reset group from repairGroup if a repair event was prevented
Browse files Browse the repository at this point in the history
Such as telling the droid to do something else while it was going to repair.
  • Loading branch information
KJeff01 committed May 16, 2024
1 parent 34253d2 commit 5b44091
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/droid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ static std::priority_queue<int> recycled_experience[MAX_PLAYERS];
// the structure that was last hit
DROID *psLastDroidHit;

void droidWasFullyRepairedBase(DROID *psDroid);

//determines the best IMD to draw for the droid - A TEMP MEASURE!
static void groupConsoleInformOfSelection(UDWORD groupNumber);
static void groupConsoleInformOfCreation(UDWORD groupNumber);
Expand Down Expand Up @@ -802,6 +804,15 @@ void droidUpdate(DROID *psDroid)
return; // rest below is irrelevant if dead
}

// Restore group from repairGroup if the droid gets interrupted while retreating.
if (psDroid->repairGroup != UBYTE_MAX &&
psDroid->order.type != DORDER_RTR &&
psDroid->order.type != DORDER_RTR_SPECIFIED &&
psDroid->order.type != DORDER_RTB)
{
droidWasFullyRepairedBase(psDroid);
}

// ai update droid
aiUpdateDroid(psDroid);

Expand Down

0 comments on commit 5b44091

Please sign in to comment.