summaryrefslogtreecommitdiff
path: root/src/newgrf_engine.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-02-20 22:09:21 +0000
committerpeter1138 <peter1138@openttd.org>2007-02-20 22:09:21 +0000
commit3d581f4f894293f45666220de78651ba6b9a7d1c (patch)
tree9caff20858ac3f06265e4f69d54b9cdb03a47004 /src/newgrf_engine.cpp
parentf91ed92648c6577f7605e1eba63c82532735bbad (diff)
downloadopenttd-3d581f4f894293f45666220de78651ba6b9a7d1c.tar.xz
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
Diffstat (limited to 'src/newgrf_engine.cpp')
-rw-r--r--src/newgrf_engine.cpp42
1 files changed, 4 insertions, 38 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index 0a1183afb..2c3e0ac6a 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -18,44 +18,9 @@
#include "newgrf_cargo.h"
#include "date.h"
#include "helpers.hpp"
+#include "cargotype.h"
-
-/* Default cargo classes */
-static const uint16 _cargo_classes[NUM_GLOBAL_CID] = {
- CC_PASSENGERS,
- CC_BULK,
- CC_MAIL,
- CC_LIQUID,
- CC_PIECE_GOODS,
- CC_EXPRESS,
- CC_BULK,
- CC_PIECE_GOODS,
- CC_BULK,
- CC_PIECE_GOODS,
- CC_ARMOURED,
- CC_PIECE_GOODS,
- CC_REFRIGERATED | CC_EXPRESS,
- CC_REFRIGERATED | CC_EXPRESS,
- CC_BULK,
- CC_LIQUID,
- CC_LIQUID,
- CC_BULK,
- CC_PIECE_GOODS,
- CC_PIECE_GOODS,
- CC_EXPRESS,
- CC_BULK,
- CC_LIQUID,
- CC_BULK,
- CC_PIECE_GOODS,
- CC_LIQUID,
- CC_PIECE_GOODS,
- CC_PIECE_GOODS,
- CC_NOAVAILABLE,
- CC_NOAVAILABLE,
- CC_NOAVAILABLE,
-};
-
int _traininfo_vehicle_pitch = 0;
int _traininfo_vehicle_width = 29;
@@ -587,7 +552,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
if (u->cargo_cap == 0) continue;
/* Map from climate to global cargo ID */
cargo = _global_cargo_id[_opt.landscape][u->cargo_type];
- cargo_classes |= _cargo_classes[cargo];
+ cargo_classes |= GetCargo(cargo)->classes;
common_cargos[cargo]++;
user_def_data |= RailVehInfo(u->engine_type)->user_def_data;
}
@@ -644,8 +609,9 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
* cccc - the cargo class value of the cargo transported by the vehicle.
*/
CargoID cid = _global_cargo_id[_opt.landscape][v->cargo_type];
+ const CargoSpec *cs = GetCargo(v->cargo_type);
- return (_cargo_classes[cid] << 16) | (_cargoc.weights[v->cargo_type] << 8) | cid;
+ return (cs->classes << 16) | (cs->weight << 8) | cid;
}
case 0x48: return GetVehicleTypeInfo(v->engine_type); /* Vehicle Type Info */