1 /*
2  * This file is part of OpenTTD.
3  * 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.
4  * 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.
5  * 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/>.
6  */
7 
8 /** @file base_consist.cpp Properties for front vehicles/consists. */
9 
10 #include "stdafx.h"
11 #include "base_consist.h"
12 #include "vehicle_base.h"
13 #include "string_func.h"
14 
15 #include "safeguards.h"
16 
17 
18 /**
19  * Copy properties of other BaseConsist.
20  * @param src Source for copying
21  */
CopyConsistPropertiesFrom(const BaseConsist * src)22 void BaseConsist::CopyConsistPropertiesFrom(const BaseConsist *src)
23 {
24 	if (this == src) return;
25 
26 	this->name = src->name;
27 
28 	this->current_order_time = src->current_order_time;
29 	this->lateness_counter = src->lateness_counter;
30 	this->timetable_start = src->timetable_start;
31 
32 	this->service_interval = src->service_interval;
33 
34 	this->cur_real_order_index = src->cur_real_order_index;
35 	this->cur_implicit_order_index = src->cur_implicit_order_index;
36 
37 	if (HasBit(src->vehicle_flags, VF_TIMETABLE_STARTED)) SetBit(this->vehicle_flags, VF_TIMETABLE_STARTED);
38 	if (HasBit(src->vehicle_flags, VF_AUTOFILL_TIMETABLE)) SetBit(this->vehicle_flags, VF_AUTOFILL_TIMETABLE);
39 	if (HasBit(src->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME)) SetBit(this->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME);
40 	if (HasBit(src->vehicle_flags, VF_SERVINT_IS_PERCENT) != HasBit(this->vehicle_flags, VF_SERVINT_IS_PERCENT)) {
41 		ToggleBit(this->vehicle_flags, VF_SERVINT_IS_PERCENT);
42 	}
43 	if (HasBit(src->vehicle_flags, VF_SERVINT_IS_CUSTOM)) SetBit(this->vehicle_flags, VF_SERVINT_IS_CUSTOM);
44 }
45