From 5b44091a7fcde5badde2dbc17d2ac9a59eb749cf Mon Sep 17 00:00:00 2001 From: KJeff01 Date: Wed, 15 May 2024 16:10:43 -0500 Subject: [PATCH] Reset group from repairGroup if a repair event was prevented Such as telling the droid to do something else while it was going to repair. --- src/droid.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/droid.cpp b/src/droid.cpp index 2f4619a82ff..2dd80b2844e 100644 --- a/src/droid.cpp +++ b/src/droid.cpp @@ -86,6 +86,8 @@ static std::priority_queue 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); @@ -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);