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

Method IsValidVehicle

src/script/api/script_vehicle.cpp:32–37  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

30#include "../../safeguards.h"
31
32/* static */ bool ScriptVehicle::IsValidVehicle(VehicleID vehicle_id)
33{
34 EnforceDeityOrCompanyModeValid(false);
35 const Vehicle *v = ::Vehicle::GetIfValid(vehicle_id);
36 return v != nullptr && (v->owner == ScriptObject::GetCompany() || ScriptCompanyMode::IsDeity()) && (v->IsPrimaryVehicle() || (v->type == VEH_TRAIN && ::Train::From(v)->IsFreeWagon()));
37}
38
39/* static */ bool ScriptVehicle::IsPrimaryVehicle(VehicleID vehicle_id)
40{

Callers

nothing calls this directly

Calls 2

IsFreeWagonMethod · 0.80
IsPrimaryVehicleMethod · 0.45

Tested by

no test coverage detected