summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/engine.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 41a7bbeaa..04f30689a 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -401,6 +401,12 @@ bool IsEngineBuildable(EngineID engine, byte type, PlayerID player)
/* check if it's available */
if (!HASBIT(e->player_avail, player)) return false;
+ if (type == VEH_TRAIN) {
+ /* Check if the rail type is available to this player */
+ const Player *p = GetPlayer(player);
+ if (!HASBIT(p->avail_railtypes, RailVehInfo(engine)->railtype)) return false;
+ }
+
return true;
}