MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / hasAnyCargo

Method hasAnyCargo

src/OpenLoco/src/Vehicles/VehicleHead.cpp:6248–6268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6246 }
6247
6248 bool VehicleHead::hasAnyCargo()
6249 {
6250 uint16_t cargoTotal = 0;
6251 Vehicles::Vehicle train(head);
6252 for (const auto& car : train.cars)
6253 {
6254 auto front = car.front;
6255 auto body = car.body;
6256
6257 if (front->secondaryCargo.type != 0xFF)
6258 {
6259 cargoTotal += front->secondaryCargo.qty;
6260 }
6261 if (body->primaryCargo.type != 0xFF)
6262 {
6263 cargoTotal += body->primaryCargo.qty;
6264 }
6265 }
6266
6267 return cargoTotal > 0;
6268 }
6269
6270 // 0x004B6669
6271 char* VehicleHead::generateCargoTotalString(char* buffer)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected