changeset 15886:ebef8547a954 draft

(svn r20568) -Codechange: change the value of AIVehicle::VEHICLE_INVALID and use it as return value instead of ::INVALID_VEHICLE
author yexo <yexo@openttd.org>
date Thu, 19 Aug 2010 20:20:20 +0000
parents 620ec731b1b0
children 708e732bb8a6
files src/ai/api/ai_vehicle.cpp src/ai/api/ai_vehicle.hpp
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- a/src/ai/api/ai_vehicle.hpp
+++ b/src/ai/api/ai_vehicle.hpp
@@ -97,7 +97,7 @@
 		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.