From 769573d1e96efe2893010277107d4e23f98e8046 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 7 Feb 2009 16:17:03 +0000 Subject: [PATCH] (svn r15399) -Fix [FS#2617]: For articulated parts v->cargo_type == CT_INVALID is possible. --- src/newgrf_engine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 13bc537aa1..6c502b977b 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;