summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-11-01 00:23:41 +0000
committerfrosch <frosch@openttd.org>2011-11-01 00:23:41 +0000
commitacc3c75951c4db0873db794b657697774f0ff9e9 (patch)
tree2b7e5f953286b09c3c07688c9e8c49ee953c5adb /src/vehicle_gui.cpp
parent72cd855978bf45fd444eae72551a12e13a35b0c8 (diff)
downloadopenttd-acc3c75951c4db0873db794b657697774f0ff9e9.tar.xz
(svn r23075) -Codechange: Add GetGRF() and GetGRFID() methods to Engine and Vehicle to simplify code.
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 2475b9b1b..a464a120e 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -276,7 +276,7 @@ struct RefitOption {
CargoID cargo; ///< Cargo to refit to
byte subtype; ///< Subcargo to use
uint16 value; ///< GRF-local String to display for the cargo
- EngineID engine; ///< Engine for which to resolve #value
+ const Engine *engine; ///< Engine for which to resolve #value
/**
* Inequality operator for #RefitOption.
@@ -330,7 +330,7 @@ static void DrawVehicleRefitWindow(const SubtypeList list[NUM_CARGO], int sel, u
SetDParam(0, CargoSpec::Get(refit.cargo)->name);
/* If the callback succeeded, draw the cargo suffix. */
if (refit.value != CALLBACK_FAILED) {
- SetDParam(1, GetGRFStringID(GetEngineGRFID(refit.engine), 0xD000 + refit.value));
+ SetDParam(1, GetGRFStringID(refit.engine->GetGRFID(), 0xD000 + refit.value));
DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y, STR_JUST_STRING_SPACE_STRING, colour);
} else {
DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y, STR_JUST_STRING, colour);
@@ -428,7 +428,7 @@ struct RefitWindow : public Window {
option.cargo = cid;
option.subtype = refit_cyc;
option.value = callback;
- option.engine = v->engine_type;
+ option.engine = v->GetEngine();
this->list[current_index].Include(option);
}
@@ -445,7 +445,7 @@ struct RefitWindow : public Window {
option.cargo = cid;
option.subtype = 0;
option.value = CALLBACK_FAILED;
- option.engine = INVALID_ENGINE;
+ option.engine = NULL;
this->list[current_index].Include(option);
}
current_index++;
@@ -976,7 +976,7 @@ StringID GetCargoSubtypeText(const Vehicle *v)
if (HasBit(EngInfo(v->engine_type)->callback_mask, CBM_VEHICLE_CARGO_SUFFIX)) {
uint16 cb = GetVehicleCallback(CBID_VEHICLE_CARGO_SUFFIX, 0, 0, v->engine_type, v);
if (cb != CALLBACK_FAILED) {
- return GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + cb);
+ return GetGRFStringID(v->GetGRFID(), 0xD000 + cb);
}
}
return STR_EMPTY;