| 138 | } |
| 139 | |
| 140 | static bool needsComponentChangeConfirm(EntityId id, const bool checkKeepCargoCheat) |
| 141 | { |
| 142 | auto* vehBase = EntityManager::get<Vehicles::VehicleBase>(id); |
| 143 | if (vehBase == nullptr) |
| 144 | { |
| 145 | return false; |
| 146 | } |
| 147 | |
| 148 | auto* head = EntityManager::get<Vehicles::VehicleHead>(vehBase->getHead()); |
| 149 | if (head == nullptr) |
| 150 | { |
| 151 | return false; |
| 152 | } |
| 153 | |
| 154 | if (!head->hasAnyCargo()) |
| 155 | { |
| 156 | return false; |
| 157 | } |
| 158 | |
| 159 | if (checkKeepCargoCheat && Config::get().keepCargoModifyPickup) |
| 160 | { |
| 161 | return false; |
| 162 | } |
| 163 | |
| 164 | if (head->getCarCount() > 0 && CompanyManager::getControllingId() == head->owner) |
| 165 | { |
| 166 | return true; |
| 167 | } |
| 168 | |
| 169 | return false; |
| 170 | } |
| 171 | |
| 172 | static bool confirmComponentChange(const EntityId id, const OpenLoco::StringId windowTitle, const OpenLoco::StringId windowMessage, const OpenLoco::StringId windowConfirm, const bool checkKeepCargoCheat = true) |
| 173 | { |
no test coverage detected