From 49f769948b74954e60e4223c4ab4cb5a3f68646e Mon Sep 17 00:00:00 2001 From: pasky Date: Thu, 17 Mar 2005 23:12:23 +0000 Subject: [PATCH] =?UTF-8?q?(svn=20r2021)=20Fix:=20Enlarge=20=5Fcur=5Ftown?= =?UTF-8?q?=5Fctr=20from=20byte=20to=20uint32=20so=20that=20all=20the=20to?= =?UTF-8?q?wns=20are=20considered=20when=20growing=20them=20even=20for=20b?= =?UTF-8?q?ig=20maps,=20where=20much=20more=20than=20256=20towns=20are=20a?= =?UTF-8?q?round;=20reported=20by=20Tomasz=20Dubi=C5=84ski=20.=20The=20savegame=20still=20saves=20just=20?= =?UTF-8?q?the=20lowest=208=20bits=20but=20that=20doesn't=20hurt=20so=20mu?= =?UTF-8?q?ch.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- misc.c | 5 +++++ town_cmd.c | 2 +- variables.h | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/misc.c b/misc.c index f317def5ed..ba472e1e9b 100644 --- a/misc.c +++ b/misc.c @@ -772,6 +772,11 @@ static const SaveLoadGlobVarList _date_desc[] = { {&_station_tick_ctr, SLE_UINT16, 0, 255}, {&_random_seeds[0][0], SLE_UINT32, 0, 255}, {&_random_seeds[0][1], SLE_UINT32, 0, 255}, + /* XXX: We save only a portion of the _cur_town_ctr, this should be + * fixed in the next revision bump. It does not hurt so much since + * it just gives a small single-time penalty to the towns with higher + * IDs at the load time. _cur_town_ctr is zeroed in InitializeTowns() + * so the higher octets do not interfere at this time. */ {&_cur_town_ctr, SLE_UINT8, 0, 255}, {&_cur_player_tick_index, SLE_FILE_U8 | SLE_VAR_UINT, 0, 255}, {&_next_competitor_start, SLE_FILE_U16 | SLE_VAR_UINT, 0, 255}, diff --git a/town_cmd.c b/town_cmd.c index 7846d3fc09..7180113966 100644 --- a/town_cmd.c +++ b/town_cmd.c @@ -442,7 +442,7 @@ void OnTick_Town(void) for (counter += GetTownPoolSize(); counter >= TOWN_GROWTH_FREQUENCY; counter -= TOWN_GROWTH_FREQUENCY) { - int i = _cur_town_ctr; + uint32 i = _cur_town_ctr; Town *t; if (++_cur_town_ctr >= GetTownPoolSize()) diff --git a/variables.h b/variables.h index 575f7920ea..68fc02c19c 100644 --- a/variables.h +++ b/variables.h @@ -84,7 +84,7 @@ VARDEF uint32 _random_seeds[2][2]; VARDEF uint32 _player_seeds[MAX_PLAYERS][2]; // Iterator through all towns in OnTick_Town -VARDEF byte _cur_town_ctr; +VARDEF uint32 _cur_town_ctr; VARDEF uint _cur_player_tick_index; VARDEF uint _next_competitor_start;