Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] Re: (PR#10685) Revolution doesn't end
Home

[Freeciv-Dev] Re: (PR#10685) Revolution doesn't end

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: bruce@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#10685) Revolution doesn't end
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 8 Nov 2004 09:58:13 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10685 >

Jason Short wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=10685 >
> 
>>[bruce@xxxxxxxxx - Fri Oct 22 22:11:56 2004]:
>>
>>Hi,
>>
>>   Searched the bug database but didn't find this one:  If you start a 
>>revolution by just choosing 'revolution' rather than picking a new 
>>government, you get the message 'revolution ended' every turn, but no 
>>popup to choose the new government, so you just stay in anarchy.
> 
> 
> This patch improves the behavior.

...but not by very much.  This patch actually fixes the behavior. 
Messages are generated by the server so there is little chance for error.

jason

? a.out
? foo.c
? freeciv-2.0.0-beta3.tar.gz
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.408.2.6
diff -u -r1.408.2.6 packhand.c
--- client/packhand.c   4 Nov 2004 20:57:49 -0000       1.408.2.6
+++ client/packhand.c   8 Nov 2004 17:57:06 -0000
@@ -1576,16 +1576,7 @@
       append_output_window(msg);
     }
   }
-  
-  if (pplayer == game.player_ptr
-      && pplayer->revolution_finishes >= 0
-      && pplayer->revolution_finishes <= game.turn
-      && pplayer->government == game.government_when_anarchy
-      && (!game.player_ptr->ai.control || ai_popup_windows)
-      && can_client_change_view()) {
-    create_event(NULL, E_REVOLT_DONE, _("Game: Revolution finished"));
-  }
-  
+
   update_players_dialog();
   update_worklist_report_dialog();
   upgrade_canvas_clipboard();
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.330.2.6
diff -u -r1.330.2.6 plrhand.c
--- server/plrhand.c    4 Nov 2004 17:39:14 -0000       1.330.2.6
+++ server/plrhand.c    8 Nov 2004 17:57:07 -0000
@@ -871,10 +871,11 @@
          "Revolution finished for %s.  Government is %s.  Revofin %d (%d).",
          pplayer->name, get_government_name(government),
          pplayer->revolution_finishes, game.turn);
-  notify_player(pplayer, _("Game: %s now governs the %s as a %s."), 
-               pplayer->name, 
-               get_nation_name_plural(pplayer->nation),
-               get_government_name(government));  
+  notify_player_ex(pplayer, NULL, E_REVOLT_DONE,
+                  _("Game: %s now governs the %s as a %s."), 
+                  pplayer->name, 
+                  get_nation_name_plural(pplayer->nation),
+                  get_government_name(government));  
   gamelog(GAMELOG_GOVERNMENT, _("%s form a %s"),
          get_nation_name_plural(pplayer->nation),
          get_government_name(government));
@@ -1014,11 +1015,20 @@
          get_government_name(pplayer->target_government),
          pplayer->revolution_finishes, game.turn);
   if (pplayer->government == game.government_when_anarchy
-      && pplayer->target_government != game.government_when_anarchy
-      && pplayer->revolution_finishes == game.turn) {
-    freelog(LOG_DEBUG, "Update: finishing revolution for %s.",
-           pplayer->name);
-    finish_revolution(pplayer);
+      && pplayer->revolution_finishes <= game.turn) {
+    if (pplayer->target_government != game.government_when_anarchy) {
+      /* If the revolution is over and a target government is set, go into
+       * the new government. */
+      freelog(LOG_DEBUG, "Update: finishing revolution for %s.",
+             pplayer->name);
+      finish_revolution(pplayer);
+    } else {
+      /* If the revolution is over but there's no target government set,
+       * alert the player. */
+      notify_player_ex(pplayer, NULL, E_REVOLT_DONE,
+                      _("You should choose a new government from the "
+                        "government menu."));
+    }
   } else if (pplayer->government != game.government_when_anarchy
             && pplayer->revolution_finishes < game.turn) {
     /* Reset the revolution counter.  If the player has another revolution

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#10685) Revolution doesn't end, Jason Short <=