* 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. */
| 35 | * @param user The user that is requesting the backup. |
| 36 | */ |
| 37 | OrderBackup::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. |
nothing calls this directly
no test coverage detected