OpenTTD Source  20240917-master-g9ab0a47812
base_consist.cpp
Go to the documentation of this file.
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 
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 
23 {
24  if (this == src) return;
25 
26  this->name = src->name;
27 
30  this->timetable_start = src->timetable_start;
31 
33 
36 
42  }
44 }
45 
50 {
53  this->round_trip_time = 0;
54 }
BaseConsist::cur_implicit_order_index
VehicleOrderID cur_implicit_order_index
The index to the current implicit order.
Definition: base_consist.h:32
SetBit
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
Definition: bitmath_func.hpp:121
BaseConsist::round_trip_time
TimerGameTick::Ticks round_trip_time
How many ticks for a single circumnavigation of the orders.
Definition: base_consist.h:27
BaseConsist::service_interval
uint16_t service_interval
The interval for (automatic) servicing; either in days or %.
Definition: base_consist.h:29
BaseConsist::name
std::string name
Name of vehicle.
Definition: base_consist.h:18
BaseConsist::depot_unbunching_next_departure
TimerGameTick::TickCounter depot_unbunching_next_departure
When the vehicle will next try to leave its unbunching depot.
Definition: base_consist.h:26
BaseConsist::vehicle_flags
uint16_t vehicle_flags
Used for gradual loading and other miscellaneous things (.
Definition: base_consist.h:34
BaseConsist::lateness_counter
TimerGameTick::Ticks lateness_counter
How many ticks late (or early if negative) this vehicle is.
Definition: base_consist.h:22
vehicle_base.h
base_consist.h
BaseConsist::current_order_time
TimerGameTick::Ticks current_order_time
How many ticks have passed since this order started.
Definition: base_consist.h:21
BaseConsist::depot_unbunching_last_departure
TimerGameTick::TickCounter depot_unbunching_last_departure
When the vehicle last left its unbunching depot.
Definition: base_consist.h:25
VF_AUTOFILL_TIMETABLE
@ VF_AUTOFILL_TIMETABLE
Whether the vehicle should fill in the timetable automatically.
Definition: vehicle_base.h:49
safeguards.h
VF_SERVINT_IS_CUSTOM
@ VF_SERVINT_IS_CUSTOM
Service interval is custom.
Definition: vehicle_base.h:53
stdafx.h
BaseConsist::ResetDepotUnbunching
void ResetDepotUnbunching()
Resets all the data used for depot unbunching.
Definition: base_consist.cpp:49
BaseConsist::cur_real_order_index
VehicleOrderID cur_real_order_index
The index to the current real (non-implicit) order.
Definition: base_consist.h:31
string_func.h
VF_SERVINT_IS_PERCENT
@ VF_SERVINT_IS_PERCENT
Service interval is percent.
Definition: vehicle_base.h:54
VF_AUTOFILL_PRES_WAIT_TIME
@ VF_AUTOFILL_PRES_WAIT_TIME
Whether non-destructive auto-fill should preserve waiting times.
Definition: vehicle_base.h:50
VF_TIMETABLE_STARTED
@ VF_TIMETABLE_STARTED
Whether the vehicle has started running on the timetable yet.
Definition: vehicle_base.h:48
BaseConsist::timetable_start
TimerGameTick::TickCounter timetable_start
At what tick of TimerGameTick::counter the vehicle should start its timetable.
Definition: base_consist.h:23
BaseConsist
Various front vehicle properties that are preserved when autoreplacing, using order-backup or switchi...
Definition: base_consist.h:17
BaseConsist::CopyConsistPropertiesFrom
void CopyConsistPropertiesFrom(const BaseConsist *src)
Copy properties of other BaseConsist.
Definition: base_consist.cpp:22
ToggleBit
constexpr T ToggleBit(T &x, const uint8_t y)
Toggles a bit in a variable.
Definition: bitmath_func.hpp:181
HasBit
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103