(svn r2154) - Fix: [NPF] Vehicles should no longer try to drive through the back of depots and road stations.

- Add: GetDepotDirection() wrapper function.
- Fix: [NPF] Ships can now actually reach buoys.
This commit is contained in:
matthijs
2005-04-05 22:06:02 +00:00
parent 50003f4ed9
commit d08dfa84a4
2 changed files with 37 additions and 8 deletions

26
depot.h
View File

@@ -71,6 +71,32 @@ static inline bool IsTileDepotType(TileIndex tile, TransportType type)
}
}
/**
* Returns the direction the exit of the depot on the given tile is facing.
*/
static inline uint GetDepotDirection(TileIndex tile, TransportType type)
{
assert(IsTileDepotType(tile, type));
switch (type)
{
case TRANSPORT_RAIL:
case TRANSPORT_ROAD:
/* Rail and road store a diagonal direction in bits 0 and 1 */
return _map5[tile] & 3;
case TRANSPORT_WATER:
/* Water is stubborn, it stores the directions in a different order. */
switch (_map5[tile] & 3) {
case 0: return 0;
case 1: return 2;
case 2: return 3;
case 3: return 1;
}
default:
return 0; /* Not reached */
}
}
Depot *GetDepotByTile(uint tile);
void InitializeDepot(void);
Depot *AllocateDepot(void);