From 42e98c56ff60552eac3894d8573b1b0ac1119791 Mon Sep 17 00:00:00 2001 From: dayfine Date: Mon, 9 Nov 2026 21:36:48 -0800 Subject: [PATCH 01/23] Pokemon navigation: write a route plan on one log line route_plan_line() put each planned leg on its own line under "plan from X:", so one log record wrapped across several lines while every other route line is one. The legs now follow on the same line, separated by "; ", in the same text route_leg_line() writes for them. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .../Source/Pokemon/Navigation/Pokemon_RouteLog.cpp | 11 ++++++++--- .../Source/Pokemon/Navigation/Pokemon_RouteLog.h | 8 ++++---- .../Pokemon/Navigation/Pokemon_RouteLog_Tests.cpp | 8 ++++---- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/SerialPrograms/Source/Pokemon/Navigation/Pokemon_RouteLog.cpp b/SerialPrograms/Source/Pokemon/Navigation/Pokemon_RouteLog.cpp index 29a51c94ea..b5d8912010 100644 --- a/SerialPrograms/Source/Pokemon/Navigation/Pokemon_RouteLog.cpp +++ b/SerialPrograms/Source/Pokemon/Navigation/Pokemon_RouteLog.cpp @@ -53,16 +53,21 @@ const char* basis_name(EndBasis basis){ } +// " to ", as the plan and the leg lines both write a leg. +static std::string planned_leg_text(const PlannedRouteLeg& leg){ + return to_string(leg.leg) + " to " + describe(leg.after); +} + std::string route_plan_line(const std::string& label, const std::vector& from, const std::vector& legs){ std::string text = label + ": plan from " + describe(from) + ":"; - for (const PlannedRouteLeg& leg : legs){ - text += "\n " + to_string(leg.leg) + " to " + describe(leg.after); + for (size_t i = 0; i < legs.size(); i++){ + text += (i == 0 ? " " : "; ") + planned_leg_text(legs[i]); } return text; } std::string route_leg_line(size_t number, size_t count, const PlannedRouteLeg& leg){ - return std::format("Leg {}/{}: {} to {}", number, count, to_string(leg.leg), describe(leg.after)); + return std::format("Leg {}/{}: {}", number, count, planned_leg_text(leg)); } std::string route_leg_end_line( diff --git a/SerialPrograms/Source/Pokemon/Navigation/Pokemon_RouteLog.h b/SerialPrograms/Source/Pokemon/Navigation/Pokemon_RouteLog.h index 07eb571f20..2b67f169d9 100644 --- a/SerialPrograms/Source/Pokemon/Navigation/Pokemon_RouteLog.h +++ b/SerialPrograms/Source/Pokemon/Navigation/Pokemon_RouteLog.h @@ -7,9 +7,7 @@ * routes from it. These are BDSP AutoStory's route lines, lifted from * PokemonBDSP_AutoStory_RouteWalk.cpp, with what the other games need: * - * [Route] To the grass: plan from Route 202 (15, 25), Route 202 (16, 25): - * east 15 (to wall) to Route 202 (23, 25), Route 202 (30, 26) - * north 5 (to wall) to Route 202 (23, 24) + * [Route] To the grass: plan from Route 202 (15, 25), Route 202 (16, 25): east 15 (to wall) to Route 202 (23, 25), Route 202 (30, 26); north 5 (to wall) to Route 202 (23, 24) * [Route] Leg 1/2: east 15 (to wall) to Route 202 (23, 25), Route 202 (30, 26) * [Route] To the grass: east 15 (to wall): ended at Route 202 (23, 25) (walked). * [Route] To the grass: north 5 (to wall): stopped early after about 2 tiles, at Route 202 (23, 23); planning again. @@ -93,7 +91,9 @@ enum class EndBasis{ const char* basis_name(EndBasis basis); -// "