diff options
author | frosch <frosch@openttd.org> | 2009-02-21 13:24:55 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-02-21 13:24:55 +0000 |
commit | a9cccbd53adcf5054d75c22d86f3acec4de9db0d (patch) | |
tree | 28d0f0aa3e0eafd384beb5fd75714b5ebb8b4ca3 | |
parent | abe4692da2a22dbfafb990db7c28a6d1d3cdcb16 (diff) | |
download | openttd-a9cccbd53adcf5054d75c22d86f3acec4de9db0d.tar.xz |
(svn r15542) -Feature(ette): Support vehicle vars 0x47 and 0xF2 in purchase list.
-rw-r--r-- | src/newgrf_engine.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index bf64c95f8..2d4a5bcef 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -452,10 +452,21 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by switch (variable) { case 0x43: return _current_company | (LiveryHelper(object->u.vehicle.self_type, NULL) << 24); // Owner information case 0x46: return 0; // Motion counter + case 0x47: { // Vehicle cargo info + const Engine *e = GetEngine(object->u.vehicle.self_type); + CargoID cargo_type = e->GetDefaultCargoType(); + if (cargo_type != CT_INVALID) { + const CargoSpec *cs = GetCargo(cargo_type); + return (cs->classes << 16) | (cs->weight << 8) | GetEngineGRF(e->index)->cargo_map[cargo_type]; + } else { + return 0x000000FF; + } + } case 0x48: return GetEngine(object->u.vehicle.self_type)->flags; // Vehicle Type Info case 0x49: return _cur_year; // 'Long' format build year case 0xC4: return Clamp(_cur_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR; // Build year case 0xDA: return INVALID_VEHICLE; // Next vehicle + case 0xF2: return 0; // Cargo subtype } *available = false; |