diff options
author | Johannes E. Krause <j.k@eclipso.de> | 2021-01-25 17:29:09 +0100 |
---|---|---|
committer | Charles Pigott <charlespigott@googlemail.com> | 2021-02-13 16:07:23 +0000 |
commit | 3ac43582c2a24238c0725524e7965f110451b643 (patch) | |
tree | 1e80de9731e5869567a3ce22974d6e50df222d5b | |
parent | fa0704138d2396875422960be6a3f1e7b6ab1341 (diff) | |
download | openttd-3ac43582c2a24238c0725524e7965f110451b643.tar.xz |
Codechange: [NewGRF] Make it more explicit which parts of the TTD vehicle structure (var 80+) are not implemented
-rw-r--r-- | src/newgrf_engine.cpp | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index d67a5c118..ee14098c2 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -761,16 +761,29 @@ static uint32 VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *object, } } - /* General vehicle properties */ + /* + * General vehicle properties + * + * Some parts of the TTD Vehicle structure are omitted for various reasons + * (see http://marcin.ttdpatch.net/sv1codec/TTD-locations.html#_VehicleArray) + */ switch (variable - 0x80) { case 0x00: return v->type + 0x10; case 0x01: return MapOldSubType(v); + case 0x02: break; // not implemented + case 0x03: break; // not implemented case 0x04: return v->index; case 0x05: return GB(v->index, 8, 8); + case 0x06: break; // not implemented + case 0x07: break; // not implemented + case 0x08: break; // not implemented + case 0x09: break; // not implemented case 0x0A: return v->current_order.MapOldOrder(); case 0x0B: return v->current_order.GetDestination(); case 0x0C: return v->GetNumOrders(); case 0x0D: return v->cur_real_order_index; + case 0x0E: break; // not implemented + case 0x0F: break; // not implemented case 0x10: case 0x11: { uint ticks; @@ -811,14 +824,31 @@ static uint32 VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *object, case 0x1D: return GB(v->y_pos, 8, 8); case 0x1E: return v->z_pos; case 0x1F: return object->info_view ? DIR_W : v->direction; + case 0x20: break; // not implemented + case 0x21: break; // not implemented + case 0x22: break; // not implemented + case 0x23: break; // not implemented + case 0x24: break; // not implemented + case 0x25: break; // not implemented + case 0x26: break; // not implemented + case 0x27: break; // not implemented case 0x28: return 0; // cur_image is a potential desyncer due to Action1 in static NewGRFs. case 0x29: return 0; // cur_image is a potential desyncer due to Action1 in static NewGRFs. + case 0x2A: break; // not implemented + case 0x2B: break; // not implemented + case 0x2C: break; // not implemented + case 0x2D: break; // not implemented + case 0x2E: break; // not implemented + case 0x2F: break; // not implemented + case 0x30: break; // not implemented + case 0x31: break; // not implemented case 0x32: return v->vehstatus; case 0x33: return 0; // non-existent high byte of vehstatus case 0x34: return v->type == VEH_AIRCRAFT ? (v->cur_speed * 10) / 128 : v->cur_speed; case 0x35: return GB(v->type == VEH_AIRCRAFT ? (v->cur_speed * 10) / 128 : v->cur_speed, 8, 8); case 0x36: return v->subspeed; case 0x37: return v->acceleration; + case 0x38: break; // not implemented case 0x39: return v->cargo_type; case 0x3A: return v->cargo_cap; case 0x3B: return GB(v->cargo_cap, 8, 8); @@ -856,13 +886,43 @@ static uint32 VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *object, case 0x58: return GB(ClampToI32(v->GetDisplayProfitLastYear()), 16, 16); case 0x59: return GB(ClampToI32(v->GetDisplayProfitLastYear()), 24, 8); case 0x5A: return v->Next() == nullptr ? INVALID_VEHICLE : v->Next()->index; + case 0x5B: break; // not implemented case 0x5C: return ClampToI32(v->value); case 0x5D: return GB(ClampToI32(v->value), 8, 24); case 0x5E: return GB(ClampToI32(v->value), 16, 16); case 0x5F: return GB(ClampToI32(v->value), 24, 8); + case 0x60: break; // not implemented + case 0x61: break; // not implemented + case 0x62: break; // vehicle specific, see below + case 0x63: break; // not implemented + case 0x64: break; // vehicle specific, see below + case 0x65: break; // vehicle specific, see below + case 0x66: break; // vehicle specific, see below + case 0x67: break; // vehicle specific, see below + case 0x68: break; // vehicle specific, see below + case 0x69: break; // vehicle specific, see below + case 0x6A: break; // not implemented + case 0x6B: break; // not implemented + case 0x6C: break; // not implemented + case 0x6D: break; // not implemented + case 0x6E: break; // not implemented + case 0x6F: break; // not implemented + case 0x70: break; // not implemented + case 0x71: break; // not implemented case 0x72: return v->cargo_subtype; + case 0x73: break; // vehicle specific, see below + case 0x74: break; // vehicle specific, see below + case 0x75: break; // vehicle specific, see below + case 0x76: break; // vehicle specific, see below + case 0x77: break; // vehicle specific, see below + case 0x78: break; // not implemented + case 0x79: break; // not implemented case 0x7A: return v->random_bits; case 0x7B: return v->waiting_triggers; + case 0x7C: break; // vehicle specific, see below + case 0x7D: break; // vehicle specific, see below + case 0x7E: break; // not implemented + case 0x7F: break; // vehicle specific, see below } /* Vehicle specific properties */ |