Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Show turns to growth in city dialog.

  • Loading branch information...
commit 68f4f135d778d6fe491f8368ca922e65884f8de4 1 parent 83dce56
@andreasrosdal andreasrosdal authored
View
3  freeciv-web/src/main/webapp/css/civclient.css
@@ -413,6 +413,9 @@ button {
padding-right: 10px;
}
+#city_production_overview {
+ padding-top: 10px;
+}
/* This is for popup menu support */
.hidden { position:absolute; top:0; left:-9999px; width:1px; height:1px; overflow:hidden; }
View
22 freeciv-web/src/main/webapp/javascript/city.js
@@ -103,7 +103,9 @@ function show_city_dialog(pcity)
$("#city_heading").html(unescape(pcity['name']));
- $("#city_size").html("City size: " + pcity['size']);
+ $("#city_size").html("City size: " + pcity['size'] + "<br>"
+ + "Granary: " + pcity['food_stock'] + "/" + pcity['granary_size'] + "<br>"
+ + "Change in: " + city_turns_to_growth_text(pcity));
if (pcity['production_kind'] == VUT_UTYPE) {
var punit_type = unit_types[pcity['production_value']];
@@ -554,6 +556,24 @@ function city_sell_improvement(improvement_id)
}
/**************************************************************************
+ Create text describing city growth.
+**************************************************************************/
+function city_turns_to_growth_text(pcity)
+{
+ var turns = pcity['granary_turns'];
+
+ if (turns == 0) {
+ return "blocked";
+ } else if (turns > 1000000) {
+ return "never";
+ } else if (turns < 0) {
+ return "Starving in " + Math.abs(turns) + " turns";
+ } else {
+ return turns + " turns";
+ }
+}
+
+/**************************************************************************
Converts from coordinate offset from city center (dx, dy),
to index in the city_info['food_output'] packet.
**************************************************************************/
View
11 freeciv/patches/city_fixes.patch
@@ -1,6 +1,15 @@
diff -Nurd -X.diff_ignore freeciv/common/packets.def freeciv/common/packets.def
--- freeciv/common/packets.def 2012-09-02 02:23:30.000000000 +0300
+++ freeciv/common/packets.def 2012-09-02 02:28:44.000000000 +0300
+@@ -574,6 +574,8 @@
+ SINT16 citizen_base[O_LAST];
+ SINT16 usage[O_LAST];
+ UINT16 food_stock, shield_stock;
++ UINT16 granary_size;
++ TURN granary_turns;
+
+ UINT16 trade[MAX_TRADE_ROUTES];
+ UINT8 trade_value[MAX_TRADE_ROUTES];
@@ -582,10 +582,10 @@
BOOL walls;
SINT8 city_image;
@@ -61,6 +70,8 @@ diff -Nurd -X.diff_ignore freeciv/server/citytools.c freeciv/server/citytools.c
packet->pollution = pcity->pollution;
packet->illness_trade = pcity->illness_trade;
- packet->city_options = pcity->city_options;
++ packet->granary_size = city_granary_size(city_size_get(pcity));
++ packet->granary_turns = city_turns_to_grow(pcity);
+ /* packet->city_options = pcity->city_options; */
packet->production_kind = pcity->production.kind;
Please sign in to comment.
Something went wrong with that request. Please try again.