Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2005:
[Freeciv-Dev] (PR#12206) warming/cooling progress
Home

[Freeciv-Dev] (PR#12206) warming/cooling progress

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12206) warming/cooling progress
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 11 Feb 2005 13:50:59 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12206 >

> [jdorje - Thu Feb 10 19:17:16 2005]:
> 
> The tooltip says:
> 
> "Shows the progress of global warming: 3."
> 
> This should be changed to a % value.

Here is a rather complete patch.

- The warming/cooling rate as well as the chance of warming/cooling is
shown in the tooltip.  (This is a lot more useful than the indicator
icon, which on closer inspection is quite wrong.)

- The warminglevel and coolinglevel are sent to the client.  Without
this info the client cannot properly calculate the above percentages
(this should also be used to choose an indicator icon).

- The heating and cooling (per-turn) values are saved in the savegame. 
Without this you can't see the proper percentages when reloading a game
(until the next turn).

-jason

Index: client/text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/text.c,v
retrieving revision 1.24
diff -u -r1.24 text.c
--- client/text.c       8 Feb 2005 21:36:49 -0000       1.24
+++ client/text.c       11 Feb 2005 21:48:00 -0000
@@ -545,8 +545,12 @@
 {
   INIT;
 
-  add(_("Shows the progress of global warming:\n%d."),
-      client_warming_sprite());
+  /* This mirrors the logic in update_environmental_upset. */
+  add_line(_("Shows the progress of global warming:"));
+  add_line(_("Pollution rate: %d%%"),
+          DIVIDE(game.heating - game.warminglevel + 1, 2));
+  add_line(_("Chance of catastrophic warming each turn: %d%%"),
+          CLIP(0, (game.globalwarming + 1) / 2, 100));
   RETURN;
 }
 
@@ -558,8 +562,12 @@
 {
   INIT;
 
-  add(_("Shows the progress of nuclear winter:\n%d."),
-      client_cooling_sprite());
+  /* This mirrors the logic in update_environmental_upset. */
+  add_line(_("Shows the progress of nuclear winter:"));
+  add_line(_("Fallout rate: %d%%"),
+          DIVIDE(game.heating - game.warminglevel + 1, 2));
+  add_line(_("Chance of catastrophic winter each turn: %d%%"),
+          CLIP(0, (game.globalwarming + 1) / 2, 100));
   RETURN;
 }
 
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.468
diff -u -r1.468 packhand.c
--- client/packhand.c   9 Feb 2005 17:15:17 -0000       1.468
+++ client/packhand.c   11 Feb 2005 21:48:02 -0000
@@ -1325,8 +1325,11 @@
   game.nplayers=pinfo->nplayers;
   game.globalwarming=pinfo->globalwarming;
   game.heating=pinfo->heating;
+  game.warminglevel = pinfo->warminglevel;
   game.nuclearwinter=pinfo->nuclearwinter;
   game.cooling=pinfo->cooling;
+  game.coolinglevel = pinfo->coolinglevel;
+
   if (!can_client_change_view()) {
     /*
      * Hack to allow code that explicitly checks for Palace or City Walls
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.220
diff -u -r1.220 capstr.c
--- common/capstr.c     5 Feb 2005 07:41:54 -0000       1.220
+++ common/capstr.c     11 Feb 2005 21:48:02 -0000
@@ -82,7 +82,7 @@
  *     as long as possible.  We want to maintain network compatibility with
  *     the stable branch for as long as possible.
  */
-#define CAPABILITY "+Freeciv.Devel.2004.Feb.5b"
+#define CAPABILITY "+Freeciv.Devel.2004.Feb.11"
 
 void init_our_capability(void)
 {
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.93
diff -u -r1.93 packets.def
--- common/packets.def  5 Feb 2005 07:15:37 -0000       1.93
+++ common/packets.def  11 Feb 2005 21:48:02 -0000
@@ -345,7 +345,8 @@
 
   PLAYER min_players, max_players, nplayers, player_idx;
 
-  UINT32 globalwarming, heating, nuclearwinter, cooling;
+  UINT32 globalwarming, heating, warminglevel;
+  UINT32 nuclearwinter, cooling, coolinglevel;
 
   UINT8 cityfactor;
   UINT8 diplcost, freecost, conquercost;
Index: server/gamehand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamehand.c,v
retrieving revision 1.150
diff -u -r1.150 gamehand.c
--- server/gamehand.c   5 Feb 2005 07:15:38 -0000       1.150
+++ server/gamehand.c   11 Feb 2005 21:48:03 -0000
@@ -319,8 +319,10 @@
   ginfo.nplayers = game.nplayers;
   ginfo.globalwarming = game.globalwarming;
   ginfo.heating = game.heating;
+  ginfo.warminglevel = game.warminglevel;
   ginfo.nuclearwinter = game.nuclearwinter;
   ginfo.cooling = game.cooling;
+  ginfo.coolinglevel = game.coolinglevel;
   ginfo.diplomacy = game.diplomacy;
   ginfo.techpenalty = game.techpenalty;
   ginfo.foodbox = game.foodbox;
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.219
diff -u -r1.219 savegame.c
--- server/savegame.c   5 Feb 2005 07:41:54 -0000       1.219
+++ server/savegame.c   11 Feb 2005 21:48:03 -0000
@@ -3129,8 +3129,10 @@
     game.min_players   = secfile_lookup_int(file, "game.min_players");
     game.max_players   = secfile_lookup_int(file, "game.max_players");
     game.nplayers      = secfile_lookup_int(file, "game.nplayers");
+    game.heating = secfile_lookup_int_default(file, 0, "game.heating");
     game.globalwarming = secfile_lookup_int(file, "game.globalwarming");
     game.warminglevel  = secfile_lookup_int(file, "game.warminglevel");
+    game.cooling = secfile_lookup_int_default(file, 0, "game.cooling");
     game.nuclearwinter = secfile_lookup_int_default(file, 0, 
"game.nuclearwinter");
     game.coolinglevel  = secfile_lookup_int_default(file, 8, 
"game.coolinglevel");
     game.notradesize   = secfile_lookup_int_default(file, 0, 
"game.notradesize");
@@ -3300,9 +3302,6 @@
     game.auto_ai_toggle = secfile_lookup_bool_default(file, 
game.auto_ai_toggle,
                                                     "game.auto_ai_toggle");
 
-    game.heating=0;
-    game.cooling=0;
-
     load_rulesets();
   }
 
@@ -3664,9 +3663,11 @@
   secfile_insert_int(file, game.min_players, "game.min_players");
   secfile_insert_int(file, game.max_players, "game.max_players");
   secfile_insert_int(file, game.nplayers, "game.nplayers");
+  secfile_insert_int(file, game.heating, "game.heating");
   secfile_insert_int(file, game.globalwarming, "game.globalwarming");
   secfile_insert_int(file, game.warminglevel, "game.warminglevel");
   secfile_insert_int(file, game.nuclearwinter, "game.nuclearwinter");
+  secfile_insert_int(file, game.cooling, "game.cooling");
   secfile_insert_int(file, game.coolinglevel, "game.coolinglevel");
   secfile_insert_int(file, game.notradesize, "game.notradesize");
   secfile_insert_int(file, game.fulltradesize, "game.fulltradesize");

[Prev in Thread] Current Thread [Next in Thread]