summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-04-26 07:24:19 +0000
committerpeter1138 <peter1138@openttd.org>2007-04-26 07:24:19 +0000
commit0eb9621096bc93793d6cc9404696a11699358aec (patch)
treec1f2e9ede4e91d7c5f268ea367d0d27f955e6eeb
parent60dbc59bf8bacbd4999e6b6da6cb6933b9acde9e (diff)
downloadopenttd-0eb9621096bc93793d6cc9404696a11699358aec.tar.xz
(svn r9718) -Fix: Don't allow building of rail vehicles whose railtype isn't available yet. This also affects the rail purchase window.
-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;
}