From e04b5b7276f96e45f925dda7406d9deb9b0bb693 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 14 May 2022 06:55:40 +0300 Subject: [PATCH 43/43] Delay government change to the end of phase During a turn when players can freely change government, do not allow them to use multiple governments during the turn. Instead do the actual government change at the end of the phase, based on the final choice the player made. Reported by ihnatus See osdn #43604 Signed-off-by: Marko Lindqvist --- server/plrhand.c | 6 +++++- server/srv_main.c | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/server/plrhand.c b/server/plrhand.c index 7e451d7156..cd407648ef 100644 --- a/server/plrhand.c +++ b/server/plrhand.c @@ -586,7 +586,11 @@ void handle_player_change_government(struct player *pplayer, /* Now see if the revolution is instantaneous. */ if (turns <= 0 && pplayer->target_government != game.government_during_revolution) { - government_change(pplayer, pplayer->target_government, TRUE); + notify_player(pplayer, NULL, E_REVOLT_START, ftc_server, + _("The %s will switch to %s in the end of " + "the player phase."), + nation_plural_for_player(pplayer), + government_name_translation(pplayer->target_government)); return; } else if (turns > 0) { notify_player(pplayer, NULL, E_REVOLT_START, ftc_server, diff --git a/server/srv_main.c b/server/srv_main.c index afa600ff93..f79caf65e5 100644 --- a/server/srv_main.c +++ b/server/srv_main.c @@ -1358,10 +1358,17 @@ static void end_phase(void) lsend_packet_end_phase(pplayer->connections); } phase_players_iterate_end; - /* Enact any policy changes. + /* Enact any government and/or policy changes. * Do this first so that following end-phase activities take the * change into account. */ phase_players_iterate(pplayer) { + if (pplayer->revolution_finishes <= game.info.turn + && pplayer->target_government != NULL + && pplayer->target_government != game.government_during_revolution + && pplayer->target_government != pplayer->government) { + government_change(pplayer, pplayer->target_government, TRUE); + } + multipliers_iterate(pmul) { int idx = multiplier_index(pmul); -- 2.35.1