From a1878d973f33aff85aec6b262a95b926eb954c43 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 5 Oct 2022 03:22:37 +0300 Subject: [PATCH 32/32] Improve illegal activities logging on savegame load See osdn #45341 Signed-off-by: Marko Lindqvist --- server/savegame/savegame2.c | 10 +++++++--- server/savegame/savegame3.c | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/server/savegame/savegame2.c b/server/savegame/savegame2.c index 769c538696..db563db3cf 100644 --- a/server/savegame/savegame2.c +++ b/server/savegame/savegame2.c @@ -2780,12 +2780,16 @@ static void sg_load_players(struct loaddata *loading) players_iterate(pplayer) { unit_list_iterate(pplayer->units, punit) { if (!can_unit_continue_current_activity(punit)) { - log_sg("Unit doing illegal activity in savegame!"); - log_sg("Activity: %s, Target: %s", + struct tile *ptile = unit_tile(punit); + + log_sg("%s doing illegal activity in savegame!", + unit_rule_name(punit)); + log_sg("Activity: %s, Target: %s, Tile: (%d, %d), Terrain: %s", unit_activity_name(punit->activity), punit->activity_target ? extra_rule_name( punit->activity_target) - : "missing"); + : "missing", + TILE_XY(ptile), terrain_rule_name(tile_terrain(ptile))); punit->activity = ACTIVITY_IDLE; } } unit_list_iterate_end; diff --git a/server/savegame/savegame3.c b/server/savegame/savegame3.c index cc6e8e07e4..958ca96952 100644 --- a/server/savegame/savegame3.c +++ b/server/savegame/savegame3.c @@ -3890,12 +3890,16 @@ static void sg_load_players(struct loaddata *loading) players_iterate(pplayer) { unit_list_iterate(pplayer->units, punit) { if (!can_unit_continue_current_activity(punit)) { - log_sg("Unit doing illegal activity in savegame!"); - log_sg("Activity: %s, Target: %s", + struct tile *ptile = unit_tile(punit); + + log_sg("%s doing illegal activity in savegame!", + unit_rule_name(punit)); + log_sg("Activity: %s, Target: %s, Tile: (%d, %d), Terrain: %s", unit_activity_name(punit->activity), punit->activity_target ? extra_rule_name( punit->activity_target) - : "missing"); + : "missing", + TILE_XY(ptile), terrain_rule_name(tile_terrain(ptile))); punit->activity = ACTIVITY_IDLE; } } unit_list_iterate_end; -- 2.35.1