(svn r12357) [NewGRF_ports] -Codechange: Use instantiation of new FSMPortMovingData to create a copy of a const.
--- a/src/aircraft_cmd.cpp Mon Mar 10 16:29:40 2008 +0000
+++ b/src/aircraft_cmd.cpp Mon Mar 10 16:35:38 2008 +0000
@@ -100,8 +100,8 @@
*/
static AirportMovingData* RotateAMDbyOrientation(Vehicle *v, const FSMPortMovingData* amd, byte size_x, byte size_y, byte FSM_orientation)
{
- FSMPortMovingData* new_amd;
- new_amd = copyFSMMovingData(amd);
+ /* Make a copy of the original moving data */
+ FSMPortMovingData *new_amd = new FSMPortMovingData(amd);
switch (FSM_orientation) {
case DIR_NE:
--- a/src/fsmport.h Mon Mar 10 16:29:40 2008 +0000
+++ b/src/fsmport.h Mon Mar 10 16:35:38 2008 +0000
@@ -17,19 +17,19 @@
Direction direction;
byte state;
byte block; //block number for this specific location
-};
-static FSMPortMovingData* copyFSMMovingData(const FSMPortMovingData *md) {
- FSMPortMovingData* new_md = new FSMPortMovingData;
- new_md->x = md->x;
- new_md->y = md->y;
- new_md->z = md->z;
- new_md->direction = md->direction;
- new_md->flag = md->flag;
- new_md->state = md->state;
- new_md->block = md->block;
- return new_md;
-}
+ FSMPortMovingData() {}
+
+ FSMPortMovingData(const FSMPortMovingData *md) {
+ this->x = md->x;
+ this->y = md->y;
+ this->z = md->z;
+ this->direction = md->direction;
+ this->flag = md->flag;
+ this->state = md->state;
+ this->block = md->block;
+ }
+};
struct FSMCommand {
FSMCommand *next; ///< Possible extra movement choices from this position