From f024374ddc103e39bea4c7a100fd7a307f3a2d68 Mon Sep 17 00:00:00 2001 From: Dethrace Labs <78985374+dethrace-labs@users.noreply.github.com> Date: Tue, 23 Sep 2025 10:00:00 +1200 Subject: [PATCH] AddToOpponentsProjectedRoute matching --- src/DETHRACE/common/opponent.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/DETHRACE/common/opponent.c b/src/DETHRACE/common/opponent.c index a65b59e7..5b480b0f 100644 --- a/src/DETHRACE/common/opponent.c +++ b/src/DETHRACE/common/opponent.c @@ -844,13 +844,14 @@ void ClearOpponentsProjectedRoute(tOpponent_spec* pOpponent_spec) { // FUNCTION: CARM95 0x004030ef int AddToOpponentsProjectedRoute(tOpponent_spec* pOpponent_spec, tS16 pSection_no, int pDirection) { - if (pOpponent_spec->nnext_sections >= COUNT_OF(pOpponent_spec->next_sections)) { + if (pOpponent_spec->nnext_sections < COUNT_OF(pOpponent_spec->next_sections)) { + pOpponent_spec->next_sections[pOpponent_spec->nnext_sections].section_no = pSection_no; + pOpponent_spec->next_sections[pOpponent_spec->nnext_sections].direction = pDirection; + pOpponent_spec->nnext_sections++; + return 1; + } else { return 0; } - pOpponent_spec->next_sections[pOpponent_spec->nnext_sections].section_no = pSection_no; - pOpponent_spec->next_sections[pOpponent_spec->nnext_sections].direction = pDirection; - pOpponent_spec->nnext_sections++; - return 1; } // IDA: int __usercall ShiftOpponentsProjectedRoute@(tOpponent_spec *pOpponent_spec@, int pPlaces@)