summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-02-07 16:17:03 +0000
committerfrosch <frosch@openttd.org>2009-02-07 16:17:03 +0000
commit85b49d72ceb776413b072e9babcf568d1705ecbb (patch)
tree3664e671f50c9c8e6750dea67b1227456bb09da8
parent5b377ed53b7cccd36705461c4d50cce3847d9744 (diff)
downloadopenttd-85b49d72ceb776413b072e9babcf568d1705ecbb.tar.xz
(svn r15399) -Fix [FS#2617]: For articulated parts v->cargo_type == CT_INVALID is possible.
-rw-r--r--src/newgrf_engine.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index 13bc537aa..6c502b977 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -845,6 +845,12 @@ static const SpriteGroup *GetVehicleSpriteGroup(EngineID engine, const Vehicle *
const Engine *e = GetEngine(engine);
+ /* Engines are not available, when their cargo is not available.
+ * But that does not apply to articulated parts. */
+ if (cargo == CT_INVALID) cargo = CT_DEFAULT;
+
+ assert(cargo < lengthof(e->group));
+
group = e->group[cargo];
if (group != NULL) return group;