summaryrefslogtreecommitdiff
path: root/town_cmd.c
diff options
context:
space:
mode:
authordominik <dominik@openttd.org>2004-08-23 21:04:39 +0000
committerdominik <dominik@openttd.org>2004-08-23 21:04:39 +0000
commit770f86bbbe89401ddae8518910a6875af65c0ac3 (patch)
treed6c03495cca54829908bbe695956a762e7f6a6ef /town_cmd.c
parent1d1d14ebd3e4d85683f61d120944646864cebe4f (diff)
downloadopenttd-770f86bbbe89401ddae8518910a6875af65c0ac3.tar.xz
(svn r122) Change: exclusive transport rights are now stored per town instead of per station
Exclusive rights from old savegames will be reset.
Diffstat (limited to 'town_cmd.c')
-rw-r--r--town_cmd.c21
1 files changed, 12 insertions, 9 deletions
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()
};