From da1628d0b524fbf139d25ce5020f796f5921beb3 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 4 Jul 2009 12:20:42 +0000 Subject: [PATCH] (svn r16737) -Fix (r15645): When loading a savegame Engine::grffile might be left NULL in certain cases. (dynamic_engines enabled, articulated vehicle with only wagon-override action3s) --- src/newgrf.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 9c28118c6f..cd772f5d5d 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -355,7 +355,11 @@ static Engine *GetNewEngine(const GRFFile *file, VehicleType type, uint16 intern /* Check if the engine is registered in the override manager */ EngineID engine = _engine_mngr.GetID(type, internal_id, scope_grfid); - if (engine != INVALID_ENGINE) return Engine::Get(engine); + if (engine != INVALID_ENGINE) { + Engine *e = Engine::Get(engine); + if (e->grffile == NULL) e->grffile = file; + return e; + } } /* Check if there is an unreserved slot */