From 770f86bbbe89401ddae8518910a6875af65c0ac3 Mon Sep 17 00:00:00 2001 From: dominik Date: Mon, 23 Aug 2004 21:04:39 +0000 Subject: (svn r122) Change: exclusive transport rights are now stored per town instead of per station Exclusive rights from old savegames will be reset. --- town_cmd.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'town_cmd.c') diff --git a/town_cmd.c b/town_cmd.c index e68fd9dd2..719ba2b8b 100644 --- a/town_cmd.c +++ b/town_cmd.c @@ -863,6 +863,8 @@ static void DoCreateTown(Town *t, TileIndex tile) t->ratings[i] = 500; t->have_ratings = 0; + t->exclusivity = (byte)-1; + t->exclusive_counter = 0; t->statues = 0; CreateTownName(t); @@ -1471,13 +1473,8 @@ static void TownActionFundBuildings(Town *t, int action) static void TownActionBuyRights(Town *t, int action) { - Station *st; - - FOR_ALL_STATIONS(st) { - if (st->xy && st->town == t && st->owner < 8 && - st->owner != _current_player) - st->blocked_months = 12; - } + t->exclusive_counter = 12; + t->exclusivity = _current_player; ModifyStationRatingAround(t->xy, _current_player, 130, 17); } @@ -1739,6 +1736,10 @@ void TownsMonthlyLoop() if (t->road_build_months != 0) t->road_build_months--; + if (t->exclusive_counter != 0) + if(--t->exclusive_counter==0) + t->exclusivity = (byte)-1; + UpdateTownGrowRate(t); UpdateTownAmounts(t); UpdateTownUnwanted(t); @@ -1827,8 +1828,10 @@ static const byte _town_desc[] = { SLE_VAR(Town,fund_buildings_months, SLE_UINT8), SLE_VAR(Town,road_build_months, SLE_UINT8), - // reserve extra space in savegame here. (currently 32 bytes) - SLE_CONDARR(NullStruct,null,SLE_FILE_U64 | SLE_VAR_NULL, 4, 2, 255), + SLE_VAR(Town,exclusivity, SLE_UINT8), + SLE_VAR(Town,exclusive_counter, SLE_UINT8), + // reserve extra space in savegame here. (currently 30 bytes) + SLE_CONDARR(NullStruct,null,SLE_FILE_U8 | SLE_VAR_NULL, 30, 2, 255), SLE_END() }; -- cgit v1.2.3-54-g00ecf