(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:
26
depot.h
26
depot.h
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user