Changeset - r19518:752c1c3f7cfd
[Not reviewed]
master
0 5 0
frosch - 12 years ago 2012-07-29 16:45:11
frosch@openttd.org
(svn r24443) -Codechange: Move Vehicle::name to BaseConsist.
5 files changed with 12 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/autoreplace_cmd.cpp
Show inline comments
 
@@ -357,11 +357,6 @@ static CommandCost CopyHeadSpecificThing
 

	
 
	/* 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);
 

	
src/base_consist.cpp
Show inline comments
 
@@ -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::CopyConsistPropertiesF
 
{
 
	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;
 
}
src/base_consist.h
Show inline comments
 
@@ -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);
 
};
 

	
src/vehicle.cpp
Show inline comments
 
@@ -781,8 +781,6 @@ void Vehicle::PreDestructor()
 

	
 
Vehicle::~Vehicle()
 
{
 
	free(this->name);
 

	
 
	if (CleaningPool()) {
 
		this->cargo.OnCleanPool();
 
		return;
src/vehicle_base.h
Show inline comments
 
@@ -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
 

	
 
	/**
0 comments (0 inline, 0 general)