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

Method _SellWagonInternal

src/script/api/script_vehicle.cpp:178–188  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

176}
177
178/* static */ bool ScriptVehicle::_SellWagonInternal(VehicleID vehicle_id, SQInteger wagon, bool sell_attached_wagons)
179{
180 EnforceCompanyModeValid(false);
181 EnforcePrecondition(false, IsValidVehicle(vehicle_id) && wagon < GetNumWagons(vehicle_id));
182 EnforcePrecondition(false, ::Vehicle::Get(vehicle_id)->type == VEH_TRAIN);
183
184 const Train *v = ::Train::Get(vehicle_id);
185 while (wagon-- > 0) v = v->GetNextUnit();
186
187 return ScriptObject::Command<CMD_SELL_VEHICLE>::Do(v->index, sell_attached_wagons, false, INVALID_CLIENT_ID);
188}
189
190/* static */ bool ScriptVehicle::SellWagon(VehicleID vehicle_id, SQInteger wagon)
191{

Callers

nothing calls this directly

Calls 1

GetNextUnitMethod · 0.80

Tested by

no test coverage detected