summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 5827b46da..7110cb46b 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -211,8 +211,7 @@ uint Vehicle::Crash(bool flooded)
void ShowNewGrfVehicleError(EngineID engine, StringID part1, StringID part2, GRFBugs bug_type, bool critical)
{
const Engine *e = Engine::Get(engine);
- uint32 grfid = e->grf_prop.grffile->grfid;
- GRFConfig *grfconfig = GetGRFConfig(grfid);
+ GRFConfig *grfconfig = GetGRFConfig(e->GetGRFID());
if (!HasBit(grfconfig->grf_bugs, bug_type)) {
SetBit(grfconfig->grf_bugs, bug_type);
@@ -642,6 +641,26 @@ const Engine *Vehicle::GetEngine() const
}
/**
+ * Retrieve the NewGRF the vehicle is tied to.
+ * This is the GRF providing the Action 3 for the engine type.
+ * @return NewGRF associated to the vehicle.
+ */
+const GRFFile *Vehicle::GetGRF() const
+{
+ return this->GetEngine()->GetGRF();
+}
+
+/**
+ * Retrieve the GRF ID of the NewGRF the vehicle is tied to.
+ * This is the GRF providing the Action 3 for the engine type.
+ * @return GRF ID of the associated NewGRF.
+ */
+uint32 Vehicle::GetGRFID() const
+{
+ return this->GetEngine()->GetGRFID();
+}
+
+/**
* Handle the pathfinding result, especially the lost status.
* If the vehicle is now lost and wasn't previously fire an
* event to the AIs and a news message to the user. If the