summaryrefslogtreecommitdiff
path: root/src/vehicle_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vehicle_cmd.cpp')
-rw-r--r--src/vehicle_cmd.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index 46d8ba8e0..8dd84328c 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -139,12 +139,16 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
InvalidateWindowClassesData(GetWindowClassForVehicleType(type), 0);
SetWindowDirty(WC_COMPANY, _current_company);
if (IsLocalCompany()) {
- InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the auto replace window
+ InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the auto replace window (must be called before incrementing num_engines)
}
Company::Get(_current_company)->num_engines[eid]++;
+ GroupStatistics::CountEngine(v, 1);
- if (v->IsPrimaryVehicle()) OrderBackup::Restore(v, p2);
+ if (v->IsPrimaryVehicle()) {
+ GroupStatistics::CountVehicle(v, 1);
+ OrderBackup::Restore(v, p2);
+ }
}
return value;