August 12th Hotfix

Includes fix for infinite loop in FootClass::Detach
This commit is contained in:
PG-SteveT 2020-08-12 11:32:36 -07:00
parent ae72fce5dd
commit 1f6350fe6e
9 changed files with 38 additions and 10 deletions

View file

@ -2048,14 +2048,23 @@ void FootClass::Detach(TARGET target, bool all)
/*
** Remove the target from the NavQueue list as well.
*/
int loop_count = 0;
for (int index = 0; index < ARRAY_SIZE(NavQueue); index++) {
if (NavQueue[index] == target) {
NavQueue[index] = TARGET_NONE;
if (index < ARRAY_SIZE(NavQueue)-1) {
memmove(&NavQueue[index], &NavQueue[index+1], ((ARRAY_SIZE(NavQueue)-index)-1) * sizeof(NavQueue[0]));
NavQueue[ARRAY_SIZE(NavQueue)-1] = TARGET_NONE;
index--;
}
}
/*
** Extra safety check
*/
loop_count++;
if (loop_count > ARRAY_SIZE(NavQueue)) {
break;
}
}
/*
@ -2606,4 +2615,4 @@ int FootClass::Mission_Retreat(void)
}
return(MissionControl[Mission].Normal_Delay() + Random_Pick(0, 2));
}
}