summaryrefslogtreecommitdiff
path: root/src/town_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-05-24 19:36:20 +0000
committerfrosch <frosch@openttd.org>2008-05-24 19:36:20 +0000
commit8f104a2e971822e548d210bcd83f84057e54702d (patch)
treec397ff33001e474f450c64ea28b740db9fd01e81 /src/town_cmd.cpp
parentca244cbd06c071ee625f47ddf80d055bfcab072f (diff)
downloadopenttd-8f104a2e971822e548d210bcd83f84057e54702d.tar.xz
(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.
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r--src/town_cmd.cpp12
1 files changed, 6 insertions, 6 deletions
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 {