summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-07-13 15:03:42 +0000
committerrubidium <rubidium@openttd.org>2013-07-13 15:03:42 +0000
commit57a3a2b14793e20fb0a4a6b90de0bb55a850ef2f (patch)
treefebf8406dc413c7e6a153b754ce9614266a75be5 /src/script
parente6eede841a0f86b93826b930f2189f50218b3eee (diff)
downloadopenttd-57a3a2b14793e20fb0a4a6b90de0bb55a850ef2f.tar.xz
(svn r25605) -Fix [FS#5641]: [Script] If a NewGRF returned station type that could not be built by an AI via callback 18, an unknown error would be thrown instead of falling back to the default station
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/script_rail.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/script/api/script_rail.cpp b/src/script/api/script_rail.cpp
index fd1e3e920..161007de9 100644
--- a/src/script/api/script_rail.cpp
+++ b/src/script/api/script_rail.cpp
@@ -186,10 +186,11 @@
if (spec == NULL) {
DEBUG(grf, 1, "%s returned an invalid station ID for 'AI construction/purchase selection (18)' callback", file->filename);
} else {
- p2 |= spec->cls_id | index << 8;
+ /* We might have gotten an usable station spec. Try to build it, but if it fails we'll fall back to the original station. */
+ if (ScriptObject::DoCommand(tile, p1, p2 | spec->cls_id | index << 8, CMD_BUILD_RAIL_STATION)) return true;
}
-
}
+
return ScriptObject::DoCommand(tile, p1, p2, CMD_BUILD_RAIL_STATION);
}