src/ai/api/ai_object.cpp
branchnoai
changeset 10977 6c1a6657c7db
parent 10668 495789401303
child 10978 13fd0364b2c6
--- a/src/ai/api/ai_object.cpp	Sun Jun 15 23:35:40 2008 +0000
+++ b/src/ai/api/ai_object.cpp	Mon Jun 16 00:07:49 2008 +0000
@@ -8,9 +8,11 @@
 #include "table/strings.h"
 #include "../../openttd.h"
 #include "../../command_func.h"
+#include "../../map_func.h"
 #include "../../network/network.h"
 #include "../../player_func.h"
 #include "../../signs_func.h"
+#include "../../tunnelbridge.h"
 #include "../../vehicle_func.h"
 #include "../ai.h"
 #include "../ai_threads.h"
@@ -24,6 +26,7 @@
 	bool last_command_res;
 	VehicleID new_vehicle_id;
 	SignID new_sign_id;
+	TileIndex new_tunnel_endtile;
 	RoadType road_type;
 	void *event_data;
 	void *log_data;
@@ -121,6 +124,16 @@
 	return GetDoCommandStruct(_current_player)->new_sign_id;
 }
 
+void AIObject::SetNewTunnelEndtile(TileIndex tile)
+{
+	GetDoCommandStruct(_current_player)->new_tunnel_endtile = tile;
+}
+
+TileIndex AIObject::GetNewTunnelEndtile()
+{
+	return GetDoCommandStruct(_current_player)->new_tunnel_endtile;
+}
+
 void *&AIObject::GetEventPointer()
 {
 	return GetDoCommandStruct(_current_player)->event_data;
@@ -218,6 +231,7 @@
 		/* Store some values inside the AIObject static memory */
 		SetNewVehicleID(_new_vehicle_id);
 		SetNewSignID(_new_sign_id);
+		SetNewTunnelEndtile(_build_tunnel_endtile);
 
 		/* Suspend the AI player for 1 tick, so it simulates MultiPlayer */
 		::AI_SuspendPlayer(_current_player, GetDoCommandDelay());