diff options
author | smatz <smatz@openttd.org> | 2008-11-18 22:43:59 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-11-18 22:43:59 +0000 |
commit | 07e3c096b3b744ef1d094c9481faa31ec8d2034a (patch) | |
tree | fb5982346d711d936b8aa9f87eab53f416ab29d4 /src/road_map.h | |
parent | e1a36e90a44cf50ebcfa52ec8685e76230a22910 (diff) | |
download | openttd-07e3c096b3b744ef1d094c9481faa31ec8d2034a.tar.xz |
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
-Codechange: rewrite parts of code responsible for caching index of nearest town
Diffstat (limited to 'src/road_map.h')
-rw-r--r-- | src/road_map.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/road_map.h b/src/road_map.h index bc6639245..0131f2f05 100644 --- a/src/road_map.h +++ b/src/road_map.h @@ -189,10 +189,21 @@ static inline void SetRoadOwner(TileIndex t, RoadType rt, Owner o) static inline bool IsRoadOwner(TileIndex t, RoadType rt, Owner o) { - assert(rt == ROADTYPE_ROAD || HasTileRoadType(t, rt)); + assert(HasTileRoadType(t, rt)); return (GetRoadOwner(t, rt) == o); } +/** Checks if given tile has town owned road + * @param t tile to check + * @return true iff tile has road and the road is owned by a town + * @pre IsTileType(t, MP_ROAD) + */ +static inline bool HasTownOwnedRoad(TileIndex t) +{ + assert(IsTileType(t, MP_ROAD)); + return HasTileRoadType(t, ROADTYPE_ROAD) && IsRoadOwner(t, ROADTYPE_ROAD, OWNER_TOWN); +} + /** Which directions are disallowed ? */ enum DisallowedRoadDirections { DRD_NONE, ///< None of the directions are disallowed |