MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / OrderBackup

Method OrderBackup

src/order_backup.cpp:37–48  ·  view source on GitHub ↗

* Create an order backup for the given vehicle. * @param v The vehicle to make a backup of. * @param user The user that is requesting the backup. */

Source from the content-addressed store, hash-verified

35 * @param user The user that is requesting the backup.
36 */
37OrderBackup::OrderBackup(const Vehicle *v, uint32_t user) : user(user), tile(v->tile), group(v->group_id)
38{
39 this->CopyConsistPropertiesFrom(v);
40
41 /* If we have shared orders, store the vehicle we share the order with. */
42 if (v->IsOrderListShared()) {
43 this->clone = (v->FirstShared() == v) ? v->NextShared() : v->FirstShared();
44 } else {
45 /* Else copy the orders */
46 this->orders.assign(std::begin(v->Orders()), std::end(v->Orders()));
47 }
48}
49
50/**
51 * Restore the data of this order to the given vehicle.

Callers

nothing calls this directly

Calls 8

IsOrderListSharedMethod · 0.80
FirstSharedMethod · 0.80
NextSharedMethod · 0.80
OrdersMethod · 0.80
beginFunction · 0.50
endFunction · 0.50
assignMethod · 0.45

Tested by

no test coverage detected