src/ai/api/ai_tunnel.cpp
branchnoai
changeset 10088 922c6e6a8d3e
parent 9833 89a64246458f
child 10249 58810805030e
--- a/src/ai/api/ai_tunnel.cpp	Mon Apr 07 18:29:12 2008 +0000
+++ b/src/ai/api/ai_tunnel.cpp	Mon Apr 07 18:32:42 2008 +0000
@@ -28,8 +28,8 @@
 
 /* static */ bool AITunnel::BuildTunnel(AIVehicle::VehicleType vehicle_type, TileIndex start)
 {
-	if (!::IsValidTile(start)) return false;
-	if (vehicle_type != AIVehicle::VEHICLE_RAIL && vehicle_type != AIVehicle::VEHICLE_ROAD) return false;
+	EnforcePrecondition(false, ::IsValidTile(start));
+	EnforcePrecondition(false, vehicle_type == AIVehicle::VEHICLE_RAIL || vehicle_type == AIVehicle::VEHICLE_ROAD);
 
 	uint type = 0;
 	if (vehicle_type == AIVehicle::VEHICLE_ROAD) {
@@ -45,7 +45,7 @@
 
 /* static */ bool AITunnel::RemoveTunnel(TileIndex tile)
 {
-	if (!IsTunnelTile(tile)) return false;
+	EnforcePrecondition(false, IsTunnelTile(tile));
 
 	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
 }