summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lang/english.txt1
-rw-r--r--town.h1
-rw-r--r--town_cmd.c11
-rw-r--r--town_gui.c11
4 files changed, 20 insertions, 4 deletions
diff --git a/lang/english.txt b/lang/english.txt
index 9d9f8916b..5c079d97c 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -772,6 +772,7 @@ STR_02DD_SUBSIDIES :Subsidies
STR_02DE_MAP_OF_WORLD :Map of world
STR_EXTRA_VIEW_PORT :Extra viewport
STR_02DF_TOWN_DIRECTORY :Town directory
+STR_TOWN_POPULATION :{BLACK}World population: {COMMA32}
STR_EXTRA_VIEW_PORT_TITLE :{WHITE}Viewport {COMMA16}
STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN :{BLACK}Copy to viewport
STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN_TT :{BLACK}Copy the location of the global view to this viewport
diff --git a/town.h b/town.h
index 408dc5bdf..7225e7747 100644
--- a/town.h
+++ b/town.h
@@ -73,6 +73,7 @@ struct Town {
uint16 radius[5];
};
+uint32 GetWorldPopulation();
void UpdateTownVirtCoord(Town *t);
void InitializeTown();
diff --git a/town_cmd.c b/town_cmd.c
index 54d478d1b..9b09c4b7c 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -203,6 +203,17 @@ static void ChangePopulation(Town *t, int mod)
if (_town_sort_order & 2) _town_sort_dirty = true;
}
+uint32 GetWorldPopulation()
+{
+ uint32 pop;
+ Town *t;
+ pop = 0;
+ FOR_ALL_TOWNS(t) {
+ pop += t->population;
+ }
+ return pop;
+}
+
static void MakeSingleHouseBigger(uint tile)
{
byte b;
diff --git a/town_gui.c b/town_gui.c
index b4da4c432..1c6c359a0 100644
--- a/town_gui.c
+++ b/town_gui.c
@@ -350,8 +350,9 @@ static const Widget _town_directory_widgets[] = {
{ WWT_PUSHTXTBTN, RESIZE_NONE, 13, 0, 98, 14, 25, STR_SORT_BY_NAME, STR_SORT_ORDER_TIP},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 13, 99, 195, 14, 25, STR_SORT_BY_POPULATION, STR_SORT_ORDER_TIP},
{ WWT_IMGBTN, RESIZE_BOTTOM, 13, 0, 195, 26, 189, 0x0, STR_200A_TOWN_NAMES_CLICK_ON_NAME},
-{ WWT_SCROLLBAR, RESIZE_BOTTOM, 13, 196, 207, 14, 177, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
-{ WWT_RESIZEBOX, RESIZE_TB, 13, 196, 207, 178, 189, 0x0, STR_RESIZE_BUTTON},
+{ WWT_SCROLLBAR, RESIZE_BOTTOM, 13, 196, 207, 14, 189, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
+{ WWT_PANEL, RESIZE_TB, 13, 0, 195, 190, 201, 0x0, STR_NULL},
+{ WWT_RESIZEBOX, RESIZE_TB, 13, 196, 207, 190, 201, 0x0, STR_RESIZE_BUTTON},
{ WIDGETS_END},
};
@@ -451,6 +452,8 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
i++;
if (++n == w->vscroll.cap) { break;} // max number of towns in 1 window
}
+ SetDParam(0, GetWorldPopulation());
+ DrawString(3, w->height - 12 + 2, STR_TOWN_POPULATION, 0);
}
} break;
@@ -498,7 +501,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
}
static const WindowDesc _town_directory_desc = {
- -1, -1, 208, 190,
+ -1, -1, 208, 202,
WC_TOWN_DIRECTORY,0,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
_town_directory_widgets,
@@ -514,7 +517,7 @@ void ShowTownDirectory()
if (w) {
w->vscroll.cap = 16;
w->resize.step_height = 10;
- w->resize.height = w->height - 10 * 6; // minimum of 10 items in the list
+ w->resize.height = w->height - 10 * 6; // minimum of 10 items in the list, each item 10 high
}
}