From 8f104a2e971822e548d210bcd83f84057e54702d Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 24 May 2008 19:36:20 +0000 Subject: (svn r13233) -Fix: Replace some (incorrect) evaluations of TileOwner by RoadOwner. -Fix: Before evaluating RoadOwner, check if the roadtype is present. -Fix: Some places assumed that MP_ROAD means normal street. --- src/town_cmd.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/town_cmd.cpp') diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index e0033155f..f6e0eadca 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1212,14 +1212,14 @@ static int GrowTownAtRoad(Town *t, TileIndex tile) do target_dir = RandomDiagDir(); while (!(cur_rb & DiagDirToRoadBits(target_dir))); tile = TileAddByDiagDir(tile, target_dir); - if (IsTileType(tile, MP_ROAD)) { + if (IsTileType(tile, MP_ROAD) && !IsRoadDepot(tile) && HasTileRoadType(tile, ROADTYPE_ROAD)) { /* Don't allow building over roads of other cities */ - if (IsTileOwner(tile, OWNER_TOWN) && GetTownByTile(tile) != t) { + if (IsRoadOwner(tile, ROADTYPE_ROAD, OWNER_TOWN) && GetTownByTile(tile) != t) { _grow_town_result = GROWTH_SUCCEED; - } else if (IsTileOwner(tile, OWNER_NONE) && _game_mode == GM_EDITOR) { + } else if (IsRoadOwner(tile, ROADTYPE_ROAD, OWNER_NONE) && _game_mode == GM_EDITOR) { /* If we are in the SE, and this road-piece has no town owner yet, it just found an * owner :) (happy happy happy road now) */ - SetTileOwner(tile, OWNER_TOWN); + SetRoadOwner(tile, ROADTYPE_ROAD, OWNER_TOWN); SetTownIndex(tile, t->index); } } @@ -2438,8 +2438,8 @@ Town *CalcClosestTownFromTile(TileIndex tile, uint threshold) Town *ClosestTownFromTile(TileIndex tile, uint threshold) { if (IsTileType(tile, MP_HOUSE) || ( - IsTileType(tile, MP_ROAD) && - GetRoadOwner(tile, ROADTYPE_ROAD) == OWNER_TOWN + IsTileType(tile, MP_ROAD) && HasTileRoadType(tile, ROADTYPE_ROAD) && + IsRoadOwner(tile, ROADTYPE_ROAD, OWNER_TOWN) )) { return GetTownByTile(tile); } else { -- cgit v1.2.3-54-g00ecf