diff options
author | celestar <celestar@openttd.org> | 2005-02-17 10:56:19 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2005-02-17 10:56:19 +0000 |
commit | 2eda5228d1ee3007789b4e1f14ffa5b84a0ff637 (patch) | |
tree | c51545fe02021db0bfb157ca313142d0813a3bdb | |
parent | 6186162742e107f947642cddc1e542389886156a (diff) | |
download | openttd-2eda5228d1ee3007789b4e1f14ffa5b84a0ff637.tar.xz |
(svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
-rw-r--r-- | ai_new.c | 2 | ||||
-rw-r--r-- | functions.h | 1 | ||||
-rw-r--r-- | lang/english.txt | 4 | ||||
-rw-r--r-- | town.h | 16 | ||||
-rw-r--r-- | town_cmd.c | 27 | ||||
-rw-r--r-- | ttd.c | 7 |
6 files changed, 37 insertions, 20 deletions
@@ -190,7 +190,7 @@ static bool AiNew_Check_City_or_Industry(Player *p, int ic, byte type) { if (type == AI_CITY) { Town *t = GetTown(ic); Station *st; - int count = 0; + uint count = 0; int j = 0; // We don't like roadconstructions, don't even true such a city diff --git a/functions.h b/functions.h index 032c279c6..4e6681680 100644 --- a/functions.h +++ b/functions.h @@ -23,6 +23,7 @@ void AnimateTile(uint tile); void ClickTile(uint tile); void GetTileDesc(uint tile, TileDesc *td); void DrawTile(TileInfo *ti); +void UpdateTownMaxPass(Town *t); bool IsValidTile(uint tile); diff --git a/lang/english.txt b/lang/english.txt index d91046ca0..4f5011547 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -1509,8 +1509,8 @@ STR_2009_LOCAL_AUTHORITY_REFUSES :{WHITE}{TOWN} local authority refuses to al STR_200A_TOWN_NAMES_CLICK_ON_NAME :{BLACK}Town names - click on name to centre view on town STR_200B_CENTER_THE_MAIN_VIEW_ON :{BLACK}Centre the main view on town location STR_200C_CHANGE_TOWN_NAME :{BLACK}Change town name -STR_200D_PASSENGERS_LAST_MONTH_MAX :{BLACK}Passengers last month: {ORANGE}{COMMA16}{BLACK} max: {ORANGE}{COMMA16} -STR_200E_MAIL_LAST_MONTH_MAX :{BLACK}Mail last month: {ORANGE}{COMMA16}{BLACK} max: {ORANGE}{COMMA16} +STR_200D_PASSENGERS_LAST_MONTH_MAX :{BLACK}Passengers last month: {ORANGE}{COMMA32}{BLACK} max: {ORANGE}{COMMA32} +STR_200E_MAIL_LAST_MONTH_MAX :{BLACK}Mail last month: {ORANGE}{COMMA32}{BLACK} max: {ORANGE}{COMMA32} STR_200F_TALL_OFFICE_BLOCK :Tall office block STR_2010_OFFICE_BLOCK :Office block STR_2011_SMALL_BLOCK_OF_FLATS :Small block of flats @@ -35,14 +35,14 @@ struct Town { int16 ratings[MAX_PLAYERS]; // Maximum amount of passengers and mail that can be transported. - uint16 max_pass; - uint16 max_mail; - uint16 new_max_pass; - uint16 new_max_mail; - uint16 act_pass; - uint16 act_mail; - uint16 new_act_pass; - uint16 new_act_mail; + uint32 max_pass; + uint32 max_mail; + uint32 new_max_pass; + uint32 new_max_mail; + uint32 act_pass; + uint32 act_mail; + uint32 new_act_pass; + uint32 new_act_mail; // Amount of passengers that were transported. byte pct_pass_transported; diff --git a/town_cmd.c b/town_cmd.c index 43cdd61f5..104f2ca06 100644 --- a/town_cmd.c +++ b/town_cmd.c @@ -898,7 +898,7 @@ restart: } } -static void UpdateTownMaxPass(Town *t) +void UpdateTownMaxPass(Town *t) { t->max_pass = t->population >> 3; t->max_mail = t->population >> 4; @@ -1926,14 +1926,23 @@ static const byte _town_desc[] = { // failed bribe attempts are stored since savegame format 4 SLE_CONDARR(Town,unwanted, SLE_INT8, 8, 4,255), - SLE_VAR(Town,max_pass, SLE_UINT16), - SLE_VAR(Town,max_mail, SLE_UINT16), - SLE_VAR(Town,new_max_pass,SLE_UINT16), - SLE_VAR(Town,new_max_mail,SLE_UINT16), - SLE_VAR(Town,act_pass, SLE_UINT16), - SLE_VAR(Town,act_mail, SLE_UINT16), - SLE_VAR(Town,new_act_pass,SLE_UINT16), - SLE_VAR(Town,new_act_mail,SLE_UINT16), + SLE_CONDVAR(Town,max_pass, SLE_FILE_U16 | SLE_VAR_U32, 0, 8), + SLE_CONDVAR(Town,max_mail, SLE_FILE_U16 | SLE_VAR_U32, 0, 8), + SLE_CONDVAR(Town,new_max_pass,SLE_FILE_U16 | SLE_VAR_U32, 0, 8), + SLE_CONDVAR(Town,new_max_mail,SLE_FILE_U16 | SLE_VAR_U32, 0, 8), + SLE_CONDVAR(Town,act_pass, SLE_FILE_U16 | SLE_VAR_U32, 0, 8), + SLE_CONDVAR(Town,act_mail, SLE_FILE_U16 | SLE_VAR_U32, 0, 8), + SLE_CONDVAR(Town,new_act_pass,SLE_FILE_U16 | SLE_VAR_U32, 0, 8), + SLE_CONDVAR(Town,new_act_mail,SLE_FILE_U16 | SLE_VAR_U32, 0, 8), + + SLE_CONDVAR(Town,max_pass, SLE_UINT32, 9, 255), + SLE_CONDVAR(Town,max_mail, SLE_UINT32, 9, 255), + SLE_CONDVAR(Town,new_max_pass,SLE_UINT32, 9, 255), + SLE_CONDVAR(Town,new_max_mail,SLE_UINT32, 9, 255), + SLE_CONDVAR(Town,act_pass, SLE_UINT32, 9, 255), + SLE_CONDVAR(Town,act_mail, SLE_UINT32, 9, 255), + SLE_CONDVAR(Town,new_act_pass,SLE_UINT32, 9, 255), + SLE_CONDVAR(Town,new_act_mail,SLE_UINT32, 9, 255), SLE_VAR(Town,pct_pass_transported,SLE_UINT8), SLE_VAR(Town,pct_mail_transported,SLE_UINT8), @@ -1345,6 +1345,13 @@ bool AfterLoadGame(uint version) } END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0); } + if (version < 0x900) { + Town *t; + FOR_ALL_TOWNS(t) { + UpdateTownMaxPass(t); + } + } + return true; } |