mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-24 00:02:43 +02:00
port: different fix for chrAlertOthersOfInjury crash
This commit is contained in:
1 parent
9a7e9c9ee3
commit
28837dd034
1 file changed
+5
-6
@@ -8275,7 +8275,12 @@ void chrAlertOthersOfInjury(struct chrdata *chr, bool dying)
|
||||
index = chr->act_dead.notifychrindex;
|
||||
}
|
||||
|
||||
#ifdef AVOID_UB
|
||||
// notifychrindex can be < 0, so avoid reading g_ChrSlots when that is the case
|
||||
for (; index >= 0 && index < numchrs && numinrange < 7; index++) {
|
||||
#else
|
||||
for (; index < numchrs && numinrange < 7; index++) {
|
||||
#endif
|
||||
struct chrdata *loopchr = &g_ChrSlots[index];
|
||||
|
||||
if (loopchr->model && loopchr->prop && (loopchr->prop->flags & PROPFLAG_ENABLED)) {
|
||||
@@ -8488,12 +8493,6 @@ void chrTickDruggedComingUp(struct chrdata *chr)
|
||||
chrUncloak(chr, true);
|
||||
|
||||
chr->actiontype = ACT_DRUGGEDDROP;
|
||||
#ifdef AVOID_UB
|
||||
// the function that checks notifychrindex checks for ACT_DRUGGEDDROP,
|
||||
// so in theory it could check it before the drop animation is finished,
|
||||
// which will cause a crash. or at least I think that's what's happening
|
||||
chr->act_die.notifychrindex = 0;
|
||||
#endif
|
||||
|
||||
while (!done) {
|
||||
if (i >= 0
|
||||
|
||||
Reference in new issue
Block a user