summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;