From 83ab2fe5797c67932d9f7ce84ade6258715dc5a9 Mon Sep 17 00:00:00 2001 From: Dethrace Labs <78985374+dethrace-labs@users.noreply.github.com> Date: Wed, 8 Oct 2025 14:56:48 +1300 Subject: [PATCH] DropNodeOnNodeAndStopElasticating matching --- src/DETHRACE/common/opponent.c | 39 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/DETHRACE/common/opponent.c b/src/DETHRACE/common/opponent.c index 6032f440..d06435b7 100644 --- a/src/DETHRACE/common/opponent.c +++ b/src/DETHRACE/common/opponent.c @@ -4349,25 +4349,26 @@ void DropNodeOnNodeAndStopElasticating(void) { char str[256]; br_scalar distance; - if (gAlready_elasticating) { - node_no = FindNearestPathNode(&gSelf->t.t.translate.t, &distance); - if (gProgram_state.AI_vehicles.path_sections[gMobile_section].node_indices[0] == node_no || distance > 10.f) { - NewTextHeadupSlot(eHeadupSlot_misc, 0, 2000, -1, "Can't find any nodes close enough"); - } else if (gProgram_state.AI_vehicles.path_nodes[node_no].number_of_sections >= COUNT_OF(gProgram_state.AI_vehicles.path_nodes[node_no].sections)) { - sprintf(str, "Sorry, node #%d already has %d sections attached", node_no, (int)COUNT_OF(gProgram_state.AI_vehicles.path_nodes[node_no].sections)); - NewTextHeadupSlot(eHeadupSlot_misc, 0, 2000, -1, str); - } else { - gAlready_elasticating = 0; - gProgram_state.AI_vehicles.number_of_path_nodes -= 1; - gProgram_state.AI_vehicles.path_sections[gMobile_section].node_indices[1] = node_no; - gProgram_state.AI_vehicles.path_nodes[node_no].sections[gProgram_state.AI_vehicles.path_nodes[node_no].number_of_sections] = gMobile_section; - gProgram_state.AI_vehicles.path_nodes[node_no].number_of_sections += 1; - ShowOppoPaths(); - sprintf(str, "New section #%d, attached to existing node #%d", - gMobile_section, - gProgram_state.AI_vehicles.path_sections[gMobile_section].node_indices[1]); - NewTextHeadupSlot(eHeadupSlot_misc, 0, 4000, -1, str); - } + if (!gAlready_elasticating) { + return; + } + node_no = FindNearestPathNode(&gSelf->t.t.translate.t, &distance); + if (gProgram_state.AI_vehicles.path_sections[gMobile_section].node_indices[0] == node_no || distance > 10.f) { + NewTextHeadupSlot(eHeadupSlot_misc, 0, 2000, -1, "Can't find any nodes close enough"); + } else if (gProgram_state.AI_vehicles.path_nodes[node_no].number_of_sections >= COUNT_OF(gProgram_state.AI_vehicles.path_nodes[node_no].sections)) { + sprintf(str, "Sorry, node #%d already has %d sections attached", node_no, (int)COUNT_OF(gProgram_state.AI_vehicles.path_nodes[node_no].sections)); + NewTextHeadupSlot(eHeadupSlot_misc, 0, 2000, -1, str); + } else { + gAlready_elasticating = 0; + gProgram_state.AI_vehicles.number_of_path_nodes--; + gProgram_state.AI_vehicles.path_sections[gMobile_section].node_indices[1] = node_no; + gProgram_state.AI_vehicles.path_nodes[node_no].sections[gProgram_state.AI_vehicles.path_nodes[node_no].number_of_sections] = gMobile_section; + gProgram_state.AI_vehicles.path_nodes[node_no].number_of_sections++; + ShowOppoPaths(); + sprintf(str, "New section #%d, attached to existing node #%d", + gMobile_section, + gProgram_state.AI_vehicles.path_sections[gMobile_section].node_indices[1]); + NewTextHeadupSlot(eHeadupSlot_misc, 0, 4000, -1, str); } }