base_consist.cpp

Go to the documentation of this file.
00001 /* $Id$ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #include "stdafx.h"
00013 #include "base_consist.h"
00014 #include "vehicle_base.h"
00015 
00016 BaseConsist::~BaseConsist()
00017 {
00018   free(this->name);
00019 }
00020 
00025 void BaseConsist::CopyConsistPropertiesFrom(const BaseConsist *src)
00026 {
00027   if (this == src) return;
00028 
00029   free(this->name);
00030   this->name = src->name != NULL ? strdup(src->name) : NULL;
00031 
00032   this->current_order_time = src->current_order_time;
00033   this->lateness_counter = src->lateness_counter;
00034   this->timetable_start = src->timetable_start;
00035 
00036   this->service_interval = src->service_interval;
00037 
00038   this->cur_real_order_index = src->cur_real_order_index;
00039   this->cur_implicit_order_index = src->cur_implicit_order_index;
00040 
00041   if (HasBit(src->vehicle_flags, VF_TIMETABLE_STARTED)) SetBit(this->vehicle_flags, VF_TIMETABLE_STARTED);
00042   if (HasBit(src->vehicle_flags, VF_AUTOFILL_TIMETABLE)) SetBit(this->vehicle_flags, VF_AUTOFILL_TIMETABLE);
00043   if (HasBit(src->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME)) SetBit(this->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME);
00044 }