summaryrefslogtreecommitdiff
path: root/src/train_cmd.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/train_cmd.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/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index c644b620e..7fd6d6a8b 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -456,9 +456,9 @@ int Train::GetDisplayImageWidth(Point *offset) const
int vehicle_pitch = 0;
const Engine *e = this->GetEngine();
- if (e->grf_prop.grffile != NULL && is_custom_sprite(e->u.rail.image_index)) {
- reference_width = e->grf_prop.grffile->traininfo_vehicle_width;
- vehicle_pitch = e->grf_prop.grffile->traininfo_vehicle_pitch;
+ if (e->GetGRF() != NULL && is_custom_sprite(e->u.rail.image_index)) {
+ reference_width = e->GetGRF()->traininfo_vehicle_width;
+ vehicle_pitch = e->GetGRF()->traininfo_vehicle_pitch;
}
if (offset != NULL) {
@@ -503,8 +503,8 @@ static SpriteID GetRailIcon(EngineID engine, bool rear_head, int &y)
if (is_custom_sprite(spritenum)) {
SpriteID sprite = GetCustomVehicleIcon(engine, dir);
if (sprite != 0) {
- if (e->grf_prop.grffile != NULL) {
- y += e->grf_prop.grffile->traininfo_vehicle_pitch;
+ if (e->GetGRF() != NULL) {
+ y += e->GetGRF()->traininfo_vehicle_pitch;
}
return sprite;
}
@@ -993,7 +993,7 @@ static CommandCost CheckTrainAttachment(Train *t)
StringID error = STR_NULL;
if (callback == 0xFD) error = STR_ERROR_INCOMPATIBLE_RAIL_TYPES;
- if (callback < 0xFD) error = GetGRFStringID(GetEngineGRFID(head->engine_type), 0xD000 + callback);
+ if (callback < 0xFD) error = GetGRFStringID(head->GetGRFID(), 0xD000 + callback);
if (error != STR_NULL) return_cmd_error(error);
}
@@ -3696,7 +3696,7 @@ Money Train::GetRunningCost() const
/* Halve running cost for multiheaded parts */
if (v->IsMultiheaded()) cost_factor /= 2;
- cost += GetPrice(e->u.rail.running_cost_class, cost_factor, e->grf_prop.grffile);
+ cost += GetPrice(e->u.rail.running_cost_class, cost_factor, e->GetGRF());
} while ((v = v->GetNextVehicle()) != NULL);
return cost;