summaryrefslogtreecommitdiff
path: root/src/vehicle_base.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-08-16 14:02:20 +0000
committerfrosch <frosch@openttd.org>2008-08-16 14:02:20 +0000
commitf7826f8a372d3120cc9d56e4d1c11df3e2fd577c (patch)
tree4c275596da6f577f47cea17f49ee3870846e07cb /src/vehicle_base.h
parent56459cab81f6a56d1fde29130670d001389ff7ce (diff)
downloadopenttd-f7826f8a372d3120cc9d56e4d1c11df3e2fd577c.tar.xz
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
Diffstat (limited to 'src/vehicle_base.h')
-rw-r--r--src/vehicle_base.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/vehicle_base.h b/src/vehicle_base.h
index 440f30d1d..f7d646f9b 100644
--- a/src/vehicle_base.h
+++ b/src/vehicle_base.h
@@ -483,6 +483,29 @@ public:
*/
inline bool IsOrderListShared() const { return this->next_shared != NULL || this->prev_shared != NULL; };
+ /**
+ * Copy certain configurations and statistics of a vehicle after successful autoreplace/renew
+ * The function shall copy everything that cannot be copied by a command (like orders / group etc),
+ * and that shall not be resetted for the new vehicle.
+ * @param src The old vehicle
+ */
+ inline void CopyVehicleConfigAndStatistics(const Vehicle *src)
+ {
+ this->unitnumber = src->unitnumber;
+
+ this->cur_order_index = src->cur_order_index;
+ this->current_order = src->current_order;
+ this->dest_tile = src->dest_tile;
+
+ this->profit_this_year = src->profit_this_year;
+ this->profit_last_year = src->profit_last_year;
+
+ this->current_order_time = src->current_order_time;
+ this->lateness_counter = src->lateness_counter;
+
+ this->service_interval = src->service_interval;
+ }
+
bool NeedsAutorenewing(const Player *p) const;
/**