summaryrefslogtreecommitdiff
path: root/src/town_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/town_gui.cpp')
-rw-r--r--src/town_gui.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index f580cd324..56084b3b2 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -16,6 +16,7 @@
#include "player.h"
#include "network/network.h"
#include "variables.h"
+#include "helpers.hpp"
static const Widget _town_authority_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
@@ -409,7 +410,7 @@ static void MakeSortedTownList(void)
uint n = 0;
/* Create array for sorting */
- _town_sort = realloc((void*)_town_sort, (GetMaxTownIndex() + 1) * sizeof(_town_sort[0]));
+ ReallocT(&_town_sort, GetMaxTownIndex() + 1);
if (_town_sort == NULL) error("Could not allocate memory for the town-sorting-list");
FOR_ALL_TOWNS(t) _town_sort[n++] = t;