diff options
author | peter1138 <peter1138@openttd.org> | 2009-03-16 08:03:50 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2009-03-16 08:03:50 +0000 |
commit | 5f57ea7198626ddfd6adb4f38681aec40c9bc634 (patch) | |
tree | fa8da31f67bf93d5063a9796ddccb23893c801c6 | |
parent | d02548b2041bfe2721d7ba172aca20ea310bcfe4 (diff) | |
download | openttd-5f57ea7198626ddfd6adb4f38681aec40c9bc634.tar.xz |
(svn r15739) -Codechange: Expose GRF ID of engines in var action property 0x25.
-rw-r--r-- | src/newgrf_engine.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index d1a300cf0..1f19b2f01 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -122,7 +122,8 @@ const GRFFile *GetEngineGRF(EngineID engine) */ uint32 GetEngineGRFID(EngineID engine) { - return GetEngineGRF(engine)->grfid; + const GRFFile *file = GetEngineGRF(engine); + return file == NULL ? 0 : file->grfid; } @@ -500,6 +501,9 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by /* Calculated vehicle parameters */ switch (variable) { + case 0x25: // Get engine GRF ID + return GetEngineGRFID(v->engine_type); + case 0x40: // Get length of consist if (!HasBit(v->cache_valid, 0)) { v->cached_var40 = PositionHelper(v, false); |