summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-07-04 12:20:42 +0000
committerfrosch <frosch@openttd.org>2009-07-04 12:20:42 +0000
commit7d90c06eb9ef743668ac314d03b3ba1c1ff1d3e1 (patch)
tree5fc487657557b83a16c2a338f5737ca2f970030f
parent571dfb90557e20f0f3b62288856eef68cc95ed1f (diff)
downloadopenttd-7d90c06eb9ef743668ac314d03b3ba1c1ff1d3e1.tar.xz
(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)
-rw-r--r--src/newgrf.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 9c28118c6..cd772f5d5 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 */