forked from mirror/OpenTTD
(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
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user