mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
(svn r24443) -Codechange: Move Vehicle::name to BaseConsist.
This commit is contained in:
parent
2a875a1907
commit
4216eb383f
@ -357,11 +357,6 @@ static CommandCost CopyHeadSpecificThings(Vehicle *old_head, Vehicle *new_head,
|
||||
|
||||
/* Last do those things which do never fail (resp. we do not care about), but which are not undo-able */
|
||||
if (cost.Succeeded() && old_head != new_head && (flags & DC_EXEC) != 0) {
|
||||
/* Copy vehicle name */
|
||||
if (old_head->name != NULL) {
|
||||
DoCommand(0, new_head->index, 0, DC_EXEC | DC_AUTOREPLACE, CMD_RENAME_VEHICLE, old_head->name);
|
||||
}
|
||||
|
||||
/* Copy other things which cannot be copied by a command and which shall not stay resetted from the build vehicle command */
|
||||
new_head->CopyVehicleConfigAndStatistics(old_head);
|
||||
|
||||
|
@ -12,6 +12,11 @@
|
||||
#include "stdafx.h"
|
||||
#include "base_consist.h"
|
||||
|
||||
BaseConsist::~BaseConsist()
|
||||
{
|
||||
free(this->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy properties of other BaseConsist.
|
||||
* @param src Source for copying
|
||||
@ -20,6 +25,9 @@ void BaseConsist::CopyConsistPropertiesFrom(const BaseConsist *src)
|
||||
{
|
||||
if (this == src) return;
|
||||
|
||||
free(this->name);
|
||||
this->name = src->name != NULL ? strdup(src->name) : NULL;
|
||||
|
||||
this->service_interval = src->service_interval;
|
||||
this->cur_real_order_index = src->cur_real_order_index;
|
||||
}
|
||||
|
@ -17,9 +17,13 @@
|
||||
|
||||
/** Various front vehicle properties that are preserved when autoreplacing, using order-backup or switching front engines within a consist. */
|
||||
struct BaseConsist {
|
||||
char *name; ///< Name of vehicle
|
||||
Date service_interval; ///< The interval for (automatic) servicing; either in days or %.
|
||||
VehicleOrderID cur_real_order_index;///< The index to the current real (non-implicit) order
|
||||
|
||||
BaseConsist() : name(NULL) {}
|
||||
virtual ~BaseConsist();
|
||||
|
||||
void CopyConsistPropertiesFrom(const BaseConsist *src);
|
||||
};
|
||||
|
||||
|
@ -781,8 +781,6 @@ void Vehicle::PreDestructor()
|
||||
|
||||
Vehicle::~Vehicle()
|
||||
{
|
||||
free(this->name);
|
||||
|
||||
if (CleaningPool()) {
|
||||
this->cargo.OnCleanPool();
|
||||
return;
|
||||
|
@ -136,8 +136,6 @@ public:
|
||||
friend void AfterLoadVehicles(bool part_of_load); ///< So we can set the #previous and #first pointers while loading
|
||||
friend bool LoadOldVehicle(LoadgameState *ls, int num); ///< So we can set the proper next pointer while loading
|
||||
|
||||
char *name; ///< Name of vehicle
|
||||
|
||||
TileIndex tile; ///< Current tile index
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user