diff options
author | yexo <yexo@openttd.org> | 2010-08-19 20:20:20 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-08-19 20:20:20 +0000 |
commit | ca0cd109f21a4f3cf54e630287f39951e4e5c8c3 (patch) | |
tree | 42e5366adad6e9dab822d377074bfa74c95e2bc4 /src/ai | |
parent | 588d3c4ff830ca7e405bbc4315405784dd1319a3 (diff) | |
download | openttd-ca0cd109f21a4f3cf54e630287f39951e4e5c8c3.tar.xz |
(svn r20568) -Codechange: change the value of AIVehicle::VEHICLE_INVALID and use it as return value instead of ::INVALID_VEHICLE
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/api/ai_vehicle.cpp | 10 | ||||
-rw-r--r-- | src/ai/api/ai_vehicle.hpp | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp index 73cb04ac6..73ad3e928 100644 --- a/src/ai/api/ai_vehicle.cpp +++ b/src/ai/api/ai_vehicle.cpp @@ -65,13 +65,13 @@ /* 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; - 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 */ return 0; @@ -81,7 +81,7 @@ { 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 */ return 0; @@ -102,7 +102,7 @@ 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) diff --git a/src/ai/api/ai_vehicle.hpp b/src/ai/api/ai_vehicle.hpp index 9f3f43a5c..126503e21 100644 --- a/src/ai/api/ai_vehicle.hpp +++ b/src/ai/api/ai_vehicle.hpp @@ -97,7 +97,7 @@ public: 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. |