Initial implementation of two rail types per tile

This commit is contained in:
Jonathan G Rennison
2018-12-21 03:27:58 +00:00
parent 8128d027c0
commit 65b9a103ad
24 changed files with 768 additions and 225 deletions

View File

@@ -355,7 +355,7 @@ protected:
/* rail transport is possible only on compatible rail types */
if (IsRailTT()) {
RailType rail_type = GetTileRailType(m_new_tile);
RailType rail_type = GetTileRailTypeByEntryDir(m_new_tile, m_exitdir);
if (!HasBit(m_railtypes, rail_type)) {
/* incompatible rail type */
m_err = EC_RAIL_TYPE;
@@ -481,7 +481,7 @@ public:
}
/* Check for speed limit imposed by railtype */
if (IsRailTT()) {
uint16 rail_speed = GetRailTypeInfo(GetRailType(m_old_tile))->max_speed;
uint16 rail_speed = GetRailTypeInfo(GetRailTypeByTrack(m_old_tile, TrackdirToTrack(m_old_td)))->max_speed;
if (rail_speed > 0) max_speed = min(max_speed, rail_speed);
}

View File

@@ -788,7 +788,7 @@ static bool CanEnterTile(TileIndex tile, DiagDirection dir, AyStarUserData *user
/* check correct rail type (mono, maglev, etc) */
if (user->type == TRANSPORT_RAIL) {
RailType rail_type = GetTileRailType(tile);
RailType rail_type = GetTileRailTypeByEntryDir(tile, dir);
if (!HasBit(user->railtypes, rail_type)) return false;
}

View File

@@ -46,7 +46,7 @@ protected:
this->tile = tile;
this->td = td;
this->tile_type = GetTileType(tile);
this->rail_type = GetTileRailType(tile);
this->rail_type = GetTileRailTypeByTrack(tile, TrackdirToTrack(td));
}
TILE(const TILE &src)