diff options
author | frosch <frosch@openttd.org> | 2011-11-01 00:23:41 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-11-01 00:23:41 +0000 |
commit | acc3c75951c4db0873db794b657697774f0ff9e9 (patch) | |
tree | 2b7e5f953286b09c3c07688c9e8c49ee953c5adb /src/train_cmd.cpp | |
parent | 72cd855978bf45fd444eae72551a12e13a35b0c8 (diff) | |
download | openttd-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.cpp | 14 |
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; |