Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2005:
[Freeciv-Dev] (PR#13902) Grasslands bug
Home

[Freeciv-Dev] (PR#13902) Grasslands bug

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: bmorris3@xxxxxxxxxx
Subject: [Freeciv-Dev] (PR#13902) Grasslands bug
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Wed, 7 Sep 2005 07:34:25 -0700
Reply-to: bugs@xxxxxxxxxxx

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

> [guest - Wed Sep 07 12:05:21 2005]:
> 
> I think it would be a good idea to include the despotism penalty in the
> middle-mouse-button popup. 
> 
This is a patch for S2_0.
--
mateusz
? civscore.log
? data/nonew
Index: client/text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/text.c,v
retrieving revision 1.11.2.7
diff -u -r1.11.2.7 text.c
--- client/text.c       29 Dec 2004 17:25:00 -0000      1.11.2.7
+++ client/text.c       7 Sep 2005 14:31:21 -0000
@@ -125,6 +125,50 @@
   va_end(args);
 }
 
+/***************************************************************
+  Return a (static) string with a tile's food/prod/trade
+***************************************************************/
+static const char *map_get_tile_fpt_text(const struct tile *ptile)
+{
+  static char s[64];
+  char food[16];
+  char shields[16];
+  char trade[16];
+  int x, before_penalty;
+  
+  struct government *gov = get_gov_pplayer(game.player_ptr);
+  
+  x = get_food_tile(ptile);
+  before_penalty = gov->food_before_penalty;
+
+  if (before_penalty > 0 && x > before_penalty) {
+    my_snprintf(food, sizeof(food), "%d(-1)", x);
+  } else {
+    my_snprintf(food, sizeof(food), "%d", x);
+  }
+
+  x = get_shields_tile(ptile);
+  before_penalty = gov->shields_before_penalty;
+
+  if (before_penalty > 0 && x > before_penalty) {
+    my_snprintf(shields, sizeof(shields), "%d(-1)", x);
+  } else {
+    my_snprintf(shields, sizeof(shields), "%d", x);
+  }
+
+  x = get_trade_tile(ptile);
+  before_penalty = gov->trade_before_penalty;
+
+  if (before_penalty > 0 && x > before_penalty) {
+    my_snprintf(trade, sizeof(trade), "%d(-1)", x);
+  } else {
+    my_snprintf(trade, sizeof(trade), "%d", x);
+  }
+  
+  my_snprintf(s, sizeof(s), "%s/%s/%s", food, shields, trade);
+  return s;
+}
+
 /****************************************************************************
   Text to popup on a middle-click in the mapview.
 ****************************************************************************/
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.199.2.4
diff -u -r1.199.2.4 map.c
--- common/map.c        21 Jul 2005 19:32:04 -0000      1.199.2.4
+++ common/map.c        7 Sep 2005 14:31:23 -0000
@@ -152,20 +152,6 @@
 }
 
 /***************************************************************
-  Return a (static) string with a tile's food/prod/trade
-***************************************************************/
-const char *map_get_tile_fpt_text(const struct tile *ptile)
-{
-  static char s[64];
-  
-  my_snprintf(s, sizeof(s), "%d/%d/%d",
-             get_food_tile(ptile),
-             get_shields_tile(ptile),
-             get_trade_tile(ptile));
-  return s;
-}
-
-/***************************************************************
   Returns 1 if we are at a stage of the game where the map
   has not yet been generated/loaded.
   (To be precise, returns 1 if map_allocate() has not yet been
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.219.2.7
diff -u -r1.219.2.7 map.h
--- common/map.h        21 Jul 2005 19:32:04 -0000      1.219.2.7
+++ common/map.h        7 Sep 2005 14:31:30 -0000
@@ -218,7 +218,6 @@
 void map_free(void);
 
 const char *map_get_tile_info_text(const struct tile *ptile);
-const char *map_get_tile_fpt_text(const struct tile *ptile);
 
 int map_vector_to_real_distance(int dx, int dy);
 int map_vector_to_sq_distance(int dx, int dy);

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