fix(battle): ignore non-player kills for firstKill and clamp assist loop
Ignore HUD kill feed entries with killer == -1 (mission air defense SAM/AAA and NPC units, common in Nuclear Escalation) when awarding firstKill, matching avengeAwards. Also re-read the offenders vector count after orig_iground_award_assists in local_mp_events.c so the post-call scan never reads past a shrunk array. Verified with root typecheck, MSVC x64 wto_ws.dll rebuild (0 warnings in project C code), and a runnable streak check.
This commit is contained in:
1 parent
480496ca93
commit
194417a388
2 files changed
+5
-1
No files matched your search
@@ -175,7 +175,8 @@ export function evaluateStreaks(definitions: readonly StreakDefinition[], facts:
|
||||
for (const time of facts.nuclearStrikes) award(def, time, 1);
|
||||
break;
|
||||
case 'firstKill': {
|
||||
const first = facts.feed.find((k) => k.killerTeam !== k.victimTeam);
|
||||
// Ignore non-player mission units (air defense SAM/AAA, NPCs) whose HUD feed killer id is -1.
|
||||
const first = facts.feed.find((k) => k.killer >= 0 && k.killerTeam !== k.victimTeam);
|
||||
if (first && first.killer === facts.localPlayerId) award(def, first.time, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -111,6 +111,9 @@ static void __fastcall hook_iground_award_assists(uint8_t *victim)
|
||||
orig_iground_award_assists(victim);
|
||||
|
||||
if (local_mp_is_host() && victim != NULL && arr != NULL && count > 0) {
|
||||
uint32_t post_count = *(uint32_t *)(victim + LMP_IGM_OFF_OFFENDERS_CNT);
|
||||
if (post_count < count)
|
||||
count = post_count;
|
||||
arr = *(uint8_t **)(victim + LMP_IGM_OFF_OFFENDERS_PTR);
|
||||
for (i = 0; arr != NULL && i < count; i++) {
|
||||
uint8_t *off = arr + i * LMP_OFFENDER_STRIDE;
|
||||
|
||||
Reference in new issue
Block a user