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

Method canBeModified

src/OpenLoco/src/Vehicles/VehicleHead.cpp:7002–7064  ·  view source on GitHub ↗

0x004B0BDD

Source from the content-addressed store, hash-verified

7000
7001 // 0x004B0BDD
7002 bool Vehicles::VehicleHead::canBeModified() const
7003 {
7004 switch (this->status)
7005 {
7006 case Status::crashed:
7007 GameCommands::setErrorText(StringIds::vehicle_has_crashed);
7008 return false;
7009 case Status::stuck:
7010 GameCommands::setErrorText(StringIds::vehicle_is_stuck);
7011 return false;
7012 case Status::brokenDown:
7013 GameCommands::setErrorText(StringIds::vehicle_has_broken_down);
7014 return false;
7015 default:
7016 {
7017 Vehicle train(head);
7018 if (this->vehicleType == VehicleType::aircraft || this->vehicleType == VehicleType::ship)
7019 {
7020 if (train.veh2->has73Flags(Flags73::isBrokenDown))
7021 {
7022 GameCommands::setErrorText(StringIds::vehicle_has_broken_down);
7023 return false;
7024 }
7025
7026 if (this->tileX == -1)
7027 {
7028 return true;
7029 }
7030
7031 if (this->status != Status::loading && this->status != Status::stopped)
7032 {
7033 GameCommands::setErrorText(StringIds::vehicle_must_be_stopped);
7034 return false;
7035 }
7036
7037 if (train.veh2->currentSpeed == 0.0_mph)
7038 {
7039 return true;
7040 }
7041 GameCommands::setErrorText(StringIds::vehicle_must_be_stopped);
7042 return false;
7043 }
7044 else
7045 {
7046 if (this->tileX == -1)
7047 {
7048 return true;
7049 }
7050
7051 if (train.veh2->currentSpeed == 0.0_mph)
7052 {
7053 return true;
7054 }
7055 if (train.veh1->var_3C <= 0x3689)
7056 {
7057 return true;
7058 }
7059 GameCommands::setErrorText(StringIds::vehicle_must_be_stopped);

Callers 9

vehicleRefitFunction · 0.80
vehiclePassSignalFunction · 0.80
vehiclePickupAirFunction · 0.80
vehiclePickupWaterFunction · 0.80
addCarToVehicleFunction · 0.80
vehicleReverseFunction · 0.80
vehiclePickupFunction · 0.80
vehicleRearrangeFunction · 0.80
sellVehicleFunction · 0.80

Calls 2

setErrorTextFunction · 0.85
has73FlagsMethod · 0.80

Tested by

no test coverage detected