mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r20568) -Codechange: change the value of AIVehicle::VEHICLE_INVALID and use it as return value instead of ::INVALID_VEHICLE
This commit is contained in:
parent
e203d39a97
commit
0e2275a053
@ -65,13 +65,13 @@
|
|||||||
|
|
||||||
/* static */ VehicleID AIVehicle::BuildVehicle(TileIndex depot, EngineID engine_id)
|
/* static */ VehicleID AIVehicle::BuildVehicle(TileIndex depot, EngineID engine_id)
|
||||||
{
|
{
|
||||||
EnforcePrecondition(INVALID_VEHICLE, AIEngine::IsBuildable(engine_id));
|
EnforcePrecondition(VEHICLE_INVALID, AIEngine::IsBuildable(engine_id));
|
||||||
|
|
||||||
::VehicleType type = ::Engine::Get(engine_id)->type;
|
::VehicleType type = ::Engine::Get(engine_id)->type;
|
||||||
|
|
||||||
EnforcePreconditionCustomError(INVALID_VEHICLE, !AIGameSettings::IsDisabledVehicleType((AIVehicle::VehicleType)type), AIVehicle::ERR_VEHICLE_BUILD_DISABLED);
|
EnforcePreconditionCustomError(VEHICLE_INVALID, !AIGameSettings::IsDisabledVehicleType((AIVehicle::VehicleType)type), AIVehicle::ERR_VEHICLE_BUILD_DISABLED);
|
||||||
|
|
||||||
if (!AIObject::DoCommand(depot, engine_id, 0, ::GetCmdBuildVeh(type), NULL, &AIInstance::DoCommandReturnVehicleID)) return INVALID_VEHICLE;
|
if (!AIObject::DoCommand(depot, engine_id, 0, ::GetCmdBuildVeh(type), NULL, &AIInstance::DoCommandReturnVehicleID)) return VEHICLE_INVALID;
|
||||||
|
|
||||||
/* In case of test-mode, we return VehicleID 0 */
|
/* In case of test-mode, we return VehicleID 0 */
|
||||||
return 0;
|
return 0;
|
||||||
@ -81,7 +81,7 @@
|
|||||||
{
|
{
|
||||||
EnforcePrecondition(false, IsValidVehicle(vehicle_id));
|
EnforcePrecondition(false, IsValidVehicle(vehicle_id));
|
||||||
|
|
||||||
if (!AIObject::DoCommand(depot, vehicle_id, share_orders, CMD_CLONE_VEHICLE, NULL, &AIInstance::DoCommandReturnVehicleID)) return INVALID_VEHICLE;
|
if (!AIObject::DoCommand(depot, vehicle_id, share_orders, CMD_CLONE_VEHICLE, NULL, &AIInstance::DoCommandReturnVehicleID)) return VEHICLE_INVALID;
|
||||||
|
|
||||||
/* In case of test-mode, we return VehicleID 0 */
|
/* In case of test-mode, we return VehicleID 0 */
|
||||||
return 0;
|
return 0;
|
||||||
@ -102,7 +102,7 @@
|
|||||||
while (dest_wagon-- > 0) w = w->GetNextUnit();
|
while (dest_wagon-- > 0) w = w->GetNextUnit();
|
||||||
}
|
}
|
||||||
|
|
||||||
return AIObject::DoCommand(0, v->index | ((w == NULL ? INVALID_VEHICLE : w->index) << 16), move_attached_wagons ? 1 : 0, CMD_MOVE_RAIL_VEHICLE);
|
return AIObject::DoCommand(0, v->index | ((w == NULL ? ::INVALID_VEHICLE : w->index) << 16), move_attached_wagons ? 1 : 0, CMD_MOVE_RAIL_VEHICLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool AIVehicle::MoveWagon(VehicleID source_vehicle_id, int source_wagon, int dest_vehicle_id, int dest_wagon)
|
/* static */ bool AIVehicle::MoveWagon(VehicleID source_vehicle_id, int source_wagon, int dest_vehicle_id, int dest_wagon)
|
||||||
|
@ -97,7 +97,7 @@ public:
|
|||||||
VS_INVALID = 0xFF, ///< An invalid vehicle state.
|
VS_INVALID = 0xFF, ///< An invalid vehicle state.
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int VEHICLE_INVALID = -1; ///< Invalid VehicleID.
|
static const VehicleID VEHICLE_INVALID = 0xFFFF; ///< Invalid VehicleID.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the given vehicle is valid and owned by you.
|
* Checks whether the given vehicle is valid and owned by you.
|
||||||
|
Loading…
Reference in New Issue
Block a user