From 735d4ab6784c3f3739ef7573f2e0106433145dc9 Mon Sep 17 00:00:00 2001 From: Goober5000 Date: Wed, 10 Apr 2024 17:54:57 -0400 Subject: [PATCH] fix bad node identification for certain SEXP errors Set the bad node to the ship node, so that the FREDder can see which ship is receiving the invalid order. Without this change, the bad node would point to the last value parsed, which is typically the goal priority. Fixes a misleading error dialog reported in Discord. --- code/parse/sexp.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/parse/sexp.cpp b/code/parse/sexp.cpp index 5e40e3016a0..df4d28b523e 100644 --- a/code/parse/sexp.cpp +++ b/code/parse/sexp.cpp @@ -3176,12 +3176,16 @@ int check_sexp_syntax(int node, int return_type, int recursive, int *bad_node, s z = get_operator_const(z); if (ship_num >= 0) { if (!query_sexp_ai_goal_valid(z, ship_num)){ + if (bad_node) + *bad_node = ship_node; return SEXP_CHECK_ORDER_NOT_ALLOWED; } } else { for (i=0; i= 0)) { ship2 = ship_name_lookup(CTEXT(Sexp_nodes[node].rest), 1); // Goober5000 - include players if ((ship_num < 0) || !ship_docking_valid(ship_num, ship2)){ + if (bad_node) + *bad_node = ship_node; return SEXP_CHECK_DOCKING_NOT_ALLOWED; } }