src/town_gui.cpp
changeset 5838 9c3129cb019b
parent 5835 e0ff603ae0b7
child 5860 7fdc9b423ba1
equal deleted inserted replaced
5837:96b4b92b86ae 5838:9c3129cb019b
    14 #include "gui.h"
    14 #include "gui.h"
    15 #include "command.h"
    15 #include "command.h"
    16 #include "player.h"
    16 #include "player.h"
    17 #include "network/network.h"
    17 #include "network/network.h"
    18 #include "variables.h"
    18 #include "variables.h"
       
    19 #include "helpers.hpp"
    19 
    20 
    20 static const Widget _town_authority_widgets[] = {
    21 static const Widget _town_authority_widgets[] = {
    21 {   WWT_CLOSEBOX,   RESIZE_NONE,    13,     0,    10,     0,    13, STR_00C5,                 STR_018B_CLOSE_WINDOW},
    22 {   WWT_CLOSEBOX,   RESIZE_NONE,    13,     0,    10,     0,    13, STR_00C5,                 STR_018B_CLOSE_WINDOW},
    22 {    WWT_CAPTION,   RESIZE_NONE,    13,    11,   316,     0,    13, STR_2022_LOCAL_AUTHORITY, STR_018C_WINDOW_TITLE_DRAG_THIS},
    23 {    WWT_CAPTION,   RESIZE_NONE,    13,    11,   316,     0,    13, STR_2022_LOCAL_AUTHORITY, STR_018C_WINDOW_TITLE_DRAG_THIS},
    23 {      WWT_PANEL,   RESIZE_NONE,    13,     0,   316,    14,   105, 0x0,                      STR_NULL},
    24 {      WWT_PANEL,   RESIZE_NONE,    13,     0,   316,    14,   105, 0x0,                      STR_NULL},
   407 {
   408 {
   408 	const Town* t;
   409 	const Town* t;
   409 	uint n = 0;
   410 	uint n = 0;
   410 
   411 
   411 	/* Create array for sorting */
   412 	/* Create array for sorting */
   412 	_town_sort = realloc((void*)_town_sort, (GetMaxTownIndex() + 1) * sizeof(_town_sort[0]));
   413 	ReallocT(&_town_sort, GetMaxTownIndex() + 1);
   413 	if (_town_sort == NULL) error("Could not allocate memory for the town-sorting-list");
   414 	if (_town_sort == NULL) error("Could not allocate memory for the town-sorting-list");
   414 
   415 
   415 	FOR_ALL_TOWNS(t) _town_sort[n++] = t;
   416 	FOR_ALL_TOWNS(t) _town_sort[n++] = t;
   416 
   417 
   417 	_num_town_sort = n;
   418 	_num_town_sort = n;