changeset 18511:f1214da4c397 draft

(svn r23355) -Codechange: rename all AI* to Script* (Rubidium)
author truebrain <truebrain@openttd.org>
date Tue, 29 Nov 2011 23:15:35 +0000
parents 3a3ccad4a95c
children 28d01e15d5e6
files projects/openttd_vs100.vcxproj.filters projects/openttd_vs80.vcproj projects/openttd_vs90.vcproj source.list src/ai/ai.hpp src/ai/ai_core.cpp src/ai/ai_gui.cpp src/ai/ai_instance.cpp src/ai/ai_instance.hpp src/ai/ai_storage.hpp src/ai/api/ai_accounting.hpp.sq src/ai/api/ai_airport.hpp.sq src/ai/api/ai_base.hpp.sq src/ai/api/ai_basestation.hpp.sq src/ai/api/ai_bridge.hpp.sq src/ai/api/ai_bridgelist.hpp.sq src/ai/api/ai_cargo.hpp.sq src/ai/api/ai_cargolist.hpp.sq src/ai/api/ai_company.hpp.sq src/ai/api/ai_controller.hpp.sq src/ai/api/ai_date.hpp.sq src/ai/api/ai_depotlist.hpp.sq src/ai/api/ai_engine.hpp.sq src/ai/api/ai_enginelist.hpp.sq src/ai/api/ai_error.hpp.sq src/ai/api/ai_event.hpp.sq src/ai/api/ai_event_types.hpp.sq src/ai/api/ai_execmode.hpp.sq src/ai/api/ai_gamesettings.hpp.sq src/ai/api/ai_group.hpp.sq src/ai/api/ai_grouplist.hpp.sq src/ai/api/ai_industry.hpp.sq src/ai/api/ai_industrylist.hpp.sq src/ai/api/ai_industrytype.hpp.sq src/ai/api/ai_industrytypelist.hpp.sq src/ai/api/ai_list.hpp.sq src/ai/api/ai_log.hpp.sq src/ai/api/ai_map.hpp.sq src/ai/api/ai_marine.hpp.sq src/ai/api/ai_order.hpp.sq src/ai/api/ai_rail.hpp.sq src/ai/api/ai_railtypelist.hpp.sq src/ai/api/ai_road.hpp.sq src/ai/api/ai_sign.hpp.sq src/ai/api/ai_signlist.hpp.sq src/ai/api/ai_station.hpp.sq src/ai/api/ai_stationlist.hpp.sq src/ai/api/ai_subsidy.hpp.sq src/ai/api/ai_subsidylist.hpp.sq src/ai/api/ai_testmode.hpp.sq src/ai/api/ai_tile.hpp.sq src/ai/api/ai_tilelist.hpp.sq src/ai/api/ai_town.hpp.sq src/ai/api/ai_townlist.hpp.sq src/ai/api/ai_tunnel.hpp.sq src/ai/api/ai_vehicle.hpp.sq src/ai/api/ai_vehiclelist.hpp.sq src/ai/api/ai_waypoint.hpp.sq src/ai/api/ai_waypointlist.hpp.sq src/ai/api/squirrel_export.awk src/aircraft_cmd.cpp src/company_cmd.cpp src/disaster_cmd.cpp src/economy.cpp src/engine.cpp src/industry_cmd.cpp src/roadveh_cmd.cpp src/script/api/script_accounting.cpp src/script/api/script_accounting.hpp src/script/api/script_airport.cpp src/script/api/script_airport.hpp src/script/api/script_base.cpp src/script/api/script_base.hpp src/script/api/script_basestation.cpp src/script/api/script_basestation.hpp src/script/api/script_bridge.cpp src/script/api/script_bridge.hpp src/script/api/script_bridgelist.cpp src/script/api/script_bridgelist.hpp src/script/api/script_cargo.cpp src/script/api/script_cargo.hpp src/script/api/script_cargolist.cpp src/script/api/script_cargolist.hpp src/script/api/script_company.cpp src/script/api/script_company.hpp src/script/api/script_controller.cpp src/script/api/script_controller.hpp src/script/api/script_date.cpp src/script/api/script_date.hpp src/script/api/script_depotlist.cpp src/script/api/script_depotlist.hpp src/script/api/script_engine.cpp src/script/api/script_engine.hpp src/script/api/script_enginelist.cpp src/script/api/script_enginelist.hpp src/script/api/script_error.cpp src/script/api/script_error.hpp src/script/api/script_event.cpp src/script/api/script_event.hpp src/script/api/script_event_types.cpp src/script/api/script_event_types.hpp src/script/api/script_execmode.cpp src/script/api/script_execmode.hpp src/script/api/script_gamesettings.cpp src/script/api/script_gamesettings.hpp src/script/api/script_group.cpp src/script/api/script_group.hpp src/script/api/script_grouplist.cpp src/script/api/script_grouplist.hpp src/script/api/script_industry.cpp src/script/api/script_industry.hpp src/script/api/script_industrylist.cpp src/script/api/script_industrylist.hpp src/script/api/script_industrytype.cpp src/script/api/script_industrytype.hpp src/script/api/script_industrytypelist.cpp src/script/api/script_industrytypelist.hpp src/script/api/script_list.cpp src/script/api/script_list.hpp src/script/api/script_log.cpp src/script/api/script_log.hpp src/script/api/script_map.cpp src/script/api/script_map.hpp src/script/api/script_marine.cpp src/script/api/script_marine.hpp src/script/api/script_object.cpp src/script/api/script_object.hpp src/script/api/script_order.cpp src/script/api/script_order.hpp src/script/api/script_rail.cpp src/script/api/script_rail.hpp src/script/api/script_railtypelist.cpp src/script/api/script_railtypelist.hpp src/script/api/script_road.cpp src/script/api/script_road.hpp src/script/api/script_sign.cpp src/script/api/script_sign.hpp src/script/api/script_signlist.cpp src/script/api/script_signlist.hpp src/script/api/script_station.cpp src/script/api/script_station.hpp src/script/api/script_stationlist.cpp src/script/api/script_stationlist.hpp src/script/api/script_subsidy.cpp src/script/api/script_subsidy.hpp src/script/api/script_subsidylist.cpp src/script/api/script_subsidylist.hpp src/script/api/script_testmode.cpp src/script/api/script_testmode.hpp src/script/api/script_tile.cpp src/script/api/script_tile.hpp src/script/api/script_tilelist.cpp src/script/api/script_tilelist.hpp src/script/api/script_town.cpp src/script/api/script_town.hpp src/script/api/script_townlist.cpp src/script/api/script_townlist.hpp src/script/api/script_tunnel.cpp src/script/api/script_tunnel.hpp src/script/api/script_types.hpp src/script/api/script_vehicle.cpp src/script/api/script_vehicle.hpp src/script/api/script_vehiclelist.cpp src/script/api/script_vehiclelist.hpp src/script/api/script_waypoint.cpp src/script/api/script_waypoint.hpp src/script/api/script_waypointlist.cpp src/script/api/script_waypointlist.hpp src/script/squirrel.hpp src/ship_cmd.cpp src/subsidy.cpp src/town_cmd.cpp src/train_cmd.cpp src/vehicle.cpp src/water_cmd.cpp
diffstat 175 files changed, 4050 insertions(+), 4036 deletions(-) [+]
line wrap: on
line diff
--- a/projects/openttd_vs100.vcxproj.filters
+++ b/projects/openttd_vs100.vcxproj.filters
@@ -43,53 +43,56 @@
     <Filter Include="AI API">
       <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000013}</UniqueIdentifier>
     </Filter>
-    <Filter Include="AI API Implementation">
+    <Filter Include="Script API">
       <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000014}</UniqueIdentifier>
     </Filter>
+    <Filter Include="Script API Implementation">
+      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000015}</UniqueIdentifier>
+    </Filter>
     <Filter Include="Blitters">
-      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000015}</UniqueIdentifier>
+      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000016}</UniqueIdentifier>
     </Filter>
     <Filter Include="Drivers">
-      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000016}</UniqueIdentifier>
+      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000017}</UniqueIdentifier>
     </Filter>
     <Filter Include="Sprite loaders">
-      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000017}</UniqueIdentifier>
+      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000018}</UniqueIdentifier>
     </Filter>
     <Filter Include="NewGRF">
-      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000018}</UniqueIdentifier>
+      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000019}</UniqueIdentifier>
     </Filter>
     <Filter Include="Map Accessors">
-      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000019}</UniqueIdentifier>
+      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000020}</UniqueIdentifier>
     </Filter>
     <Filter Include="Misc">
-      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000020}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Network Core">
       <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000021}</UniqueIdentifier>
     </Filter>
+    <Filter Include="Network Core">
+      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000022}</UniqueIdentifier>
+    </Filter>
     <Filter Include="Pathfinder">
-      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000022}</UniqueIdentifier>
+      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000023}</UniqueIdentifier>
     </Filter>
     <Filter Include="NPF">
-      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000023}</UniqueIdentifier>
+      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000024}</UniqueIdentifier>
     </Filter>
     <Filter Include="YAPF">
-      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000024}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Video">
       <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000025}</UniqueIdentifier>
     </Filter>
-    <Filter Include="Music">
+    <Filter Include="Video">
       <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000026}</UniqueIdentifier>
     </Filter>
-    <Filter Include="Sound">
+    <Filter Include="Music">
       <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000027}</UniqueIdentifier>
     </Filter>
-    <Filter Include="Windows files">
+    <Filter Include="Sound">
       <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000028}</UniqueIdentifier>
     </Filter>
+    <Filter Include="Windows files">
+      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000029}</UniqueIdentifier>
+    </Filter>
     <Filter Include="Threading">
-      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000029}</UniqueIdentifier>
+      <UniqueIdentifier>{c76ff9f1-1e62-46d8-8d55-000000000030}</UniqueIdentifier>
     </Filter>
   </ItemGroup>
   <ItemGroup>
@@ -1783,307 +1786,307 @@
       <Filter>AI API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_accounting.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_airport.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_base.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_basestation.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_bridge.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_bridgelist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_cargo.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_cargolist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_company.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_controller.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_date.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_depotlist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_engine.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_enginelist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_error.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_event.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_event_types.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_execmode.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_gamesettings.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_group.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_grouplist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_industry.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_industrylist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_industrytype.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_industrytypelist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_list.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_log.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_map.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_marine.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_object.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_order.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_rail.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_railtypelist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_road.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_sign.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_signlist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_station.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_stationlist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_subsidy.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_subsidylist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_testmode.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_tile.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_tilelist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_town.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_townlist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_tunnel.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_types.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_vehicle.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_vehiclelist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_waypoint.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClInclude Include="..\src\script\api\script_waypointlist.hpp">
-      <Filter>AI API</Filter>
+      <Filter>Script API</Filter>
     </ClInclude>
     <ClCompile Include="..\src\script\api\script_accounting.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_airport.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_base.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_basestation.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_bridge.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_bridgelist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_cargo.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_cargolist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_company.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_controller.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_date.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_depotlist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_engine.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_enginelist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_error.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_event.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_event_types.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_execmode.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_gamesettings.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_group.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_grouplist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_industry.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_industrylist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_industrytype.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_industrytypelist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_list.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_log.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_map.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_marine.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_object.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_order.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_rail.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_railtypelist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_road.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_sign.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_signlist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_station.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_stationlist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_subsidy.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_subsidylist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_testmode.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_tile.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_tilelist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_town.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_townlist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_tunnel.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_vehicle.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_vehiclelist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_waypoint.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\script\api\script_waypointlist.cpp">
-      <Filter>AI API Implementation</Filter>
+      <Filter>Script API Implementation</Filter>
     </ClCompile>
     <ClCompile Include="..\src\blitter\32bpp_anim.cpp">
       <Filter>Blitters</Filter>
--- a/projects/openttd_vs80.vcproj
+++ b/projects/openttd_vs80.vcproj
@@ -2738,6 +2738,10 @@
 				RelativePath=".\..\src\ai\api\ai_info_docs.hpp"
 				>
 			</File>
+		</Filter>
+		<Filter
+			Name="Script API"
+			>
 			<File
 				RelativePath=".\..\src\script\api\script_accounting.hpp"
 				>
@@ -2944,7 +2948,7 @@
 			</File>
 		</Filter>
 		<Filter
-			Name="AI API Implementation"
+			Name="Script API Implementation"
 			>
 			<File
 				RelativePath=".\..\src\script\api\script_accounting.cpp"
--- a/projects/openttd_vs90.vcproj
+++ b/projects/openttd_vs90.vcproj
@@ -2735,6 +2735,10 @@
 				RelativePath=".\..\src\ai\api\ai_info_docs.hpp"
 				>
 			</File>
+		</Filter>
+		<Filter
+			Name="Script API"
+			>
 			<File
 				RelativePath=".\..\src\script\api\script_accounting.hpp"
 				>
@@ -2941,7 +2945,7 @@
 			</File>
 		</Filter>
 		<Filter
-			Name="AI API Implementation"
+			Name="Script API Implementation"
 			>
 			<File
 				RelativePath=".\..\src\script\api\script_accounting.cpp"
--- a/source.list
+++ b/source.list
@@ -627,6 +627,8 @@
 # AI API
 ai/api/ai_changelog.hpp
 ai/api/ai_info_docs.hpp
+
+# Script API
 script/api/script_accounting.hpp
 script/api/script_airport.hpp
 script/api/script_base.hpp
@@ -679,7 +681,7 @@
 script/api/script_waypoint.hpp
 script/api/script_waypointlist.hpp
 
-# AI API Implementation
+# Script API Implementation
 script/api/script_accounting.cpp
 script/api/script_airport.cpp
 script/api/script_base.cpp
--- a/src/ai/ai.hpp
+++ b/src/ai/ai.hpp
@@ -102,12 +102,12 @@
 	/**
 	 * Queue a new event for an AI.
 	 */
-	static void NewEvent(CompanyID company, AIEvent *event);
+	static void NewEvent(CompanyID company, ScriptEvent *event);
 
 	/**
 	 * Broadcast a new event to all active AIs.
 	 */
-	static void BroadcastNewEvent(AIEvent *event, CompanyID skip_company = MAX_COMPANIES);
+	static void BroadcastNewEvent(ScriptEvent *event, CompanyID skip_company = MAX_COMPANIES);
 
 	/**
 	 * Save data from an AI to a savegame.
--- a/src/ai/ai_core.cpp
+++ b/src/ai/ai_core.cpp
@@ -200,7 +200,7 @@
 	}
 }
 
-/* static */ void AI::NewEvent(CompanyID company, AIEvent *event)
+/* static */ void AI::NewEvent(CompanyID company, ScriptEvent *event)
 {
 	/* AddRef() and Release() need to be called at least once, so do it here */
 	event->AddRef();
@@ -225,7 +225,7 @@
 	event->Release();
 }
 
-/* static */ void AI::BroadcastNewEvent(AIEvent *event, CompanyID skip_company)
+/* static */ void AI::BroadcastNewEvent(ScriptEvent *event, CompanyID skip_company)
 {
 	/* AddRef() and Release() need to be called at least once, so do it here */
 	event->AddRef();
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -797,7 +797,7 @@
 };
 
 /**
- * Window with everything an AI prints via AILog.
+ * Window with everything an AI prints via ScriptLog.
  */
 struct AIDebugWindow : public QueryStringBaseWindow {
 	static const int top_offset;    ///< Offset of the text at the top of the AID_WIDGET_LOG_PANEL.
@@ -931,7 +931,7 @@
 		/* If there are no active companies, don't display anything else. */
 		if (ai_debug_company == INVALID_COMPANY) return;
 
-		AILog::LogData *log = (AILog::LogData *)Company::Get(ai_debug_company)->ai_instance->GetLogPointer();
+		ScriptLog::LogData *log = (ScriptLog::LogData *)Company::Get(ai_debug_company)->ai_instance->GetLogPointer();
 
 		int scroll_count = (log == NULL) ? 0 : log->used;
 		if (this->vscroll->GetCount() != scroll_count) {
@@ -984,7 +984,7 @@
 
 		switch (widget) {
 			case AID_WIDGET_LOG_PANEL: {
-				AILog::LogData *log = (AILog::LogData *)Company::Get(ai_debug_company)->ai_instance->GetLogPointer();
+				ScriptLog::LogData *log = (ScriptLog::LogData *)Company::Get(ai_debug_company)->ai_instance->GetLogPointer();
 				if (log == NULL) return;
 
 				int y = this->top_offset;
@@ -994,11 +994,11 @@
 
 					TextColour colour;
 					switch (log->type[pos]) {
-						case AILog::LOG_SQ_INFO:  colour = TC_BLACK;  break;
-						case AILog::LOG_SQ_ERROR: colour = TC_RED;    break;
-						case AILog::LOG_INFO:     colour = TC_BLACK;  break;
-						case AILog::LOG_WARNING:  colour = TC_YELLOW; break;
-						case AILog::LOG_ERROR:    colour = TC_RED;    break;
+						case ScriptLog::LOG_SQ_INFO:  colour = TC_BLACK;  break;
+						case ScriptLog::LOG_SQ_ERROR: colour = TC_RED;    break;
+						case ScriptLog::LOG_INFO:     colour = TC_BLACK;  break;
+						case ScriptLog::LOG_WARNING:  colour = TC_YELLOW; break;
+						case ScriptLog::LOG_ERROR:    colour = TC_RED;    break;
 						default:                  colour = TC_BLACK;  break;
 					}
 
@@ -1025,7 +1025,7 @@
 		this->RaiseWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
 		ai_debug_company = show_ai;
 
-		AILog::LogData *log = (AILog::LogData *)Company::Get(ai_debug_company)->ai_instance->GetLogPointer();
+		ScriptLog::LogData *log = (ScriptLog::LogData *)Company::Get(ai_debug_company)->ai_instance->GetLogPointer();
 		this->vscroll->SetCount((log == NULL) ? 0 : log->used);
 
 		this->LowerWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
@@ -1124,7 +1124,7 @@
 		 * This needs to be done in gameloop-scope, so the AI is suspended immediately. */
 		if (!gui_scope && data == ai_debug_company && this->break_check_enabled && !StrEmpty(this->edit_str_buf)) {
 			/* Get the log instance of the active company */
-			AILog::LogData *log = (AILog::LogData *)Company::Get(ai_debug_company)->ai_instance->GetLogPointer();
+			ScriptLog::LogData *log = (ScriptLog::LogData *)Company::Get(ai_debug_company)->ai_instance->GetLogPointer();
 
 			if (log != NULL && case_sensitive_break_check?
 					strstr(log->lines[log->pos], this->edit_str_buf) != 0 :
--- a/src/ai/ai_instance.cpp
+++ b/src/ai/ai_instance.cpp
@@ -85,8 +85,8 @@
 AIStorage::~AIStorage()
 {
 	/* Free our pointers */
-	if (event_data != NULL) AIEventController::FreeEventPointer();
-	if (log_data != NULL) AILog::FreeLogPointer();
+	if (event_data != NULL) ScriptEventController::FreeEventPointer();
+	if (log_data != NULL) ScriptLog::FreeLogPointer();
 }
 
 /**
@@ -97,7 +97,7 @@
 static void PrintFunc(bool error_msg, const SQChar *message)
 {
 	/* Convert to OpenTTD internal capable string */
-	AIController::Print(error_msg, SQ2OTTD(message));
+	ScriptController::Print(error_msg, SQ2OTTD(message));
 }
 
 AIInstance::AIInstance() :
@@ -118,9 +118,9 @@
 
 void AIInstance::Initialize(AIInfo *info)
 {
-	AIObject::ActiveInstance active(this);
+	ScriptObject::ActiveInstance active(this);
 
-	this->controller = new AIController();
+	this->controller = new ScriptController();
 
 	/* Register the AIController (including the "import" command) */
 	SQAIController_Register(this->engine);
@@ -134,14 +134,14 @@
 	}
 
 	try {
-		AIObject::SetAllowDoCommand(false);
+		ScriptObject::SetAllowDoCommand(false);
 		/* Load and execute the script for this AI */
 		const char *main_script = info->GetMainScript();
 		if (strcmp(main_script, "%_dummy") == 0) {
 			extern void AI_CreateAIDummy(HSQUIRRELVM vm);
 			AI_CreateAIDummy(this->engine->GetVM());
 		} else if (!this->engine->LoadScript(main_script) || this->engine->IsSuspended()) {
-			if (this->engine->IsSuspended()) AILog::Error("This AI took too long to load script. AI is not started.");
+			if (this->engine->IsSuspended()) ScriptLog::Error("This AI took too long to load script. AI is not started.");
 			this->Died();
 			return;
 		}
@@ -152,7 +152,7 @@
 			this->Died();
 			return;
 		}
-		AIObject::SetAllowDoCommand(true);
+		ScriptObject::SetAllowDoCommand(true);
 	} catch (AI_FatalError e) {
 		this->is_dead = true;
 		this->engine->ThrowError(e.GetErrorMessage());
@@ -163,7 +163,7 @@
 
 AIInstance::~AIInstance()
 {
-	AIObject::ActiveInstance active(this);
+	ScriptObject::ActiveInstance active(this);
 
 	if (instance != NULL) this->engine->ReleaseObject(this->instance);
 	if (engine != NULL) delete this->engine;
@@ -279,12 +279,12 @@
 
 		if (this->engine->LoadScript(buf)) return true;
 
-		AILog::Error("Failed to load API compatibility script");
+		ScriptLog::Error("Failed to load API compatibility script");
 		DEBUG(ai, 0, "Error compiling / running API compatibility script: %s", buf);
 		return false;
 	}
 
-	AILog::Warning("API compatibility script not found");
+	ScriptLog::Warning("API compatibility script not found");
 	return true;
 }
 
@@ -311,15 +311,15 @@
 		ShowErrorMessage(STR_ERROR_AI_PLEASE_REPORT_CRASH, INVALID_STRING_ID, WL_WARNING);
 
 		if (info->GetURL() != NULL) {
-			AILog::Info("Please report the error to the following URL:");
-			AILog::Info(info->GetURL());
+			ScriptLog::Info("Please report the error to the following URL:");
+			ScriptLog::Info(info->GetURL());
 		}
 	}
 }
 
 void AIInstance::GameLoop()
 {
-	AIObject::ActiveInstance active(this);
+	ScriptObject::ActiveInstance active(this);
 
 	if (this->IsDead()) return;
 	if (this->engine->HasScriptCrashed()) {
@@ -354,21 +354,21 @@
 
 	if (!this->is_started) {
 		try {
-			AIObject::SetAllowDoCommand(false);
+			ScriptObject::SetAllowDoCommand(false);
 			/* Run the constructor if it exists. Don't allow any DoCommands in it. */
 			if (this->engine->MethodExists(*this->instance, "constructor")) {
 				if (!this->engine->CallMethod(*this->instance, "constructor", MAX_CONSTRUCTOR_OPS) || this->engine->IsSuspended()) {
-					if (this->engine->IsSuspended()) AILog::Error("This AI took too long to initialize. AI is not started.");
+					if (this->engine->IsSuspended()) ScriptLog::Error("This AI took too long to initialize. AI is not started.");
 					this->Died();
 					return;
 				}
 			}
 			if (!this->CallLoad() || this->engine->IsSuspended()) {
-				if (this->engine->IsSuspended()) AILog::Error("This AI took too long in the Load function. AI is not started.");
+				if (this->engine->IsSuspended()) ScriptLog::Error("This AI took too long in the Load function. AI is not started.");
 				this->Died();
 				return;
 			}
-			AIObject::SetAllowDoCommand(true);
+			ScriptObject::SetAllowDoCommand(true);
 			/* Start the AI by calling Start() */
 			if (!this->engine->CallMethod(*this->instance, "Start",  _settings_game.ai.ai_max_opcode_till_suspend) || !this->engine->IsSuspended()) this->Died();
 		} catch (AI_VMSuspend e) {
@@ -410,22 +410,22 @@
 
 /* static */ void AIInstance::DoCommandReturn(AIInstance *instance)
 {
-	instance->engine->InsertResult(AIObject::GetLastCommandRes());
+	instance->engine->InsertResult(ScriptObject::GetLastCommandRes());
 }
 
 /* static */ void AIInstance::DoCommandReturnVehicleID(AIInstance *instance)
 {
-	instance->engine->InsertResult(AIObject::GetNewVehicleID());
+	instance->engine->InsertResult(ScriptObject::GetNewVehicleID());
 }
 
 /* static */ void AIInstance::DoCommandReturnSignID(AIInstance *instance)
 {
-	instance->engine->InsertResult(AIObject::GetNewSignID());
+	instance->engine->InsertResult(ScriptObject::GetNewSignID());
 }
 
 /* static */ void AIInstance::DoCommandReturnGroupID(AIInstance *instance)
 {
-	instance->engine->InsertResult(AIObject::GetNewGroupID());
+	instance->engine->InsertResult(ScriptObject::GetNewGroupID());
 }
 
 AIStorage *AIInstance::GetStorage()
@@ -435,9 +435,9 @@
 
 void *AIInstance::GetLogPointer()
 {
-	AIObject::ActiveInstance active(this);
+	ScriptObject::ActiveInstance active(this);
 
-	return AIObject::GetLogPointer();
+	return ScriptObject::GetLogPointer();
 }
 
 /*
@@ -485,7 +485,7 @@
 /* static */ bool AIInstance::SaveObject(HSQUIRRELVM vm, SQInteger index, int max_depth, bool test)
 {
 	if (max_depth == 0) {
-		AILog::Error("Savedata can only be nested to 25 deep. No data saved.");
+		ScriptLog::Error("Savedata can only be nested to 25 deep. No data saved.");
 		return false;
 	}
 
@@ -516,7 +516,7 @@
 			const char *buf = SQ2OTTD(res);
 			size_t len = strlen(buf) + 1;
 			if (len >= 255) {
-				AILog::Error("Maximum string length is 254 chars. No data saved.");
+				ScriptLog::Error("Maximum string length is 254 chars. No data saved.");
 				return false;
 			}
 			if (!test) {
@@ -596,7 +596,7 @@
 		}
 
 		default:
-			AILog::Error("You tried to save an unsupported type. No data saved.");
+			ScriptLog::Error("You tried to save an unsupported type. No data saved.");
 			return false;
 	}
 }
@@ -609,7 +609,7 @@
 
 void AIInstance::Save()
 {
-	AIObject::ActiveInstance active(this);
+	ScriptObject::ActiveInstance active(this);
 
 	/* Don't save data if the AI didn't start yet or if it crashed. */
 	if (this->engine == NULL || this->engine->HasScriptCrashed()) {
@@ -629,8 +629,8 @@
 	} else if (this->engine->MethodExists(*this->instance, "Save")) {
 		HSQOBJECT savedata;
 		/* We don't want to be interrupted during the save function. */
-		bool backup_allow = AIObject::GetAllowDoCommand();
-		AIObject::SetAllowDoCommand(false);
+		bool backup_allow = ScriptObject::GetAllowDoCommand();
+		ScriptObject::SetAllowDoCommand(false);
 		try {
 			if (!this->engine->CallMethod(*this->instance, "Save", &savedata, MAX_SL_OPS)) {
 				/* The script crashed in the Save function. We can't kill
@@ -652,10 +652,10 @@
 			this->engine->CrashOccurred();
 			return;
 		}
-		AIObject::SetAllowDoCommand(backup_allow);
+		ScriptObject::SetAllowDoCommand(backup_allow);
 
 		if (!sq_istable(savedata)) {
-			AILog::Error(this->engine->IsSuspended() ? "This AI took too long to Save." : "Save function should return a table.");
+			ScriptLog::Error(this->engine->IsSuspended() ? "This AI took too long to Save." : "Save function should return a table.");
 			SaveEmpty();
 			this->engine->CrashOccurred();
 			return;
@@ -671,7 +671,7 @@
 			this->engine->CrashOccurred();
 		}
 	} else {
-		AILog::Warning("Save function is not implemented");
+		ScriptLog::Warning("Save function is not implemented");
 		_ai_sl_byte = 0;
 		SlObject(NULL, _ai_byte);
 	}
@@ -751,7 +751,7 @@
 
 void AIInstance::Load(int version)
 {
-	AIObject::ActiveInstance active(this);
+	ScriptObject::ActiveInstance active(this);
 
 	if (this->engine == NULL || version == -1) {
 		LoadEmpty();
@@ -777,7 +777,7 @@
 	this->is_save_data_on_stack = false;
 
 	if (!this->engine->MethodExists(*this->instance, "Load")) {
-		AILog::Warning("Loading failed: there was data for the AI to load, but the AI does not have a Load() function.");
+		ScriptLog::Warning("Loading failed: there was data for the AI to load, but the AI does not have a Load() function.");
 
 		/* Pop the savegame data and version. */
 		sq_pop(vm, 2);
@@ -812,21 +812,21 @@
 
 void AIInstance::DoCommandCallback(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 {
-	AIObject::ActiveInstance active(this);
+	ScriptObject::ActiveInstance active(this);
 
-	AIObject::SetLastCommandRes(result.Succeeded());
+	ScriptObject::SetLastCommandRes(result.Succeeded());
 
 	if (result.Failed()) {
-		AIObject::SetLastError(AIError::StringToError(result.GetErrorMessage()));
+		ScriptObject::SetLastError(ScriptError::StringToError(result.GetErrorMessage()));
 	} else {
-		AIObject::IncreaseDoCommandCosts(result.GetCost());
-		AIObject::SetLastCost(result.GetCost());
+		ScriptObject::IncreaseDoCommandCosts(result.GetCost());
+		ScriptObject::SetLastCost(result.GetCost());
 	}
 }
 
-void AIInstance::InsertEvent(class AIEvent *event)
+void AIInstance::InsertEvent(class ScriptEvent *event)
 {
-	AIObject::ActiveInstance active(this);
+	ScriptObject::ActiveInstance active(this);
 
-	AIEventController::InsertEvent(event);
+	ScriptEventController::InsertEvent(event);
 }
--- a/src/ai/ai_instance.hpp
+++ b/src/ai/ai_instance.hpp
@@ -77,8 +77,8 @@
 /** Runtime information about an AI like a pointer to the squirrel vm and the current state. */
 class AIInstance {
 public:
-	friend class AIObject;
-	friend class AIController;
+	friend class ScriptObject;
+	friend class ScriptController;
 
 	/**
 	 * Create a new AI.
@@ -141,7 +141,7 @@
 	/**
 	 * Get the controller attached to the instance.
 	 */
-	class AIController *GetController() { return controller; }
+	class ScriptController *GetController() { return controller; }
 
 	/**
 	 * Return the "this AI died" value
@@ -198,10 +198,10 @@
 	 * Insert an event for this AI.
 	 * @param event The event to insert.
 	 */
-	void InsertEvent(class AIEvent *event);
+	void InsertEvent(class ScriptEvent *event);
 
 private:
-	class AIController *controller;  ///< The AI main class.
+	class ScriptController *controller; ///< The AI main class.
 	class AIStorage *storage;        ///< Some global information for each running AI.
 	class Squirrel *engine;          ///< A wrapper around the squirrel vm.
 	SQObject *instance;              ///< Squirrel-pointer to the AI main class.
--- a/src/ai/ai_storage.hpp
+++ b/src/ai/ai_storage.hpp
@@ -29,10 +29,10 @@
  * The storage for each AI. It keeps track of important information.
  */
 class AIStorage {
-friend class AIObject;
+friend class ScriptObject;
 private:
 	AIModeProc *mode;                ///< The current build mode we are int.
-	class AIObject *mode_instance;   ///< The instance belonging to the current build mode.
+	class ScriptObject *mode_instance; ///< The instance belonging to the current build mode.
 
 	uint delay;                      ///< The ticks of delay each DoCommand has.
 	bool allow_do_command;           ///< Is the usage of DoCommands restricted?
--- a/src/ai/api/ai_accounting.hpp.sq
+++ b/src/ai/api/ai_accounting.hpp.sq
@@ -12,24 +12,24 @@
 #include "../../script/api/script_accounting.hpp"
 
 namespace SQConvert {
-	/* Allow AIAccounting to be used as Squirrel parameter */
-	template <> inline AIAccounting *GetParam(ForceType<AIAccounting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIAccounting *)instance; }
-	template <> inline AIAccounting &GetParam(ForceType<AIAccounting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIAccounting *)instance; }
-	template <> inline const AIAccounting *GetParam(ForceType<const AIAccounting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIAccounting *)instance; }
-	template <> inline const AIAccounting &GetParam(ForceType<const AIAccounting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIAccounting *)instance; }
-	template <> inline int Return<AIAccounting *>(HSQUIRRELVM vm, AIAccounting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Accounting", res, NULL, DefSQDestructorCallback<AIAccounting>, true); return 1; }
+	/* Allow ScriptAccounting to be used as Squirrel parameter */
+	template <> inline ScriptAccounting *GetParam(ForceType<ScriptAccounting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptAccounting *)instance; }
+	template <> inline ScriptAccounting &GetParam(ForceType<ScriptAccounting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptAccounting *)instance; }
+	template <> inline const ScriptAccounting *GetParam(ForceType<const ScriptAccounting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptAccounting *)instance; }
+	template <> inline const ScriptAccounting &GetParam(ForceType<const ScriptAccounting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptAccounting *)instance; }
+	template <> inline int Return<ScriptAccounting *>(HSQUIRRELVM vm, ScriptAccounting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Accounting", res, NULL, DefSQDestructorCallback<ScriptAccounting>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIAccounting, ST_AI>() { return "AIAccounting"; }
+template <> const char *GetClassName<ScriptAccounting, ST_AI>() { return "AIAccounting"; }
 
 void SQAIAccounting_Register(Squirrel *engine)
 {
-	DefSQClass<AIAccounting, ST_AI> SQAIAccounting("AIAccounting");
+	DefSQClass<ScriptAccounting, ST_AI> SQAIAccounting("AIAccounting");
 	SQAIAccounting.PreRegister(engine);
-	SQAIAccounting.AddConstructor<void (AIAccounting::*)(), 1>(engine, "x");
+	SQAIAccounting.AddConstructor<void (ScriptAccounting::*)(), 1>(engine, "x");
 
-	SQAIAccounting.DefSQMethod(engine, &AIAccounting::GetCosts,   "GetCosts",   1, "x");
-	SQAIAccounting.DefSQMethod(engine, &AIAccounting::ResetCosts, "ResetCosts", 1, "x");
+	SQAIAccounting.DefSQMethod(engine, &ScriptAccounting::GetCosts,   "GetCosts",   1, "x");
+	SQAIAccounting.DefSQMethod(engine, &ScriptAccounting::ResetCosts, "ResetCosts", 1, "x");
 
 	SQAIAccounting.PostRegister(engine);
 }
--- a/src/ai/api/ai_airport.hpp.sq
+++ b/src/ai/api/ai_airport.hpp.sq
@@ -13,57 +13,57 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIAirport::AirportType GetParam(ForceType<AIAirport::AirportType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIAirport::AirportType)tmp; }
-	template <> inline int Return<AIAirport::AirportType>(HSQUIRRELVM vm, AIAirport::AirportType res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIAirport::PlaneType GetParam(ForceType<AIAirport::PlaneType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIAirport::PlaneType)tmp; }
-	template <> inline int Return<AIAirport::PlaneType>(HSQUIRRELVM vm, AIAirport::PlaneType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptAirport::AirportType GetParam(ForceType<ScriptAirport::AirportType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptAirport::AirportType)tmp; }
+	template <> inline int Return<ScriptAirport::AirportType>(HSQUIRRELVM vm, ScriptAirport::AirportType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptAirport::PlaneType GetParam(ForceType<ScriptAirport::PlaneType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptAirport::PlaneType)tmp; }
+	template <> inline int Return<ScriptAirport::PlaneType>(HSQUIRRELVM vm, ScriptAirport::PlaneType res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIAirport to be used as Squirrel parameter */
-	template <> inline AIAirport *GetParam(ForceType<AIAirport *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIAirport *)instance; }
-	template <> inline AIAirport &GetParam(ForceType<AIAirport &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIAirport *)instance; }
-	template <> inline const AIAirport *GetParam(ForceType<const AIAirport *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIAirport *)instance; }
-	template <> inline const AIAirport &GetParam(ForceType<const AIAirport &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIAirport *)instance; }
-	template <> inline int Return<AIAirport *>(HSQUIRRELVM vm, AIAirport *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Airport", res, NULL, DefSQDestructorCallback<AIAirport>, true); return 1; }
+	/* Allow ScriptAirport to be used as Squirrel parameter */
+	template <> inline ScriptAirport *GetParam(ForceType<ScriptAirport *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptAirport *)instance; }
+	template <> inline ScriptAirport &GetParam(ForceType<ScriptAirport &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptAirport *)instance; }
+	template <> inline const ScriptAirport *GetParam(ForceType<const ScriptAirport *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptAirport *)instance; }
+	template <> inline const ScriptAirport &GetParam(ForceType<const ScriptAirport &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptAirport *)instance; }
+	template <> inline int Return<ScriptAirport *>(HSQUIRRELVM vm, ScriptAirport *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Airport", res, NULL, DefSQDestructorCallback<ScriptAirport>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIAirport, ST_AI>() { return "AIAirport"; }
+template <> const char *GetClassName<ScriptAirport, ST_AI>() { return "AIAirport"; }
 
 void SQAIAirport_Register(Squirrel *engine)
 {
-	DefSQClass<AIAirport, ST_AI> SQAIAirport("AIAirport");
+	DefSQClass<ScriptAirport, ST_AI> SQAIAirport("AIAirport");
 	SQAIAirport.PreRegister(engine);
-	SQAIAirport.AddConstructor<void (AIAirport::*)(), 1>(engine, "x");
+	SQAIAirport.AddConstructor<void (ScriptAirport::*)(), 1>(engine, "x");
 
-	SQAIAirport.DefSQConst(engine, AIAirport::AT_SMALL,         "AT_SMALL");
-	SQAIAirport.DefSQConst(engine, AIAirport::AT_LARGE,         "AT_LARGE");
-	SQAIAirport.DefSQConst(engine, AIAirport::AT_METROPOLITAN,  "AT_METROPOLITAN");
-	SQAIAirport.DefSQConst(engine, AIAirport::AT_INTERNATIONAL, "AT_INTERNATIONAL");
-	SQAIAirport.DefSQConst(engine, AIAirport::AT_COMMUTER,      "AT_COMMUTER");
-	SQAIAirport.DefSQConst(engine, AIAirport::AT_INTERCON,      "AT_INTERCON");
-	SQAIAirport.DefSQConst(engine, AIAirport::AT_HELIPORT,      "AT_HELIPORT");
-	SQAIAirport.DefSQConst(engine, AIAirport::AT_HELISTATION,   "AT_HELISTATION");
-	SQAIAirport.DefSQConst(engine, AIAirport::AT_HELIDEPOT,     "AT_HELIDEPOT");
-	SQAIAirport.DefSQConst(engine, AIAirport::AT_INVALID,       "AT_INVALID");
-	SQAIAirport.DefSQConst(engine, AIAirport::PT_HELICOPTER,    "PT_HELICOPTER");
-	SQAIAirport.DefSQConst(engine, AIAirport::PT_SMALL_PLANE,   "PT_SMALL_PLANE");
-	SQAIAirport.DefSQConst(engine, AIAirport::PT_BIG_PLANE,     "PT_BIG_PLANE");
-	SQAIAirport.DefSQConst(engine, AIAirport::PT_INVALID,       "PT_INVALID");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::AT_SMALL,         "AT_SMALL");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::AT_LARGE,         "AT_LARGE");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::AT_METROPOLITAN,  "AT_METROPOLITAN");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::AT_INTERNATIONAL, "AT_INTERNATIONAL");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::AT_COMMUTER,      "AT_COMMUTER");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::AT_INTERCON,      "AT_INTERCON");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::AT_HELIPORT,      "AT_HELIPORT");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::AT_HELISTATION,   "AT_HELISTATION");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::AT_HELIDEPOT,     "AT_HELIDEPOT");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::AT_INVALID,       "AT_INVALID");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::PT_HELICOPTER,    "PT_HELICOPTER");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::PT_SMALL_PLANE,   "PT_SMALL_PLANE");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::PT_BIG_PLANE,     "PT_BIG_PLANE");
+	SQAIAirport.DefSQConst(engine, ScriptAirport::PT_INVALID,       "PT_INVALID");
 
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsValidAirportType,            "IsValidAirportType",            2, ".i");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsAirportInformationAvailable, "IsAirportInformationAvailable", 2, ".i");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetPrice,                      "GetPrice",                      2, ".i");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsHangarTile,                  "IsHangarTile",                  2, ".i");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsAirportTile,                 "IsAirportTile",                 2, ".i");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportWidth,               "GetAirportWidth",               2, ".i");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportHeight,              "GetAirportHeight",              2, ".i");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportCoverageRadius,      "GetAirportCoverageRadius",      2, ".i");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetNumHangars,                 "GetNumHangars",                 2, ".i");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetHangarOfAirport,            "GetHangarOfAirport",            2, ".i");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::BuildAirport,                  "BuildAirport",                  4, ".iii");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::RemoveAirport,                 "RemoveAirport",                 2, ".i");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportType,                "GetAirportType",                2, ".i");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetNoiseLevelIncrease,         "GetNoiseLevelIncrease",         3, ".ii");
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetNearestTown,                "GetNearestTown",                3, ".ii");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::IsValidAirportType,            "IsValidAirportType",            2, ".i");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::IsAirportInformationAvailable, "IsAirportInformationAvailable", 2, ".i");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetPrice,                      "GetPrice",                      2, ".i");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::IsHangarTile,                  "IsHangarTile",                  2, ".i");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::IsAirportTile,                 "IsAirportTile",                 2, ".i");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetAirportWidth,               "GetAirportWidth",               2, ".i");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetAirportHeight,              "GetAirportHeight",              2, ".i");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetAirportCoverageRadius,      "GetAirportCoverageRadius",      2, ".i");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNumHangars,                 "GetNumHangars",                 2, ".i");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetHangarOfAirport,            "GetHangarOfAirport",            2, ".i");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::BuildAirport,                  "BuildAirport",                  4, ".iii");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::RemoveAirport,                 "RemoveAirport",                 2, ".i");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetAirportType,                "GetAirportType",                2, ".i");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNoiseLevelIncrease,         "GetNoiseLevelIncrease",         3, ".ii");
+	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNearestTown,                "GetNearestTown",                3, ".ii");
 
 	SQAIAirport.PostRegister(engine);
 }
--- a/src/ai/api/ai_base.hpp.sq
+++ b/src/ai/api/ai_base.hpp.sq
@@ -12,28 +12,28 @@
 #include "../../script/api/script_base.hpp"
 
 namespace SQConvert {
-	/* Allow AIBase to be used as Squirrel parameter */
-	template <> inline AIBase *GetParam(ForceType<AIBase *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIBase *)instance; }
-	template <> inline AIBase &GetParam(ForceType<AIBase &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIBase *)instance; }
-	template <> inline const AIBase *GetParam(ForceType<const AIBase *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIBase *)instance; }
-	template <> inline const AIBase &GetParam(ForceType<const AIBase &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIBase *)instance; }
-	template <> inline int Return<AIBase *>(HSQUIRRELVM vm, AIBase *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Base", res, NULL, DefSQDestructorCallback<AIBase>, true); return 1; }
+	/* Allow ScriptBase to be used as Squirrel parameter */
+	template <> inline ScriptBase *GetParam(ForceType<ScriptBase *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptBase *)instance; }
+	template <> inline ScriptBase &GetParam(ForceType<ScriptBase &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBase *)instance; }
+	template <> inline const ScriptBase *GetParam(ForceType<const ScriptBase *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptBase *)instance; }
+	template <> inline const ScriptBase &GetParam(ForceType<const ScriptBase &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBase *)instance; }
+	template <> inline int Return<ScriptBase *>(HSQUIRRELVM vm, ScriptBase *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Base", res, NULL, DefSQDestructorCallback<ScriptBase>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIBase, ST_AI>() { return "AIBase"; }
+template <> const char *GetClassName<ScriptBase, ST_AI>() { return "AIBase"; }
 
 void SQAIBase_Register(Squirrel *engine)
 {
-	DefSQClass<AIBase, ST_AI> SQAIBase("AIBase");
+	DefSQClass<ScriptBase, ST_AI> SQAIBase("AIBase");
 	SQAIBase.PreRegister(engine);
-	SQAIBase.AddConstructor<void (AIBase::*)(), 1>(engine, "x");
+	SQAIBase.AddConstructor<void (ScriptBase::*)(), 1>(engine, "x");
 
-	SQAIBase.DefSQStaticMethod(engine, &AIBase::Rand,          "Rand",          1, ".");
-	SQAIBase.DefSQStaticMethod(engine, &AIBase::RandItem,      "RandItem",      2, ".i");
-	SQAIBase.DefSQStaticMethod(engine, &AIBase::RandRange,     "RandRange",     2, ".i");
-	SQAIBase.DefSQStaticMethod(engine, &AIBase::RandRangeItem, "RandRangeItem", 3, ".ii");
-	SQAIBase.DefSQStaticMethod(engine, &AIBase::Chance,        "Chance",        3, ".ii");
-	SQAIBase.DefSQStaticMethod(engine, &AIBase::ChanceItem,    "ChanceItem",    4, ".iii");
+	SQAIBase.DefSQStaticMethod(engine, &ScriptBase::Rand,          "Rand",          1, ".");
+	SQAIBase.DefSQStaticMethod(engine, &ScriptBase::RandItem,      "RandItem",      2, ".i");
+	SQAIBase.DefSQStaticMethod(engine, &ScriptBase::RandRange,     "RandRange",     2, ".i");
+	SQAIBase.DefSQStaticMethod(engine, &ScriptBase::RandRangeItem, "RandRangeItem", 3, ".ii");
+	SQAIBase.DefSQStaticMethod(engine, &ScriptBase::Chance,        "Chance",        3, ".ii");
+	SQAIBase.DefSQStaticMethod(engine, &ScriptBase::ChanceItem,    "ChanceItem",    4, ".iii");
 
 	SQAIBase.PostRegister(engine);
 }
--- a/src/ai/api/ai_basestation.hpp.sq
+++ b/src/ai/api/ai_basestation.hpp.sq
@@ -13,34 +13,34 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIBaseStation::SpecialStationIDs GetParam(ForceType<AIBaseStation::SpecialStationIDs>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIBaseStation::SpecialStationIDs)tmp; }
-	template <> inline int Return<AIBaseStation::SpecialStationIDs>(HSQUIRRELVM vm, AIBaseStation::SpecialStationIDs res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptBaseStation::SpecialStationIDs GetParam(ForceType<ScriptBaseStation::SpecialStationIDs>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptBaseStation::SpecialStationIDs)tmp; }
+	template <> inline int Return<ScriptBaseStation::SpecialStationIDs>(HSQUIRRELVM vm, ScriptBaseStation::SpecialStationIDs res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIBaseStation to be used as Squirrel parameter */
-	template <> inline AIBaseStation *GetParam(ForceType<AIBaseStation *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIBaseStation *)instance; }
-	template <> inline AIBaseStation &GetParam(ForceType<AIBaseStation &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIBaseStation *)instance; }
-	template <> inline const AIBaseStation *GetParam(ForceType<const AIBaseStation *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIBaseStation *)instance; }
-	template <> inline const AIBaseStation &GetParam(ForceType<const AIBaseStation &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIBaseStation *)instance; }
-	template <> inline int Return<AIBaseStation *>(HSQUIRRELVM vm, AIBaseStation *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "BaseStation", res, NULL, DefSQDestructorCallback<AIBaseStation>, true); return 1; }
+	/* Allow ScriptBaseStation to be used as Squirrel parameter */
+	template <> inline ScriptBaseStation *GetParam(ForceType<ScriptBaseStation *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptBaseStation *)instance; }
+	template <> inline ScriptBaseStation &GetParam(ForceType<ScriptBaseStation &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBaseStation *)instance; }
+	template <> inline const ScriptBaseStation *GetParam(ForceType<const ScriptBaseStation *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptBaseStation *)instance; }
+	template <> inline const ScriptBaseStation &GetParam(ForceType<const ScriptBaseStation &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBaseStation *)instance; }
+	template <> inline int Return<ScriptBaseStation *>(HSQUIRRELVM vm, ScriptBaseStation *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "BaseStation", res, NULL, DefSQDestructorCallback<ScriptBaseStation>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIBaseStation, ST_AI>() { return "AIBaseStation"; }
+template <> const char *GetClassName<ScriptBaseStation, ST_AI>() { return "AIBaseStation"; }
 
 void SQAIBaseStation_Register(Squirrel *engine)
 {
-	DefSQClass<AIBaseStation, ST_AI> SQAIBaseStation("AIBaseStation");
+	DefSQClass<ScriptBaseStation, ST_AI> SQAIBaseStation("AIBaseStation");
 	SQAIBaseStation.PreRegister(engine);
-	SQAIBaseStation.AddConstructor<void (AIBaseStation::*)(), 1>(engine, "x");
+	SQAIBaseStation.AddConstructor<void (ScriptBaseStation::*)(), 1>(engine, "x");
 
-	SQAIBaseStation.DefSQConst(engine, AIBaseStation::STATION_NEW,           "STATION_NEW");
-	SQAIBaseStation.DefSQConst(engine, AIBaseStation::STATION_JOIN_ADJACENT, "STATION_JOIN_ADJACENT");
-	SQAIBaseStation.DefSQConst(engine, AIBaseStation::STATION_INVALID,       "STATION_INVALID");
+	SQAIBaseStation.DefSQConst(engine, ScriptBaseStation::STATION_NEW,           "STATION_NEW");
+	SQAIBaseStation.DefSQConst(engine, ScriptBaseStation::STATION_JOIN_ADJACENT, "STATION_JOIN_ADJACENT");
+	SQAIBaseStation.DefSQConst(engine, ScriptBaseStation::STATION_INVALID,       "STATION_INVALID");
 
-	SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::IsValidBaseStation,  "IsValidBaseStation",  2, ".i");
-	SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::GetName,             "GetName",             2, ".i");
-	SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::SetName,             "SetName",             3, ".i.");
-	SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::GetLocation,         "GetLocation",         2, ".i");
-	SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::GetConstructionDate, "GetConstructionDate", 2, ".i");
+	SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::IsValidBaseStation,  "IsValidBaseStation",  2, ".i");
+	SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::GetName,             "GetName",             2, ".i");
+	SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::SetName,             "SetName",             3, ".i.");
+	SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::GetLocation,         "GetLocation",         2, ".i");
+	SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::GetConstructionDate, "GetConstructionDate", 2, ".i");
 
 	SQAIBaseStation.PostRegister(engine);
 }
--- a/src/ai/api/ai_bridge.hpp.sq
+++ b/src/ai/api/ai_bridge.hpp.sq
@@ -13,49 +13,49 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIBridge::ErrorMessages GetParam(ForceType<AIBridge::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIBridge::ErrorMessages)tmp; }
-	template <> inline int Return<AIBridge::ErrorMessages>(HSQUIRRELVM vm, AIBridge::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptBridge::ErrorMessages GetParam(ForceType<ScriptBridge::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptBridge::ErrorMessages)tmp; }
+	template <> inline int Return<ScriptBridge::ErrorMessages>(HSQUIRRELVM vm, ScriptBridge::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIBridge to be used as Squirrel parameter */
-	template <> inline AIBridge *GetParam(ForceType<AIBridge *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIBridge *)instance; }
-	template <> inline AIBridge &GetParam(ForceType<AIBridge &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIBridge *)instance; }
-	template <> inline const AIBridge *GetParam(ForceType<const AIBridge *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIBridge *)instance; }
-	template <> inline const AIBridge &GetParam(ForceType<const AIBridge &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIBridge *)instance; }
-	template <> inline int Return<AIBridge *>(HSQUIRRELVM vm, AIBridge *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Bridge", res, NULL, DefSQDestructorCallback<AIBridge>, true); return 1; }
+	/* Allow ScriptBridge to be used as Squirrel parameter */
+	template <> inline ScriptBridge *GetParam(ForceType<ScriptBridge *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptBridge *)instance; }
+	template <> inline ScriptBridge &GetParam(ForceType<ScriptBridge &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBridge *)instance; }
+	template <> inline const ScriptBridge *GetParam(ForceType<const ScriptBridge *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptBridge *)instance; }
+	template <> inline const ScriptBridge &GetParam(ForceType<const ScriptBridge &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBridge *)instance; }
+	template <> inline int Return<ScriptBridge *>(HSQUIRRELVM vm, ScriptBridge *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Bridge", res, NULL, DefSQDestructorCallback<ScriptBridge>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIBridge, ST_AI>() { return "AIBridge"; }
+template <> const char *GetClassName<ScriptBridge, ST_AI>() { return "AIBridge"; }
 
 void SQAIBridge_Register(Squirrel *engine)
 {
-	DefSQClass<AIBridge, ST_AI> SQAIBridge("AIBridge");
+	DefSQClass<ScriptBridge, ST_AI> SQAIBridge("AIBridge");
 	SQAIBridge.PreRegister(engine);
-	SQAIBridge.AddConstructor<void (AIBridge::*)(), 1>(engine, "x");
+	SQAIBridge.AddConstructor<void (ScriptBridge::*)(), 1>(engine, "x");
 
-	SQAIBridge.DefSQConst(engine, AIBridge::ERR_BRIDGE_BASE,                     "ERR_BRIDGE_BASE");
-	SQAIBridge.DefSQConst(engine, AIBridge::ERR_BRIDGE_TYPE_UNAVAILABLE,         "ERR_BRIDGE_TYPE_UNAVAILABLE");
-	SQAIBridge.DefSQConst(engine, AIBridge::ERR_BRIDGE_CANNOT_END_IN_WATER,      "ERR_BRIDGE_CANNOT_END_IN_WATER");
-	SQAIBridge.DefSQConst(engine, AIBridge::ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT, "ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT");
+	SQAIBridge.DefSQConst(engine, ScriptBridge::ERR_BRIDGE_BASE,                     "ERR_BRIDGE_BASE");
+	SQAIBridge.DefSQConst(engine, ScriptBridge::ERR_BRIDGE_TYPE_UNAVAILABLE,         "ERR_BRIDGE_TYPE_UNAVAILABLE");
+	SQAIBridge.DefSQConst(engine, ScriptBridge::ERR_BRIDGE_CANNOT_END_IN_WATER,      "ERR_BRIDGE_CANNOT_END_IN_WATER");
+	SQAIBridge.DefSQConst(engine, ScriptBridge::ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT, "ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT");
 
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE,     AIBridge::ERR_BRIDGE_TYPE_UNAVAILABLE);
-	AIError::RegisterErrorMap(STR_ERROR_ENDS_OF_BRIDGE_MUST_BOTH,    AIBridge::ERR_BRIDGE_CANNOT_END_IN_WATER);
-	AIError::RegisterErrorMap(STR_ERROR_BRIDGEHEADS_NOT_SAME_HEIGHT, AIBridge::ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE,     ScriptBridge::ERR_BRIDGE_TYPE_UNAVAILABLE);
+	ScriptError::RegisterErrorMap(STR_ERROR_ENDS_OF_BRIDGE_MUST_BOTH,    ScriptBridge::ERR_BRIDGE_CANNOT_END_IN_WATER);
+	ScriptError::RegisterErrorMap(STR_ERROR_BRIDGEHEADS_NOT_SAME_HEIGHT, ScriptBridge::ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT);
 
-	AIError::RegisterErrorMapString(AIBridge::ERR_BRIDGE_TYPE_UNAVAILABLE,         "ERR_BRIDGE_TYPE_UNAVAILABLE");
-	AIError::RegisterErrorMapString(AIBridge::ERR_BRIDGE_CANNOT_END_IN_WATER,      "ERR_BRIDGE_CANNOT_END_IN_WATER");
-	AIError::RegisterErrorMapString(AIBridge::ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT, "ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT");
+	ScriptError::RegisterErrorMapString(ScriptBridge::ERR_BRIDGE_TYPE_UNAVAILABLE,         "ERR_BRIDGE_TYPE_UNAVAILABLE");
+	ScriptError::RegisterErrorMapString(ScriptBridge::ERR_BRIDGE_CANNOT_END_IN_WATER,      "ERR_BRIDGE_CANNOT_END_IN_WATER");
+	ScriptError::RegisterErrorMapString(ScriptBridge::ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT, "ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT");
 
-	SQAIBridge.DefSQStaticMethod(engine, &AIBridge::IsValidBridge,     "IsValidBridge",     2, ".i");
-	SQAIBridge.DefSQStaticMethod(engine, &AIBridge::IsBridgeTile,      "IsBridgeTile",      2, ".i");
-	SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetBridgeID,       "GetBridgeID",       2, ".i");
-	SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetName,           "GetName",           2, ".i");
-	SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetMaxSpeed,       "GetMaxSpeed",       2, ".i");
-	SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetPrice,          "GetPrice",          3, ".ii");
-	SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetMaxLength,      "GetMaxLength",      2, ".i");
-	SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetMinLength,      "GetMinLength",      2, ".i");
-	SQAIBridge.DefSQStaticMethod(engine, &AIBridge::BuildBridge,       "BuildBridge",       5, ".iiii");
-	SQAIBridge.DefSQStaticMethod(engine, &AIBridge::RemoveBridge,      "RemoveBridge",      2, ".i");
-	SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetOtherBridgeEnd, "GetOtherBridgeEnd", 2, ".i");
+	SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::IsValidBridge,     "IsValidBridge",     2, ".i");
+	SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::IsBridgeTile,      "IsBridgeTile",      2, ".i");
+	SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::GetBridgeID,       "GetBridgeID",       2, ".i");
+	SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::GetName,           "GetName",           2, ".i");
+	SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::GetMaxSpeed,       "GetMaxSpeed",       2, ".i");
+	SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::GetPrice,          "GetPrice",          3, ".ii");
+	SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::GetMaxLength,      "GetMaxLength",      2, ".i");
+	SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::GetMinLength,      "GetMinLength",      2, ".i");
+	SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::BuildBridge,       "BuildBridge",       5, ".iiii");
+	SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::RemoveBridge,      "RemoveBridge",      2, ".i");
+	SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::GetOtherBridgeEnd, "GetOtherBridgeEnd", 2, ".i");
 
 	SQAIBridge.PostRegister(engine);
 }
--- a/src/ai/api/ai_bridgelist.hpp.sq
+++ b/src/ai/api/ai_bridgelist.hpp.sq
@@ -12,41 +12,41 @@
 #include "../../script/api/script_bridgelist.hpp"
 
 namespace SQConvert {
-	/* Allow AIBridgeList to be used as Squirrel parameter */
-	template <> inline AIBridgeList *GetParam(ForceType<AIBridgeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIBridgeList *)instance; }
-	template <> inline AIBridgeList &GetParam(ForceType<AIBridgeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIBridgeList *)instance; }
-	template <> inline const AIBridgeList *GetParam(ForceType<const AIBridgeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIBridgeList *)instance; }
-	template <> inline const AIBridgeList &GetParam(ForceType<const AIBridgeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIBridgeList *)instance; }
-	template <> inline int Return<AIBridgeList *>(HSQUIRRELVM vm, AIBridgeList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "BridgeList", res, NULL, DefSQDestructorCallback<AIBridgeList>, true); return 1; }
+	/* Allow ScriptBridgeList to be used as Squirrel parameter */
+	template <> inline ScriptBridgeList *GetParam(ForceType<ScriptBridgeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptBridgeList *)instance; }
+	template <> inline ScriptBridgeList &GetParam(ForceType<ScriptBridgeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBridgeList *)instance; }
+	template <> inline const ScriptBridgeList *GetParam(ForceType<const ScriptBridgeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptBridgeList *)instance; }
+	template <> inline const ScriptBridgeList &GetParam(ForceType<const ScriptBridgeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBridgeList *)instance; }
+	template <> inline int Return<ScriptBridgeList *>(HSQUIRRELVM vm, ScriptBridgeList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "BridgeList", res, NULL, DefSQDestructorCallback<ScriptBridgeList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIBridgeList, ST_AI>() { return "AIBridgeList"; }
+template <> const char *GetClassName<ScriptBridgeList, ST_AI>() { return "AIBridgeList"; }
 
 void SQAIBridgeList_Register(Squirrel *engine)
 {
-	DefSQClass<AIBridgeList, ST_AI> SQAIBridgeList("AIBridgeList");
+	DefSQClass<ScriptBridgeList, ST_AI> SQAIBridgeList("AIBridgeList");
 	SQAIBridgeList.PreRegister(engine, "AIList");
-	SQAIBridgeList.AddConstructor<void (AIBridgeList::*)(), 1>(engine, "x");
+	SQAIBridgeList.AddConstructor<void (ScriptBridgeList::*)(), 1>(engine, "x");
 
 	SQAIBridgeList.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIBridgeList_Length to be used as Squirrel parameter */
-	template <> inline AIBridgeList_Length *GetParam(ForceType<AIBridgeList_Length *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIBridgeList_Length *)instance; }
-	template <> inline AIBridgeList_Length &GetParam(ForceType<AIBridgeList_Length &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIBridgeList_Length *)instance; }
-	template <> inline const AIBridgeList_Length *GetParam(ForceType<const AIBridgeList_Length *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIBridgeList_Length *)instance; }
-	template <> inline const AIBridgeList_Length &GetParam(ForceType<const AIBridgeList_Length &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIBridgeList_Length *)instance; }
-	template <> inline int Return<AIBridgeList_Length *>(HSQUIRRELVM vm, AIBridgeList_Length *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "BridgeList_Length", res, NULL, DefSQDestructorCallback<AIBridgeList_Length>, true); return 1; }
+	/* Allow ScriptBridgeList_Length to be used as Squirrel parameter */
+	template <> inline ScriptBridgeList_Length *GetParam(ForceType<ScriptBridgeList_Length *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptBridgeList_Length *)instance; }
+	template <> inline ScriptBridgeList_Length &GetParam(ForceType<ScriptBridgeList_Length &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBridgeList_Length *)instance; }
+	template <> inline const ScriptBridgeList_Length *GetParam(ForceType<const ScriptBridgeList_Length *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptBridgeList_Length *)instance; }
+	template <> inline const ScriptBridgeList_Length &GetParam(ForceType<const ScriptBridgeList_Length &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBridgeList_Length *)instance; }
+	template <> inline int Return<ScriptBridgeList_Length *>(HSQUIRRELVM vm, ScriptBridgeList_Length *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "BridgeList_Length", res, NULL, DefSQDestructorCallback<ScriptBridgeList_Length>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIBridgeList_Length, ST_AI>() { return "AIBridgeList_Length"; }
+template <> const char *GetClassName<ScriptBridgeList_Length, ST_AI>() { return "AIBridgeList_Length"; }
 
 void SQAIBridgeList_Length_Register(Squirrel *engine)
 {
-	DefSQClass<AIBridgeList_Length, ST_AI> SQAIBridgeList_Length("AIBridgeList_Length");
+	DefSQClass<ScriptBridgeList_Length, ST_AI> SQAIBridgeList_Length("AIBridgeList_Length");
 	SQAIBridgeList_Length.PreRegister(engine, "AIList");
-	SQAIBridgeList_Length.AddConstructor<void (AIBridgeList_Length::*)(uint length), 2>(engine, "xi");
+	SQAIBridgeList_Length.AddConstructor<void (ScriptBridgeList_Length::*)(uint length), 2>(engine, "xi");
 
 	SQAIBridgeList_Length.PostRegister(engine);
 }
--- a/src/ai/api/ai_cargo.hpp.sq
+++ b/src/ai/api/ai_cargo.hpp.sq
@@ -13,55 +13,55 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AICargo::CargoClass GetParam(ForceType<AICargo::CargoClass>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AICargo::CargoClass)tmp; }
-	template <> inline int Return<AICargo::CargoClass>(HSQUIRRELVM vm, AICargo::CargoClass res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AICargo::TownEffect GetParam(ForceType<AICargo::TownEffect>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AICargo::TownEffect)tmp; }
-	template <> inline int Return<AICargo::TownEffect>(HSQUIRRELVM vm, AICargo::TownEffect res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AICargo::SpecialCargoID GetParam(ForceType<AICargo::SpecialCargoID>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AICargo::SpecialCargoID)tmp; }
-	template <> inline int Return<AICargo::SpecialCargoID>(HSQUIRRELVM vm, AICargo::SpecialCargoID res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptCargo::CargoClass GetParam(ForceType<ScriptCargo::CargoClass>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptCargo::CargoClass)tmp; }
+	template <> inline int Return<ScriptCargo::CargoClass>(HSQUIRRELVM vm, ScriptCargo::CargoClass res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptCargo::TownEffect GetParam(ForceType<ScriptCargo::TownEffect>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptCargo::TownEffect)tmp; }
+	template <> inline int Return<ScriptCargo::TownEffect>(HSQUIRRELVM vm, ScriptCargo::TownEffect res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptCargo::SpecialCargoID GetParam(ForceType<ScriptCargo::SpecialCargoID>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptCargo::SpecialCargoID)tmp; }
+	template <> inline int Return<ScriptCargo::SpecialCargoID>(HSQUIRRELVM vm, ScriptCargo::SpecialCargoID res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AICargo to be used as Squirrel parameter */
-	template <> inline AICargo *GetParam(ForceType<AICargo *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AICargo *)instance; }
-	template <> inline AICargo &GetParam(ForceType<AICargo &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICargo *)instance; }
-	template <> inline const AICargo *GetParam(ForceType<const AICargo *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AICargo *)instance; }
-	template <> inline const AICargo &GetParam(ForceType<const AICargo &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICargo *)instance; }
-	template <> inline int Return<AICargo *>(HSQUIRRELVM vm, AICargo *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Cargo", res, NULL, DefSQDestructorCallback<AICargo>, true); return 1; }
+	/* Allow ScriptCargo to be used as Squirrel parameter */
+	template <> inline ScriptCargo *GetParam(ForceType<ScriptCargo *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptCargo *)instance; }
+	template <> inline ScriptCargo &GetParam(ForceType<ScriptCargo &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCargo *)instance; }
+	template <> inline const ScriptCargo *GetParam(ForceType<const ScriptCargo *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptCargo *)instance; }
+	template <> inline const ScriptCargo &GetParam(ForceType<const ScriptCargo &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCargo *)instance; }
+	template <> inline int Return<ScriptCargo *>(HSQUIRRELVM vm, ScriptCargo *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Cargo", res, NULL, DefSQDestructorCallback<ScriptCargo>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AICargo, ST_AI>() { return "AICargo"; }
+template <> const char *GetClassName<ScriptCargo, ST_AI>() { return "AICargo"; }
 
 void SQAICargo_Register(Squirrel *engine)
 {
-	DefSQClass<AICargo, ST_AI> SQAICargo("AICargo");
+	DefSQClass<ScriptCargo, ST_AI> SQAICargo("AICargo");
 	SQAICargo.PreRegister(engine);
-	SQAICargo.AddConstructor<void (AICargo::*)(), 1>(engine, "x");
+	SQAICargo.AddConstructor<void (ScriptCargo::*)(), 1>(engine, "x");
 
-	SQAICargo.DefSQConst(engine, AICargo::CC_PASSENGERS,   "CC_PASSENGERS");
-	SQAICargo.DefSQConst(engine, AICargo::CC_MAIL,         "CC_MAIL");
-	SQAICargo.DefSQConst(engine, AICargo::CC_EXPRESS,      "CC_EXPRESS");
-	SQAICargo.DefSQConst(engine, AICargo::CC_ARMOURED,     "CC_ARMOURED");
-	SQAICargo.DefSQConst(engine, AICargo::CC_BULK,         "CC_BULK");
-	SQAICargo.DefSQConst(engine, AICargo::CC_PIECE_GOODS,  "CC_PIECE_GOODS");
-	SQAICargo.DefSQConst(engine, AICargo::CC_LIQUID,       "CC_LIQUID");
-	SQAICargo.DefSQConst(engine, AICargo::CC_REFRIGERATED, "CC_REFRIGERATED");
-	SQAICargo.DefSQConst(engine, AICargo::CC_HAZARDOUS,    "CC_HAZARDOUS");
-	SQAICargo.DefSQConst(engine, AICargo::CC_COVERED,      "CC_COVERED");
-	SQAICargo.DefSQConst(engine, AICargo::TE_NONE,         "TE_NONE");
-	SQAICargo.DefSQConst(engine, AICargo::TE_PASSENGERS,   "TE_PASSENGERS");
-	SQAICargo.DefSQConst(engine, AICargo::TE_MAIL,         "TE_MAIL");
-	SQAICargo.DefSQConst(engine, AICargo::TE_GOODS,        "TE_GOODS");
-	SQAICargo.DefSQConst(engine, AICargo::TE_WATER,        "TE_WATER");
-	SQAICargo.DefSQConst(engine, AICargo::TE_FOOD,         "TE_FOOD");
-	SQAICargo.DefSQConst(engine, AICargo::CT_AUTO_REFIT,   "CT_AUTO_REFIT");
-	SQAICargo.DefSQConst(engine, AICargo::CT_NO_REFIT,     "CT_NO_REFIT");
+	SQAICargo.DefSQConst(engine, ScriptCargo::CC_PASSENGERS,   "CC_PASSENGERS");
+	SQAICargo.DefSQConst(engine, ScriptCargo::CC_MAIL,         "CC_MAIL");
+	SQAICargo.DefSQConst(engine, ScriptCargo::CC_EXPRESS,      "CC_EXPRESS");
+	SQAICargo.DefSQConst(engine, ScriptCargo::CC_ARMOURED,     "CC_ARMOURED");
+	SQAICargo.DefSQConst(engine, ScriptCargo::CC_BULK,         "CC_BULK");
+	SQAICargo.DefSQConst(engine, ScriptCargo::CC_PIECE_GOODS,  "CC_PIECE_GOODS");
+	SQAICargo.DefSQConst(engine, ScriptCargo::CC_LIQUID,       "CC_LIQUID");
+	SQAICargo.DefSQConst(engine, ScriptCargo::CC_REFRIGERATED, "CC_REFRIGERATED");
+	SQAICargo.DefSQConst(engine, ScriptCargo::CC_HAZARDOUS,    "CC_HAZARDOUS");
+	SQAICargo.DefSQConst(engine, ScriptCargo::CC_COVERED,      "CC_COVERED");
+	SQAICargo.DefSQConst(engine, ScriptCargo::TE_NONE,         "TE_NONE");
+	SQAICargo.DefSQConst(engine, ScriptCargo::TE_PASSENGERS,   "TE_PASSENGERS");
+	SQAICargo.DefSQConst(engine, ScriptCargo::TE_MAIL,         "TE_MAIL");
+	SQAICargo.DefSQConst(engine, ScriptCargo::TE_GOODS,        "TE_GOODS");
+	SQAICargo.DefSQConst(engine, ScriptCargo::TE_WATER,        "TE_WATER");
+	SQAICargo.DefSQConst(engine, ScriptCargo::TE_FOOD,         "TE_FOOD");
+	SQAICargo.DefSQConst(engine, ScriptCargo::CT_AUTO_REFIT,   "CT_AUTO_REFIT");
+	SQAICargo.DefSQConst(engine, ScriptCargo::CT_NO_REFIT,     "CT_NO_REFIT");
 
-	SQAICargo.DefSQStaticMethod(engine, &AICargo::IsValidCargo,      "IsValidCargo",      2, ".i");
-	SQAICargo.DefSQStaticMethod(engine, &AICargo::IsValidTownEffect, "IsValidTownEffect", 2, ".i");
-	SQAICargo.DefSQStaticMethod(engine, &AICargo::GetCargoLabel,     "GetCargoLabel",     2, ".i");
-	SQAICargo.DefSQStaticMethod(engine, &AICargo::IsFreight,         "IsFreight",         2, ".i");
-	SQAICargo.DefSQStaticMethod(engine, &AICargo::HasCargoClass,     "HasCargoClass",     3, ".ii");
-	SQAICargo.DefSQStaticMethod(engine, &AICargo::GetTownEffect,     "GetTownEffect",     2, ".i");
-	SQAICargo.DefSQStaticMethod(engine, &AICargo::GetCargoIncome,    "GetCargoIncome",    4, ".iii");
+	SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::IsValidCargo,      "IsValidCargo",      2, ".i");
+	SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::IsValidTownEffect, "IsValidTownEffect", 2, ".i");
+	SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::GetCargoLabel,     "GetCargoLabel",     2, ".i");
+	SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::IsFreight,         "IsFreight",         2, ".i");
+	SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::HasCargoClass,     "HasCargoClass",     3, ".ii");
+	SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::GetTownEffect,     "GetTownEffect",     2, ".i");
+	SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::GetCargoIncome,    "GetCargoIncome",    4, ".iii");
 
 	SQAICargo.PostRegister(engine);
 }
--- a/src/ai/api/ai_cargolist.hpp.sq
+++ b/src/ai/api/ai_cargolist.hpp.sq
@@ -12,81 +12,81 @@
 #include "../../script/api/script_cargolist.hpp"
 
 namespace SQConvert {
-	/* Allow AICargoList to be used as Squirrel parameter */
-	template <> inline AICargoList *GetParam(ForceType<AICargoList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AICargoList *)instance; }
-	template <> inline AICargoList &GetParam(ForceType<AICargoList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICargoList *)instance; }
-	template <> inline const AICargoList *GetParam(ForceType<const AICargoList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AICargoList *)instance; }
-	template <> inline const AICargoList &GetParam(ForceType<const AICargoList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICargoList *)instance; }
-	template <> inline int Return<AICargoList *>(HSQUIRRELVM vm, AICargoList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "CargoList", res, NULL, DefSQDestructorCallback<AICargoList>, true); return 1; }
+	/* Allow ScriptCargoList to be used as Squirrel parameter */
+	template <> inline ScriptCargoList *GetParam(ForceType<ScriptCargoList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptCargoList *)instance; }
+	template <> inline ScriptCargoList &GetParam(ForceType<ScriptCargoList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCargoList *)instance; }
+	template <> inline const ScriptCargoList *GetParam(ForceType<const ScriptCargoList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptCargoList *)instance; }
+	template <> inline const ScriptCargoList &GetParam(ForceType<const ScriptCargoList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCargoList *)instance; }
+	template <> inline int Return<ScriptCargoList *>(HSQUIRRELVM vm, ScriptCargoList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "CargoList", res, NULL, DefSQDestructorCallback<ScriptCargoList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AICargoList, ST_AI>() { return "AICargoList"; }
+template <> const char *GetClassName<ScriptCargoList, ST_AI>() { return "AICargoList"; }
 
 void SQAICargoList_Register(Squirrel *engine)
 {
-	DefSQClass<AICargoList, ST_AI> SQAICargoList("AICargoList");
+	DefSQClass<ScriptCargoList, ST_AI> SQAICargoList("AICargoList");
 	SQAICargoList.PreRegister(engine, "AIList");
-	SQAICargoList.AddConstructor<void (AICargoList::*)(), 1>(engine, "x");
+	SQAICargoList.AddConstructor<void (ScriptCargoList::*)(), 1>(engine, "x");
 
 	SQAICargoList.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AICargoList_IndustryAccepting to be used as Squirrel parameter */
-	template <> inline AICargoList_IndustryAccepting *GetParam(ForceType<AICargoList_IndustryAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AICargoList_IndustryAccepting *)instance; }
-	template <> inline AICargoList_IndustryAccepting &GetParam(ForceType<AICargoList_IndustryAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICargoList_IndustryAccepting *)instance; }
-	template <> inline const AICargoList_IndustryAccepting *GetParam(ForceType<const AICargoList_IndustryAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AICargoList_IndustryAccepting *)instance; }
-	template <> inline const AICargoList_IndustryAccepting &GetParam(ForceType<const AICargoList_IndustryAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICargoList_IndustryAccepting *)instance; }
-	template <> inline int Return<AICargoList_IndustryAccepting *>(HSQUIRRELVM vm, AICargoList_IndustryAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "CargoList_IndustryAccepting", res, NULL, DefSQDestructorCallback<AICargoList_IndustryAccepting>, true); return 1; }
+	/* Allow ScriptCargoList_IndustryAccepting to be used as Squirrel parameter */
+	template <> inline ScriptCargoList_IndustryAccepting *GetParam(ForceType<ScriptCargoList_IndustryAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptCargoList_IndustryAccepting *)instance; }
+	template <> inline ScriptCargoList_IndustryAccepting &GetParam(ForceType<ScriptCargoList_IndustryAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCargoList_IndustryAccepting *)instance; }
+	template <> inline const ScriptCargoList_IndustryAccepting *GetParam(ForceType<const ScriptCargoList_IndustryAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptCargoList_IndustryAccepting *)instance; }
+	template <> inline const ScriptCargoList_IndustryAccepting &GetParam(ForceType<const ScriptCargoList_IndustryAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCargoList_IndustryAccepting *)instance; }
+	template <> inline int Return<ScriptCargoList_IndustryAccepting *>(HSQUIRRELVM vm, ScriptCargoList_IndustryAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "CargoList_IndustryAccepting", res, NULL, DefSQDestructorCallback<ScriptCargoList_IndustryAccepting>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AICargoList_IndustryAccepting, ST_AI>() { return "AICargoList_IndustryAccepting"; }
+template <> const char *GetClassName<ScriptCargoList_IndustryAccepting, ST_AI>() { return "AICargoList_IndustryAccepting"; }
 
 void SQAICargoList_IndustryAccepting_Register(Squirrel *engine)
 {
-	DefSQClass<AICargoList_IndustryAccepting, ST_AI> SQAICargoList_IndustryAccepting("AICargoList_IndustryAccepting");
+	DefSQClass<ScriptCargoList_IndustryAccepting, ST_AI> SQAICargoList_IndustryAccepting("AICargoList_IndustryAccepting");
 	SQAICargoList_IndustryAccepting.PreRegister(engine, "AIList");
-	SQAICargoList_IndustryAccepting.AddConstructor<void (AICargoList_IndustryAccepting::*)(IndustryID industry_id), 2>(engine, "xi");
+	SQAICargoList_IndustryAccepting.AddConstructor<void (ScriptCargoList_IndustryAccepting::*)(IndustryID industry_id), 2>(engine, "xi");
 
 	SQAICargoList_IndustryAccepting.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AICargoList_IndustryProducing to be used as Squirrel parameter */
-	template <> inline AICargoList_IndustryProducing *GetParam(ForceType<AICargoList_IndustryProducing *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AICargoList_IndustryProducing *)instance; }
-	template <> inline AICargoList_IndustryProducing &GetParam(ForceType<AICargoList_IndustryProducing &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICargoList_IndustryProducing *)instance; }
-	template <> inline const AICargoList_IndustryProducing *GetParam(ForceType<const AICargoList_IndustryProducing *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AICargoList_IndustryProducing *)instance; }
-	template <> inline const AICargoList_IndustryProducing &GetParam(ForceType<const AICargoList_IndustryProducing &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICargoList_IndustryProducing *)instance; }
-	template <> inline int Return<AICargoList_IndustryProducing *>(HSQUIRRELVM vm, AICargoList_IndustryProducing *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "CargoList_IndustryProducing", res, NULL, DefSQDestructorCallback<AICargoList_IndustryProducing>, true); return 1; }
+	/* Allow ScriptCargoList_IndustryProducing to be used as Squirrel parameter */
+	template <> inline ScriptCargoList_IndustryProducing *GetParam(ForceType<ScriptCargoList_IndustryProducing *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptCargoList_IndustryProducing *)instance; }
+	template <> inline ScriptCargoList_IndustryProducing &GetParam(ForceType<ScriptCargoList_IndustryProducing &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCargoList_IndustryProducing *)instance; }
+	template <> inline const ScriptCargoList_IndustryProducing *GetParam(ForceType<const ScriptCargoList_IndustryProducing *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptCargoList_IndustryProducing *)instance; }
+	template <> inline const ScriptCargoList_IndustryProducing &GetParam(ForceType<const ScriptCargoList_IndustryProducing &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCargoList_IndustryProducing *)instance; }
+	template <> inline int Return<ScriptCargoList_IndustryProducing *>(HSQUIRRELVM vm, ScriptCargoList_IndustryProducing *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "CargoList_IndustryProducing", res, NULL, DefSQDestructorCallback<ScriptCargoList_IndustryProducing>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AICargoList_IndustryProducing, ST_AI>() { return "AICargoList_IndustryProducing"; }
+template <> const char *GetClassName<ScriptCargoList_IndustryProducing, ST_AI>() { return "AICargoList_IndustryProducing"; }
 
 void SQAICargoList_IndustryProducing_Register(Squirrel *engine)
 {
-	DefSQClass<AICargoList_IndustryProducing, ST_AI> SQAICargoList_IndustryProducing("AICargoList_IndustryProducing");
+	DefSQClass<ScriptCargoList_IndustryProducing, ST_AI> SQAICargoList_IndustryProducing("AICargoList_IndustryProducing");
 	SQAICargoList_IndustryProducing.PreRegister(engine, "AIList");
-	SQAICargoList_IndustryProducing.AddConstructor<void (AICargoList_IndustryProducing::*)(IndustryID industry_id), 2>(engine, "xi");
+	SQAICargoList_IndustryProducing.AddConstructor<void (ScriptCargoList_IndustryProducing::*)(IndustryID industry_id), 2>(engine, "xi");
 
 	SQAICargoList_IndustryProducing.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AICargoList_StationAccepting to be used as Squirrel parameter */
-	template <> inline AICargoList_StationAccepting *GetParam(ForceType<AICargoList_StationAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AICargoList_StationAccepting *)instance; }
-	template <> inline AICargoList_StationAccepting &GetParam(ForceType<AICargoList_StationAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICargoList_StationAccepting *)instance; }
-	template <> inline const AICargoList_StationAccepting *GetParam(ForceType<const AICargoList_StationAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AICargoList_StationAccepting *)instance; }
-	template <> inline const AICargoList_StationAccepting &GetParam(ForceType<const AICargoList_StationAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICargoList_StationAccepting *)instance; }
-	template <> inline int Return<AICargoList_StationAccepting *>(HSQUIRRELVM vm, AICargoList_StationAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "CargoList_StationAccepting", res, NULL, DefSQDestructorCallback<AICargoList_StationAccepting>, true); return 1; }
+	/* Allow ScriptCargoList_StationAccepting to be used as Squirrel parameter */
+	template <> inline ScriptCargoList_StationAccepting *GetParam(ForceType<ScriptCargoList_StationAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptCargoList_StationAccepting *)instance; }
+	template <> inline ScriptCargoList_StationAccepting &GetParam(ForceType<ScriptCargoList_StationAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCargoList_StationAccepting *)instance; }
+	template <> inline const ScriptCargoList_StationAccepting *GetParam(ForceType<const ScriptCargoList_StationAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptCargoList_StationAccepting *)instance; }
+	template <> inline const ScriptCargoList_StationAccepting &GetParam(ForceType<const ScriptCargoList_StationAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCargoList_StationAccepting *)instance; }
+	template <> inline int Return<ScriptCargoList_StationAccepting *>(HSQUIRRELVM vm, ScriptCargoList_StationAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "CargoList_StationAccepting", res, NULL, DefSQDestructorCallback<ScriptCargoList_StationAccepting>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AICargoList_StationAccepting, ST_AI>() { return "AICargoList_StationAccepting"; }
+template <> const char *GetClassName<ScriptCargoList_StationAccepting, ST_AI>() { return "AICargoList_StationAccepting"; }
 
 void SQAICargoList_StationAccepting_Register(Squirrel *engine)
 {
-	DefSQClass<AICargoList_StationAccepting, ST_AI> SQAICargoList_StationAccepting("AICargoList_StationAccepting");
+	DefSQClass<ScriptCargoList_StationAccepting, ST_AI> SQAICargoList_StationAccepting("AICargoList_StationAccepting");
 	SQAICargoList_StationAccepting.PreRegister(engine, "AIList");
-	SQAICargoList_StationAccepting.AddConstructor<void (AICargoList_StationAccepting::*)(StationID station_id), 2>(engine, "xi");
+	SQAICargoList_StationAccepting.AddConstructor<void (ScriptCargoList_StationAccepting::*)(StationID station_id), 2>(engine, "xi");
 
 	SQAICargoList_StationAccepting.PostRegister(engine);
 }
--- a/src/ai/api/ai_company.hpp.sq
+++ b/src/ai/api/ai_company.hpp.sq
@@ -13,66 +13,66 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AICompany::Quarter GetParam(ForceType<AICompany::Quarter>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AICompany::Quarter)tmp; }
-	template <> inline int Return<AICompany::Quarter>(HSQUIRRELVM vm, AICompany::Quarter res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AICompany::CompanyID GetParam(ForceType<AICompany::CompanyID>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AICompany::CompanyID)tmp; }
-	template <> inline int Return<AICompany::CompanyID>(HSQUIRRELVM vm, AICompany::CompanyID res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AICompany::Gender GetParam(ForceType<AICompany::Gender>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AICompany::Gender)tmp; }
-	template <> inline int Return<AICompany::Gender>(HSQUIRRELVM vm, AICompany::Gender res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptCompany::Quarter GetParam(ForceType<ScriptCompany::Quarter>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptCompany::Quarter)tmp; }
+	template <> inline int Return<ScriptCompany::Quarter>(HSQUIRRELVM vm, ScriptCompany::Quarter res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptCompany::CompanyID GetParam(ForceType<ScriptCompany::CompanyID>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptCompany::CompanyID)tmp; }
+	template <> inline int Return<ScriptCompany::CompanyID>(HSQUIRRELVM vm, ScriptCompany::CompanyID res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptCompany::Gender GetParam(ForceType<ScriptCompany::Gender>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptCompany::Gender)tmp; }
+	template <> inline int Return<ScriptCompany::Gender>(HSQUIRRELVM vm, ScriptCompany::Gender res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AICompany to be used as Squirrel parameter */
-	template <> inline AICompany *GetParam(ForceType<AICompany *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AICompany *)instance; }
-	template <> inline AICompany &GetParam(ForceType<AICompany &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICompany *)instance; }
-	template <> inline const AICompany *GetParam(ForceType<const AICompany *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AICompany *)instance; }
-	template <> inline const AICompany &GetParam(ForceType<const AICompany &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AICompany *)instance; }
-	template <> inline int Return<AICompany *>(HSQUIRRELVM vm, AICompany *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Company", res, NULL, DefSQDestructorCallback<AICompany>, true); return 1; }
+	/* Allow ScriptCompany to be used as Squirrel parameter */
+	template <> inline ScriptCompany *GetParam(ForceType<ScriptCompany *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptCompany *)instance; }
+	template <> inline ScriptCompany &GetParam(ForceType<ScriptCompany &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCompany *)instance; }
+	template <> inline const ScriptCompany *GetParam(ForceType<const ScriptCompany *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptCompany *)instance; }
+	template <> inline const ScriptCompany &GetParam(ForceType<const ScriptCompany &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCompany *)instance; }
+	template <> inline int Return<ScriptCompany *>(HSQUIRRELVM vm, ScriptCompany *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Company", res, NULL, DefSQDestructorCallback<ScriptCompany>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AICompany, ST_AI>() { return "AICompany"; }
+template <> const char *GetClassName<ScriptCompany, ST_AI>() { return "AICompany"; }
 
 void SQAICompany_Register(Squirrel *engine)
 {
-	DefSQClass<AICompany, ST_AI> SQAICompany("AICompany");
+	DefSQClass<ScriptCompany, ST_AI> SQAICompany("AICompany");
 	SQAICompany.PreRegister(engine);
-	SQAICompany.AddConstructor<void (AICompany::*)(), 1>(engine, "x");
+	SQAICompany.AddConstructor<void (ScriptCompany::*)(), 1>(engine, "x");
 
-	SQAICompany.DefSQConst(engine, AICompany::CURRENT_QUARTER,  "CURRENT_QUARTER");
-	SQAICompany.DefSQConst(engine, AICompany::EARLIEST_QUARTER, "EARLIEST_QUARTER");
-	SQAICompany.DefSQConst(engine, AICompany::COMPANY_FIRST,    "COMPANY_FIRST");
-	SQAICompany.DefSQConst(engine, AICompany::COMPANY_LAST,     "COMPANY_LAST");
-	SQAICompany.DefSQConst(engine, AICompany::COMPANY_SELF,     "COMPANY_SELF");
-	SQAICompany.DefSQConst(engine, AICompany::COMPANY_INVALID,  "COMPANY_INVALID");
-	SQAICompany.DefSQConst(engine, AICompany::GENDER_MALE,      "GENDER_MALE");
-	SQAICompany.DefSQConst(engine, AICompany::GENDER_FEMALE,    "GENDER_FEMALE");
-	SQAICompany.DefSQConst(engine, AICompany::GENDER_INVALID,   "GENDER_INVALID");
+	SQAICompany.DefSQConst(engine, ScriptCompany::CURRENT_QUARTER,  "CURRENT_QUARTER");
+	SQAICompany.DefSQConst(engine, ScriptCompany::EARLIEST_QUARTER, "EARLIEST_QUARTER");
+	SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_FIRST,    "COMPANY_FIRST");
+	SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_LAST,     "COMPANY_LAST");
+	SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_SELF,     "COMPANY_SELF");
+	SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_INVALID,  "COMPANY_INVALID");
+	SQAICompany.DefSQConst(engine, ScriptCompany::GENDER_MALE,      "GENDER_MALE");
+	SQAICompany.DefSQConst(engine, ScriptCompany::GENDER_FEMALE,    "GENDER_FEMALE");
+	SQAICompany.DefSQConst(engine, ScriptCompany::GENDER_INVALID,   "GENDER_INVALID");
 
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::ResolveCompanyID,              "ResolveCompanyID",              2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::IsMine,                        "IsMine",                        2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::SetName,                       "SetName",                       2, "..");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetName,                       "GetName",                       2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentName,              "SetPresidentName",              2, "..");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetPresidentName,              "GetPresidentName",              2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentGender,            "SetPresidentGender",            2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetPresidentGender,            "GetPresidentGender",            2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::SetLoanAmount,                 "SetLoanAmount",                 2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::SetMinimumLoanAmount,          "SetMinimumLoanAmount",          2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetLoanAmount,                 "GetLoanAmount",                 1, ".");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetMaxLoanAmount,              "GetMaxLoanAmount",              1, ".");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetLoanInterval,               "GetLoanInterval",               1, ".");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetBankBalance,                "GetBankBalance",                2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetQuarterlyIncome,            "GetQuarterlyIncome",            3, ".ii");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetQuarterlyExpenses,          "GetQuarterlyExpenses",          3, ".ii");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetQuarterlyCargoDelivered,    "GetQuarterlyCargoDelivered",    3, ".ii");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetQuarterlyPerformanceRating, "GetQuarterlyPerformanceRating", 3, ".ii");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetQuarterlyCompanyValue,      "GetQuarterlyCompanyValue",      3, ".ii");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::BuildCompanyHQ,                "BuildCompanyHQ",                2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetCompanyHQ,                  "GetCompanyHQ",                  2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::SetAutoRenewStatus,            "SetAutoRenewStatus",            2, ".b");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetAutoRenewStatus,            "GetAutoRenewStatus",            2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::SetAutoRenewMonths,            "SetAutoRenewMonths",            2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetAutoRenewMonths,            "GetAutoRenewMonths",            2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::SetAutoRenewMoney,             "SetAutoRenewMoney",             2, ".i");
-	SQAICompany.DefSQStaticMethod(engine, &AICompany::GetAutoRenewMoney,             "GetAutoRenewMoney",             2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::ResolveCompanyID,              "ResolveCompanyID",              2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::IsMine,                        "IsMine",                        2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::SetName,                       "SetName",                       2, "..");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetName,                       "GetName",                       2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::SetPresidentName,              "SetPresidentName",              2, "..");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetPresidentName,              "GetPresidentName",              2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::SetPresidentGender,            "SetPresidentGender",            2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetPresidentGender,            "GetPresidentGender",            2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::SetLoanAmount,                 "SetLoanAmount",                 2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::SetMinimumLoanAmount,          "SetMinimumLoanAmount",          2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetLoanAmount,                 "GetLoanAmount",                 1, ".");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetMaxLoanAmount,              "GetMaxLoanAmount",              1, ".");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetLoanInterval,               "GetLoanInterval",               1, ".");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetBankBalance,                "GetBankBalance",                2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetQuarterlyIncome,            "GetQuarterlyIncome",            3, ".ii");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetQuarterlyExpenses,          "GetQuarterlyExpenses",          3, ".ii");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetQuarterlyCargoDelivered,    "GetQuarterlyCargoDelivered",    3, ".ii");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetQuarterlyPerformanceRating, "GetQuarterlyPerformanceRating", 3, ".ii");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetQuarterlyCompanyValue,      "GetQuarterlyCompanyValue",      3, ".ii");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::BuildCompanyHQ,                "BuildCompanyHQ",                2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetCompanyHQ,                  "GetCompanyHQ",                  2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::SetAutoRenewStatus,            "SetAutoRenewStatus",            2, ".b");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetAutoRenewStatus,            "GetAutoRenewStatus",            2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::SetAutoRenewMonths,            "SetAutoRenewMonths",            2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetAutoRenewMonths,            "GetAutoRenewMonths",            2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::SetAutoRenewMoney,             "SetAutoRenewMoney",             2, ".i");
+	SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::GetAutoRenewMoney,             "GetAutoRenewMoney",             2, ".i");
 
 	SQAICompany.PostRegister(engine);
 }
--- a/src/ai/api/ai_controller.hpp.sq
+++ b/src/ai/api/ai_controller.hpp.sq
@@ -9,23 +9,23 @@
 
 #include "../../script/api/script_controller.hpp"
 
-template <> const char *GetClassName<AIController, ST_AI>() { return "AIController"; }
+template <> const char *GetClassName<ScriptController, ST_AI>() { return "AIController"; }
 
 void SQAIController_Register(Squirrel *engine)
 {
-	DefSQClass<AIController, ST_AI> SQAIController("AIController");
+	DefSQClass<ScriptController, ST_AI> SQAIController("AIController");
 	SQAIController.PreRegister(engine);
 
-	SQAIController.DefSQStaticMethod(engine, &AIController::GetTick,           "GetTick",           1, ".");
-	SQAIController.DefSQStaticMethod(engine, &AIController::GetOpsTillSuspend, "GetOpsTillSuspend", 1, ".");
-	SQAIController.DefSQStaticMethod(engine, &AIController::SetCommandDelay,   "SetCommandDelay",   2, ".i");
-	SQAIController.DefSQStaticMethod(engine, &AIController::Sleep,             "Sleep",             2, ".i");
-	SQAIController.DefSQStaticMethod(engine, &AIController::GetSetting,        "GetSetting",        2, ".s");
-	SQAIController.DefSQStaticMethod(engine, &AIController::GetVersion,        "GetVersion",        1, ".");
-	SQAIController.DefSQStaticMethod(engine, &AIController::Print,             "Print",             3, ".bs");
+	SQAIController.DefSQStaticMethod(engine, &ScriptController::GetTick,           "GetTick",           1, ".");
+	SQAIController.DefSQStaticMethod(engine, &ScriptController::GetOpsTillSuspend, "GetOpsTillSuspend", 1, ".");
+	SQAIController.DefSQStaticMethod(engine, &ScriptController::SetCommandDelay,   "SetCommandDelay",   2, ".i");
+	SQAIController.DefSQStaticMethod(engine, &ScriptController::Sleep,             "Sleep",             2, ".i");
+	SQAIController.DefSQStaticMethod(engine, &ScriptController::GetSetting,        "GetSetting",        2, ".s");
+	SQAIController.DefSQStaticMethod(engine, &ScriptController::GetVersion,        "GetVersion",        1, ".");
+	SQAIController.DefSQStaticMethod(engine, &ScriptController::Print,             "Print",             3, ".bs");
 
 	SQAIController.PostRegister(engine);
 
 	/* Register the import statement to the global scope */
-	SQAIController.DefSQStaticMethod(engine, &AIController::Import,            "import",            4, ".ssi");
+	SQAIController.DefSQStaticMethod(engine, &ScriptController::Import,            "import",            4, ".ssi");
 }
--- a/src/ai/api/ai_date.hpp.sq
+++ b/src/ai/api/ai_date.hpp.sq
@@ -12,27 +12,27 @@
 #include "../../script/api/script_date.hpp"
 
 namespace SQConvert {
-	/* Allow AIDate to be used as Squirrel parameter */
-	template <> inline AIDate *GetParam(ForceType<AIDate *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIDate *)instance; }
-	template <> inline AIDate &GetParam(ForceType<AIDate &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIDate *)instance; }
-	template <> inline const AIDate *GetParam(ForceType<const AIDate *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIDate *)instance; }
-	template <> inline const AIDate &GetParam(ForceType<const AIDate &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIDate *)instance; }
-	template <> inline int Return<AIDate *>(HSQUIRRELVM vm, AIDate *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Date", res, NULL, DefSQDestructorCallback<AIDate>, true); return 1; }
+	/* Allow ScriptDate to be used as Squirrel parameter */
+	template <> inline ScriptDate *GetParam(ForceType<ScriptDate *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptDate *)instance; }
+	template <> inline ScriptDate &GetParam(ForceType<ScriptDate &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptDate *)instance; }
+	template <> inline const ScriptDate *GetParam(ForceType<const ScriptDate *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptDate *)instance; }
+	template <> inline const ScriptDate &GetParam(ForceType<const ScriptDate &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptDate *)instance; }
+	template <> inline int Return<ScriptDate *>(HSQUIRRELVM vm, ScriptDate *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Date", res, NULL, DefSQDestructorCallback<ScriptDate>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIDate, ST_AI>() { return "AIDate"; }
+template <> const char *GetClassName<ScriptDate, ST_AI>() { return "AIDate"; }
 
 void SQAIDate_Register(Squirrel *engine)
 {
-	DefSQClass<AIDate, ST_AI> SQAIDate("AIDate");
+	DefSQClass<ScriptDate, ST_AI> SQAIDate("AIDate");
 	SQAIDate.PreRegister(engine);
-	SQAIDate.AddConstructor<void (AIDate::*)(), 1>(engine, "x");
+	SQAIDate.AddConstructor<void (ScriptDate::*)(), 1>(engine, "x");
 
-	SQAIDate.DefSQStaticMethod(engine, &AIDate::GetCurrentDate, "GetCurrentDate", 1, ".");
-	SQAIDate.DefSQStaticMethod(engine, &AIDate::GetYear,        "GetYear",        2, ".i");
-	SQAIDate.DefSQStaticMethod(engine, &AIDate::GetMonth,       "GetMonth",       2, ".i");
-	SQAIDate.DefSQStaticMethod(engine, &AIDate::GetDayOfMonth,  "GetDayOfMonth",  2, ".i");
-	SQAIDate.DefSQStaticMethod(engine, &AIDate::GetDate,        "GetDate",        4, ".iii");
+	SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetCurrentDate, "GetCurrentDate", 1, ".");
+	SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetYear,        "GetYear",        2, ".i");
+	SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetMonth,       "GetMonth",       2, ".i");
+	SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetDayOfMonth,  "GetDayOfMonth",  2, ".i");
+	SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetDate,        "GetDate",        4, ".iii");
 
 	SQAIDate.PostRegister(engine);
 }
--- a/src/ai/api/ai_depotlist.hpp.sq
+++ b/src/ai/api/ai_depotlist.hpp.sq
@@ -12,21 +12,21 @@
 #include "../../script/api/script_depotlist.hpp"
 
 namespace SQConvert {
-	/* Allow AIDepotList to be used as Squirrel parameter */
-	template <> inline AIDepotList *GetParam(ForceType<AIDepotList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIDepotList *)instance; }
-	template <> inline AIDepotList &GetParam(ForceType<AIDepotList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIDepotList *)instance; }
-	template <> inline const AIDepotList *GetParam(ForceType<const AIDepotList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIDepotList *)instance; }
-	template <> inline const AIDepotList &GetParam(ForceType<const AIDepotList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIDepotList *)instance; }
-	template <> inline int Return<AIDepotList *>(HSQUIRRELVM vm, AIDepotList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "DepotList", res, NULL, DefSQDestructorCallback<AIDepotList>, true); return 1; }
+	/* Allow ScriptDepotList to be used as Squirrel parameter */
+	template <> inline ScriptDepotList *GetParam(ForceType<ScriptDepotList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptDepotList *)instance; }
+	template <> inline ScriptDepotList &GetParam(ForceType<ScriptDepotList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptDepotList *)instance; }
+	template <> inline const ScriptDepotList *GetParam(ForceType<const ScriptDepotList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptDepotList *)instance; }
+	template <> inline const ScriptDepotList &GetParam(ForceType<const ScriptDepotList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptDepotList *)instance; }
+	template <> inline int Return<ScriptDepotList *>(HSQUIRRELVM vm, ScriptDepotList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "DepotList", res, NULL, DefSQDestructorCallback<ScriptDepotList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIDepotList, ST_AI>() { return "AIDepotList"; }
+template <> const char *GetClassName<ScriptDepotList, ST_AI>() { return "AIDepotList"; }
 
 void SQAIDepotList_Register(Squirrel *engine)
 {
-	DefSQClass<AIDepotList, ST_AI> SQAIDepotList("AIDepotList");
+	DefSQClass<ScriptDepotList, ST_AI> SQAIDepotList("AIDepotList");
 	SQAIDepotList.PreRegister(engine, "AIList");
-	SQAIDepotList.AddConstructor<void (AIDepotList::*)(AITile::TransportType transport_type), 2>(engine, "xi");
+	SQAIDepotList.AddConstructor<void (ScriptDepotList::*)(ScriptTile::TransportType transport_type), 2>(engine, "xi");
 
 	SQAIDepotList.PostRegister(engine);
 }
--- a/src/ai/api/ai_engine.hpp.sq
+++ b/src/ai/api/ai_engine.hpp.sq
@@ -12,46 +12,46 @@
 #include "../../script/api/script_engine.hpp"
 
 namespace SQConvert {
-	/* Allow AIEngine to be used as Squirrel parameter */
-	template <> inline AIEngine *GetParam(ForceType<AIEngine *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEngine *)instance; }
-	template <> inline AIEngine &GetParam(ForceType<AIEngine &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEngine *)instance; }
-	template <> inline const AIEngine *GetParam(ForceType<const AIEngine *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEngine *)instance; }
-	template <> inline const AIEngine &GetParam(ForceType<const AIEngine &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEngine *)instance; }
-	template <> inline int Return<AIEngine *>(HSQUIRRELVM vm, AIEngine *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Engine", res, NULL, DefSQDestructorCallback<AIEngine>, true); return 1; }
+	/* Allow ScriptEngine to be used as Squirrel parameter */
+	template <> inline ScriptEngine *GetParam(ForceType<ScriptEngine *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEngine *)instance; }
+	template <> inline ScriptEngine &GetParam(ForceType<ScriptEngine &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEngine *)instance; }
+	template <> inline const ScriptEngine *GetParam(ForceType<const ScriptEngine *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEngine *)instance; }
+	template <> inline const ScriptEngine &GetParam(ForceType<const ScriptEngine &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEngine *)instance; }
+	template <> inline int Return<ScriptEngine *>(HSQUIRRELVM vm, ScriptEngine *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Engine", res, NULL, DefSQDestructorCallback<ScriptEngine>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEngine, ST_AI>() { return "AIEngine"; }
+template <> const char *GetClassName<ScriptEngine, ST_AI>() { return "AIEngine"; }
 
 void SQAIEngine_Register(Squirrel *engine)
 {
-	DefSQClass<AIEngine, ST_AI> SQAIEngine("AIEngine");
+	DefSQClass<ScriptEngine, ST_AI> SQAIEngine("AIEngine");
 	SQAIEngine.PreRegister(engine);
-	SQAIEngine.AddConstructor<void (AIEngine::*)(), 1>(engine, "x");
+	SQAIEngine.AddConstructor<void (ScriptEngine::*)(), 1>(engine, "x");
 
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::IsValidEngine,        "IsValidEngine",        2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::IsBuildable,          "IsBuildable",          2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetName,              "GetName",              2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetCargoType,         "GetCargoType",         2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::CanRefitCargo,        "CanRefitCargo",        3, ".ii");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::CanPullCargo,         "CanPullCargo",         3, ".ii");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetCapacity,          "GetCapacity",          2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetReliability,       "GetReliability",       2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetMaxSpeed,          "GetMaxSpeed",          2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetPrice,             "GetPrice",             2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetMaxAge,            "GetMaxAge",            2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetRunningCost,       "GetRunningCost",       2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetPower,             "GetPower",             2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetWeight,            "GetWeight",            2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetMaxTractiveEffort, "GetMaxTractiveEffort", 2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetDesignDate,        "GetDesignDate",        2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetVehicleType,       "GetVehicleType",       2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::IsWagon,              "IsWagon",              2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::CanRunOnRail,         "CanRunOnRail",         3, ".ii");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::HasPowerOnRail,       "HasPowerOnRail",       3, ".ii");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetRoadType,          "GetRoadType",          2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetRailType,          "GetRailType",          2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::IsArticulated,        "IsArticulated",        2, ".i");
-	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetPlaneType,         "GetPlaneType",         2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::IsValidEngine,        "IsValidEngine",        2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::IsBuildable,          "IsBuildable",          2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetName,              "GetName",              2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetCargoType,         "GetCargoType",         2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::CanRefitCargo,        "CanRefitCargo",        3, ".ii");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::CanPullCargo,         "CanPullCargo",         3, ".ii");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetCapacity,          "GetCapacity",          2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetReliability,       "GetReliability",       2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetMaxSpeed,          "GetMaxSpeed",          2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetPrice,             "GetPrice",             2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetMaxAge,            "GetMaxAge",            2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetRunningCost,       "GetRunningCost",       2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetPower,             "GetPower",             2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetWeight,            "GetWeight",            2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetMaxTractiveEffort, "GetMaxTractiveEffort", 2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetDesignDate,        "GetDesignDate",        2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetVehicleType,       "GetVehicleType",       2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::IsWagon,              "IsWagon",              2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::CanRunOnRail,         "CanRunOnRail",         3, ".ii");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::HasPowerOnRail,       "HasPowerOnRail",       3, ".ii");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetRoadType,          "GetRoadType",          2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetRailType,          "GetRailType",          2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::IsArticulated,        "IsArticulated",        2, ".i");
+	SQAIEngine.DefSQStaticMethod(engine, &ScriptEngine::GetPlaneType,         "GetPlaneType",         2, ".i");
 
 	SQAIEngine.PostRegister(engine);
 }
--- a/src/ai/api/ai_enginelist.hpp.sq
+++ b/src/ai/api/ai_enginelist.hpp.sq
@@ -12,21 +12,21 @@
 #include "../../script/api/script_enginelist.hpp"
 
 namespace SQConvert {
-	/* Allow AIEngineList to be used as Squirrel parameter */
-	template <> inline AIEngineList *GetParam(ForceType<AIEngineList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEngineList *)instance; }
-	template <> inline AIEngineList &GetParam(ForceType<AIEngineList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEngineList *)instance; }
-	template <> inline const AIEngineList *GetParam(ForceType<const AIEngineList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEngineList *)instance; }
-	template <> inline const AIEngineList &GetParam(ForceType<const AIEngineList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEngineList *)instance; }
-	template <> inline int Return<AIEngineList *>(HSQUIRRELVM vm, AIEngineList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EngineList", res, NULL, DefSQDestructorCallback<AIEngineList>, true); return 1; }
+	/* Allow ScriptEngineList to be used as Squirrel parameter */
+	template <> inline ScriptEngineList *GetParam(ForceType<ScriptEngineList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEngineList *)instance; }
+	template <> inline ScriptEngineList &GetParam(ForceType<ScriptEngineList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEngineList *)instance; }
+	template <> inline const ScriptEngineList *GetParam(ForceType<const ScriptEngineList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEngineList *)instance; }
+	template <> inline const ScriptEngineList &GetParam(ForceType<const ScriptEngineList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEngineList *)instance; }
+	template <> inline int Return<ScriptEngineList *>(HSQUIRRELVM vm, ScriptEngineList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EngineList", res, NULL, DefSQDestructorCallback<ScriptEngineList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEngineList, ST_AI>() { return "AIEngineList"; }
+template <> const char *GetClassName<ScriptEngineList, ST_AI>() { return "AIEngineList"; }
 
 void SQAIEngineList_Register(Squirrel *engine)
 {
-	DefSQClass<AIEngineList, ST_AI> SQAIEngineList("AIEngineList");
+	DefSQClass<ScriptEngineList, ST_AI> SQAIEngineList("AIEngineList");
 	SQAIEngineList.PreRegister(engine, "AIList");
-	SQAIEngineList.AddConstructor<void (AIEngineList::*)(AIVehicle::VehicleType vehicle_type), 2>(engine, "xi");
+	SQAIEngineList.AddConstructor<void (ScriptEngineList::*)(ScriptVehicle::VehicleType vehicle_type), 2>(engine, "xi");
 
 	SQAIEngineList.PostRegister(engine);
 }
--- a/src/ai/api/ai_error.hpp.sq
+++ b/src/ai/api/ai_error.hpp.sq
@@ -13,116 +13,116 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIError::ErrorCategories GetParam(ForceType<AIError::ErrorCategories>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIError::ErrorCategories)tmp; }
-	template <> inline int Return<AIError::ErrorCategories>(HSQUIRRELVM vm, AIError::ErrorCategories res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIError::ErrorMessages GetParam(ForceType<AIError::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIError::ErrorMessages)tmp; }
-	template <> inline int Return<AIError::ErrorMessages>(HSQUIRRELVM vm, AIError::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptError::ErrorCategories GetParam(ForceType<ScriptError::ErrorCategories>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptError::ErrorCategories)tmp; }
+	template <> inline int Return<ScriptError::ErrorCategories>(HSQUIRRELVM vm, ScriptError::ErrorCategories res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptError::ErrorMessages GetParam(ForceType<ScriptError::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptError::ErrorMessages)tmp; }
+	template <> inline int Return<ScriptError::ErrorMessages>(HSQUIRRELVM vm, ScriptError::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIError to be used as Squirrel parameter */
-	template <> inline AIError *GetParam(ForceType<AIError *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIError *)instance; }
-	template <> inline AIError &GetParam(ForceType<AIError &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIError *)instance; }
-	template <> inline const AIError *GetParam(ForceType<const AIError *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIError *)instance; }
-	template <> inline const AIError &GetParam(ForceType<const AIError &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIError *)instance; }
-	template <> inline int Return<AIError *>(HSQUIRRELVM vm, AIError *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Error", res, NULL, DefSQDestructorCallback<AIError>, true); return 1; }
+	/* Allow ScriptError to be used as Squirrel parameter */
+	template <> inline ScriptError *GetParam(ForceType<ScriptError *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptError *)instance; }
+	template <> inline ScriptError &GetParam(ForceType<ScriptError &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptError *)instance; }
+	template <> inline const ScriptError *GetParam(ForceType<const ScriptError *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptError *)instance; }
+	template <> inline const ScriptError &GetParam(ForceType<const ScriptError &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptError *)instance; }
+	template <> inline int Return<ScriptError *>(HSQUIRRELVM vm, ScriptError *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Error", res, NULL, DefSQDestructorCallback<ScriptError>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIError, ST_AI>() { return "AIError"; }
+template <> const char *GetClassName<ScriptError, ST_AI>() { return "AIError"; }
 
 void SQAIError_Register(Squirrel *engine)
 {
-	DefSQClass<AIError, ST_AI> SQAIError("AIError");
+	DefSQClass<ScriptError, ST_AI> SQAIError("AIError");
 	SQAIError.PreRegister(engine);
-	SQAIError.AddConstructor<void (AIError::*)(), 1>(engine, "x");
+	SQAIError.AddConstructor<void (ScriptError::*)(), 1>(engine, "x");
 
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_NONE,                     "ERR_CAT_NONE");
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_GENERAL,                  "ERR_CAT_GENERAL");
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_VEHICLE,                  "ERR_CAT_VEHICLE");
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_STATION,                  "ERR_CAT_STATION");
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_BRIDGE,                   "ERR_CAT_BRIDGE");
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_TUNNEL,                   "ERR_CAT_TUNNEL");
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_TILE,                     "ERR_CAT_TILE");
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_SIGN,                     "ERR_CAT_SIGN");
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_RAIL,                     "ERR_CAT_RAIL");
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_ROAD,                     "ERR_CAT_ROAD");
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_ORDER,                    "ERR_CAT_ORDER");
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_MARINE,                   "ERR_CAT_MARINE");
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_WAYPOINT,                 "ERR_CAT_WAYPOINT");
-	SQAIError.DefSQConst(engine, AIError::ERR_CAT_BIT_SIZE,                 "ERR_CAT_BIT_SIZE");
-	SQAIError.DefSQConst(engine, AIError::ERR_NONE,                         "ERR_NONE");
-	SQAIError.DefSQConst(engine, AIError::ERR_UNKNOWN,                      "ERR_UNKNOWN");
-	SQAIError.DefSQConst(engine, AIError::ERR_PRECONDITION_FAILED,          "ERR_PRECONDITION_FAILED");
-	SQAIError.DefSQConst(engine, AIError::ERR_PRECONDITION_STRING_TOO_LONG, "ERR_PRECONDITION_STRING_TOO_LONG");
-	SQAIError.DefSQConst(engine, AIError::ERR_NEWGRF_SUPPLIED_ERROR,        "ERR_NEWGRF_SUPPLIED_ERROR");
-	SQAIError.DefSQConst(engine, AIError::ERR_GENERAL_BASE,                 "ERR_GENERAL_BASE");
-	SQAIError.DefSQConst(engine, AIError::ERR_NOT_ENOUGH_CASH,              "ERR_NOT_ENOUGH_CASH");
-	SQAIError.DefSQConst(engine, AIError::ERR_LOCAL_AUTHORITY_REFUSES,      "ERR_LOCAL_AUTHORITY_REFUSES");
-	SQAIError.DefSQConst(engine, AIError::ERR_ALREADY_BUILT,                "ERR_ALREADY_BUILT");
-	SQAIError.DefSQConst(engine, AIError::ERR_AREA_NOT_CLEAR,               "ERR_AREA_NOT_CLEAR");
-	SQAIError.DefSQConst(engine, AIError::ERR_OWNED_BY_ANOTHER_COMPANY,     "ERR_OWNED_BY_ANOTHER_COMPANY");
-	SQAIError.DefSQConst(engine, AIError::ERR_NAME_IS_NOT_UNIQUE,           "ERR_NAME_IS_NOT_UNIQUE");
-	SQAIError.DefSQConst(engine, AIError::ERR_FLAT_LAND_REQUIRED,           "ERR_FLAT_LAND_REQUIRED");
-	SQAIError.DefSQConst(engine, AIError::ERR_LAND_SLOPED_WRONG,            "ERR_LAND_SLOPED_WRONG");
-	SQAIError.DefSQConst(engine, AIError::ERR_VEHICLE_IN_THE_WAY,           "ERR_VEHICLE_IN_THE_WAY");
-	SQAIError.DefSQConst(engine, AIError::ERR_SITE_UNSUITABLE,              "ERR_SITE_UNSUITABLE");
-	SQAIError.DefSQConst(engine, AIError::ERR_TOO_CLOSE_TO_EDGE,            "ERR_TOO_CLOSE_TO_EDGE");
-	SQAIError.DefSQConst(engine, AIError::ERR_STATION_TOO_SPREAD_OUT,       "ERR_STATION_TOO_SPREAD_OUT");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_NONE,                     "ERR_CAT_NONE");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_GENERAL,                  "ERR_CAT_GENERAL");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_VEHICLE,                  "ERR_CAT_VEHICLE");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_STATION,                  "ERR_CAT_STATION");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_BRIDGE,                   "ERR_CAT_BRIDGE");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_TUNNEL,                   "ERR_CAT_TUNNEL");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_TILE,                     "ERR_CAT_TILE");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_SIGN,                     "ERR_CAT_SIGN");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_RAIL,                     "ERR_CAT_RAIL");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_ROAD,                     "ERR_CAT_ROAD");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_ORDER,                    "ERR_CAT_ORDER");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_MARINE,                   "ERR_CAT_MARINE");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_WAYPOINT,                 "ERR_CAT_WAYPOINT");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_CAT_BIT_SIZE,                 "ERR_CAT_BIT_SIZE");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_NONE,                         "ERR_NONE");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_UNKNOWN,                      "ERR_UNKNOWN");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_PRECONDITION_FAILED,          "ERR_PRECONDITION_FAILED");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG, "ERR_PRECONDITION_STRING_TOO_LONG");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_NEWGRF_SUPPLIED_ERROR,        "ERR_NEWGRF_SUPPLIED_ERROR");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_GENERAL_BASE,                 "ERR_GENERAL_BASE");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_NOT_ENOUGH_CASH,              "ERR_NOT_ENOUGH_CASH");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_LOCAL_AUTHORITY_REFUSES,      "ERR_LOCAL_AUTHORITY_REFUSES");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_ALREADY_BUILT,                "ERR_ALREADY_BUILT");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_AREA_NOT_CLEAR,               "ERR_AREA_NOT_CLEAR");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY,     "ERR_OWNED_BY_ANOTHER_COMPANY");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_NAME_IS_NOT_UNIQUE,           "ERR_NAME_IS_NOT_UNIQUE");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_FLAT_LAND_REQUIRED,           "ERR_FLAT_LAND_REQUIRED");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_LAND_SLOPED_WRONG,            "ERR_LAND_SLOPED_WRONG");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_VEHICLE_IN_THE_WAY,           "ERR_VEHICLE_IN_THE_WAY");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_SITE_UNSUITABLE,              "ERR_SITE_UNSUITABLE");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_TOO_CLOSE_TO_EDGE,            "ERR_TOO_CLOSE_TO_EDGE");
+	SQAIError.DefSQConst(engine, ScriptError::ERR_STATION_TOO_SPREAD_OUT,       "ERR_STATION_TOO_SPREAD_OUT");
 
-	AIError::RegisterErrorMap(STR_ERROR_NOT_ENOUGH_CASH_REQUIRES_CURRENCY,          AIError::ERR_NOT_ENOUGH_CASH);
-	AIError::RegisterErrorMap(STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS,      AIError::ERR_LOCAL_AUTHORITY_REFUSES);
-	AIError::RegisterErrorMap(STR_ERROR_ALREADY_BUILT,                              AIError::ERR_ALREADY_BUILT);
-	AIError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST,                 AIError::ERR_ALREADY_BUILT);
-	AIError::RegisterErrorMap(STR_ERROR_BUILDING_MUST_BE_DEMOLISHED,                AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST,                 AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_RAILROAD,                     AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_AIRPORT_FIRST,                AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_CARGO_TRAM_STATION_FIRST,     AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_TRUCK_STATION_FIRST,          AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_PASSENGER_TRAM_STATION_FIRST, AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_BUS_STATION_FIRST,            AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_BUOY_IN_THE_WAY,                            AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_DOCK_FIRST,                   AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_GENERIC_OBJECT_IN_THE_WAY,                  AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_COMPANY_HEADQUARTERS_IN,                    AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_OBJECT_IN_THE_WAY,                          AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_MUST_REMOVE_ROAD_FIRST,                     AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_MUST_REMOVE_RAILROAD_TRACK,                 AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST,                 AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_TUNNEL_FIRST,                 AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_EXCAVATION_WOULD_DAMAGE,                    AIError::ERR_AREA_NOT_CLEAR);
-	AIError::RegisterErrorMap(STR_ERROR_AREA_IS_OWNED_BY_ANOTHER,                   AIError::ERR_OWNED_BY_ANOTHER_COMPANY);
-	AIError::RegisterErrorMap(STR_ERROR_OWNED_BY,                                   AIError::ERR_OWNED_BY_ANOTHER_COMPANY);
-	AIError::RegisterErrorMap(STR_ERROR_NAME_MUST_BE_UNIQUE,                        AIError::ERR_NAME_IS_NOT_UNIQUE);
-	AIError::RegisterErrorMap(STR_ERROR_FLAT_LAND_REQUIRED,                         AIError::ERR_FLAT_LAND_REQUIRED);
-	AIError::RegisterErrorMap(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION,             AIError::ERR_LAND_SLOPED_WRONG);
-	AIError::RegisterErrorMap(STR_ERROR_TRAIN_IN_THE_WAY,                           AIError::ERR_VEHICLE_IN_THE_WAY);
-	AIError::RegisterErrorMap(STR_ERROR_ROAD_VEHICLE_IN_THE_WAY,                    AIError::ERR_VEHICLE_IN_THE_WAY);
-	AIError::RegisterErrorMap(STR_ERROR_SHIP_IN_THE_WAY,                            AIError::ERR_VEHICLE_IN_THE_WAY);
-	AIError::RegisterErrorMap(STR_ERROR_AIRCRAFT_IN_THE_WAY,                        AIError::ERR_VEHICLE_IN_THE_WAY);
-	AIError::RegisterErrorMap(STR_ERROR_SITE_UNSUITABLE,                            AIError::ERR_SITE_UNSUITABLE);
-	AIError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_EDGE_OF_MAP,                   AIError::ERR_TOO_CLOSE_TO_EDGE);
-	AIError::RegisterErrorMap(STR_ERROR_STATION_TOO_SPREAD_OUT,                     AIError::ERR_STATION_TOO_SPREAD_OUT);
+	ScriptError::RegisterErrorMap(STR_ERROR_NOT_ENOUGH_CASH_REQUIRES_CURRENCY,          ScriptError::ERR_NOT_ENOUGH_CASH);
+	ScriptError::RegisterErrorMap(STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS,      ScriptError::ERR_LOCAL_AUTHORITY_REFUSES);
+	ScriptError::RegisterErrorMap(STR_ERROR_ALREADY_BUILT,                              ScriptError::ERR_ALREADY_BUILT);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST,                 ScriptError::ERR_ALREADY_BUILT);
+	ScriptError::RegisterErrorMap(STR_ERROR_BUILDING_MUST_BE_DEMOLISHED,                ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST,                 ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_RAILROAD,                     ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_AIRPORT_FIRST,                ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_CARGO_TRAM_STATION_FIRST,     ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_TRUCK_STATION_FIRST,          ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_PASSENGER_TRAM_STATION_FIRST, ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_BUS_STATION_FIRST,            ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_BUOY_IN_THE_WAY,                            ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_DOCK_FIRST,                   ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_GENERIC_OBJECT_IN_THE_WAY,                  ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_COMPANY_HEADQUARTERS_IN,                    ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_OBJECT_IN_THE_WAY,                          ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_REMOVE_ROAD_FIRST,                     ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_REMOVE_RAILROAD_TRACK,                 ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST,                 ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_DEMOLISH_TUNNEL_FIRST,                 ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_EXCAVATION_WOULD_DAMAGE,                    ScriptError::ERR_AREA_NOT_CLEAR);
+	ScriptError::RegisterErrorMap(STR_ERROR_AREA_IS_OWNED_BY_ANOTHER,                   ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY);
+	ScriptError::RegisterErrorMap(STR_ERROR_OWNED_BY,                                   ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY);
+	ScriptError::RegisterErrorMap(STR_ERROR_NAME_MUST_BE_UNIQUE,                        ScriptError::ERR_NAME_IS_NOT_UNIQUE);
+	ScriptError::RegisterErrorMap(STR_ERROR_FLAT_LAND_REQUIRED,                         ScriptError::ERR_FLAT_LAND_REQUIRED);
+	ScriptError::RegisterErrorMap(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION,             ScriptError::ERR_LAND_SLOPED_WRONG);
+	ScriptError::RegisterErrorMap(STR_ERROR_TRAIN_IN_THE_WAY,                           ScriptError::ERR_VEHICLE_IN_THE_WAY);
+	ScriptError::RegisterErrorMap(STR_ERROR_ROAD_VEHICLE_IN_THE_WAY,                    ScriptError::ERR_VEHICLE_IN_THE_WAY);
+	ScriptError::RegisterErrorMap(STR_ERROR_SHIP_IN_THE_WAY,                            ScriptError::ERR_VEHICLE_IN_THE_WAY);
+	ScriptError::RegisterErrorMap(STR_ERROR_AIRCRAFT_IN_THE_WAY,                        ScriptError::ERR_VEHICLE_IN_THE_WAY);
+	ScriptError::RegisterErrorMap(STR_ERROR_SITE_UNSUITABLE,                            ScriptError::ERR_SITE_UNSUITABLE);
+	ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_EDGE_OF_MAP,                   ScriptError::ERR_TOO_CLOSE_TO_EDGE);
+	ScriptError::RegisterErrorMap(STR_ERROR_STATION_TOO_SPREAD_OUT,                     ScriptError::ERR_STATION_TOO_SPREAD_OUT);
 
-	AIError::RegisterErrorMapString(AIError::ERR_NONE,                         "ERR_NONE");
-	AIError::RegisterErrorMapString(AIError::ERR_UNKNOWN,                      "ERR_UNKNOWN");
-	AIError::RegisterErrorMapString(AIError::ERR_PRECONDITION_FAILED,          "ERR_PRECONDITION_FAILED");
-	AIError::RegisterErrorMapString(AIError::ERR_PRECONDITION_STRING_TOO_LONG, "ERR_PRECONDITION_STRING_TOO_LONG");
-	AIError::RegisterErrorMapString(AIError::ERR_NEWGRF_SUPPLIED_ERROR,        "ERR_NEWGRF_SUPPLIED_ERROR");
-	AIError::RegisterErrorMapString(AIError::ERR_NOT_ENOUGH_CASH,              "ERR_NOT_ENOUGH_CASH");
-	AIError::RegisterErrorMapString(AIError::ERR_LOCAL_AUTHORITY_REFUSES,      "ERR_LOCAL_AUTHORITY_REFUSES");
-	AIError::RegisterErrorMapString(AIError::ERR_ALREADY_BUILT,                "ERR_ALREADY_BUILT");
-	AIError::RegisterErrorMapString(AIError::ERR_AREA_NOT_CLEAR,               "ERR_AREA_NOT_CLEAR");
-	AIError::RegisterErrorMapString(AIError::ERR_OWNED_BY_ANOTHER_COMPANY,     "ERR_OWNED_BY_ANOTHER_COMPANY");
-	AIError::RegisterErrorMapString(AIError::ERR_NAME_IS_NOT_UNIQUE,           "ERR_NAME_IS_NOT_UNIQUE");
-	AIError::RegisterErrorMapString(AIError::ERR_FLAT_LAND_REQUIRED,           "ERR_FLAT_LAND_REQUIRED");
-	AIError::RegisterErrorMapString(AIError::ERR_LAND_SLOPED_WRONG,            "ERR_LAND_SLOPED_WRONG");
-	AIError::RegisterErrorMapString(AIError::ERR_VEHICLE_IN_THE_WAY,           "ERR_VEHICLE_IN_THE_WAY");
-	AIError::RegisterErrorMapString(AIError::ERR_SITE_UNSUITABLE,              "ERR_SITE_UNSUITABLE");
-	AIError::RegisterErrorMapString(AIError::ERR_TOO_CLOSE_TO_EDGE,            "ERR_TOO_CLOSE_TO_EDGE");
-	AIError::RegisterErrorMapString(AIError::ERR_STATION_TOO_SPREAD_OUT,       "ERR_STATION_TOO_SPREAD_OUT");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_NONE,                         "ERR_NONE");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_UNKNOWN,                      "ERR_UNKNOWN");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_PRECONDITION_FAILED,          "ERR_PRECONDITION_FAILED");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_PRECONDITION_STRING_TOO_LONG, "ERR_PRECONDITION_STRING_TOO_LONG");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_NEWGRF_SUPPLIED_ERROR,        "ERR_NEWGRF_SUPPLIED_ERROR");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_NOT_ENOUGH_CASH,              "ERR_NOT_ENOUGH_CASH");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_LOCAL_AUTHORITY_REFUSES,      "ERR_LOCAL_AUTHORITY_REFUSES");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_ALREADY_BUILT,                "ERR_ALREADY_BUILT");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_AREA_NOT_CLEAR,               "ERR_AREA_NOT_CLEAR");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY,     "ERR_OWNED_BY_ANOTHER_COMPANY");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_NAME_IS_NOT_UNIQUE,           "ERR_NAME_IS_NOT_UNIQUE");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_FLAT_LAND_REQUIRED,           "ERR_FLAT_LAND_REQUIRED");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_LAND_SLOPED_WRONG,            "ERR_LAND_SLOPED_WRONG");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_VEHICLE_IN_THE_WAY,           "ERR_VEHICLE_IN_THE_WAY");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_SITE_UNSUITABLE,              "ERR_SITE_UNSUITABLE");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_TOO_CLOSE_TO_EDGE,            "ERR_TOO_CLOSE_TO_EDGE");
+	ScriptError::RegisterErrorMapString(ScriptError::ERR_STATION_TOO_SPREAD_OUT,       "ERR_STATION_TOO_SPREAD_OUT");
 
-	SQAIError.DefSQStaticMethod(engine, &AIError::GetErrorCategory,   "GetErrorCategory",   1, ".");
-	SQAIError.DefSQStaticMethod(engine, &AIError::GetLastError,       "GetLastError",       1, ".");
-	SQAIError.DefSQStaticMethod(engine, &AIError::GetLastErrorString, "GetLastErrorString", 1, ".");
+	SQAIError.DefSQStaticMethod(engine, &ScriptError::GetErrorCategory,   "GetErrorCategory",   1, ".");
+	SQAIError.DefSQStaticMethod(engine, &ScriptError::GetLastError,       "GetLastError",       1, ".");
+	SQAIError.DefSQStaticMethod(engine, &ScriptError::GetLastErrorString, "GetLastErrorString", 1, ".");
 
 	SQAIError.PostRegister(engine);
 }
--- a/src/ai/api/ai_event.hpp.sq
+++ b/src/ai/api/ai_event.hpp.sq
@@ -13,73 +13,73 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIEvent::AIEventType GetParam(ForceType<AIEvent::AIEventType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIEvent::AIEventType)tmp; }
-	template <> inline int Return<AIEvent::AIEventType>(HSQUIRRELVM vm, AIEvent::AIEventType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptEvent::ScriptEventType GetParam(ForceType<ScriptEvent::ScriptEventType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptEvent::ScriptEventType)tmp; }
+	template <> inline int Return<ScriptEvent::ScriptEventType>(HSQUIRRELVM vm, ScriptEvent::ScriptEventType res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIEvent to be used as Squirrel parameter */
-	template <> inline AIEvent *GetParam(ForceType<AIEvent *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEvent *)instance; }
-	template <> inline AIEvent &GetParam(ForceType<AIEvent &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEvent *)instance; }
-	template <> inline const AIEvent *GetParam(ForceType<const AIEvent *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEvent *)instance; }
-	template <> inline const AIEvent &GetParam(ForceType<const AIEvent &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEvent *)instance; }
-	template <> inline int Return<AIEvent *>(HSQUIRRELVM vm, AIEvent *res) { if (res == NULL) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, "Event", res, NULL, DefSQDestructorCallback<AIEvent>, true); return 1; }
+	/* Allow ScriptEvent to be used as Squirrel parameter */
+	template <> inline ScriptEvent *GetParam(ForceType<ScriptEvent *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEvent *)instance; }
+	template <> inline ScriptEvent &GetParam(ForceType<ScriptEvent &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEvent *)instance; }
+	template <> inline const ScriptEvent *GetParam(ForceType<const ScriptEvent *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEvent *)instance; }
+	template <> inline const ScriptEvent &GetParam(ForceType<const ScriptEvent &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEvent *)instance; }
+	template <> inline int Return<ScriptEvent *>(HSQUIRRELVM vm, ScriptEvent *res) { if (res == NULL) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, "Event", res, NULL, DefSQDestructorCallback<ScriptEvent>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEvent, ST_AI>() { return "AIEvent"; }
+template <> const char *GetClassName<ScriptEvent, ST_AI>() { return "AIEvent"; }
 
 void SQAIEvent_Register(Squirrel *engine)
 {
-	DefSQClass<AIEvent, ST_AI> SQAIEvent("AIEvent");
+	DefSQClass<ScriptEvent, ST_AI> SQAIEvent("AIEvent");
 	SQAIEvent.PreRegister(engine);
-	SQAIEvent.AddConstructor<void (AIEvent::*)(AIEvent::AIEventType type), 2>(engine, "xi");
+	SQAIEvent.AddConstructor<void (ScriptEvent::*)(ScriptEvent::ScriptEventType type), 2>(engine, "xi");
 
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_INVALID,                     "AI_ET_INVALID");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_TEST,                        "AI_ET_TEST");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_SUBSIDY_OFFER,               "AI_ET_SUBSIDY_OFFER");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_SUBSIDY_OFFER_EXPIRED,       "AI_ET_SUBSIDY_OFFER_EXPIRED");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_SUBSIDY_AWARDED,             "AI_ET_SUBSIDY_AWARDED");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_SUBSIDY_EXPIRED,             "AI_ET_SUBSIDY_EXPIRED");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_ENGINE_PREVIEW,              "AI_ET_ENGINE_PREVIEW");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_COMPANY_NEW,                 "AI_ET_COMPANY_NEW");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_COMPANY_IN_TROUBLE,          "AI_ET_COMPANY_IN_TROUBLE");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_COMPANY_ASK_MERGER,          "AI_ET_COMPANY_ASK_MERGER");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_COMPANY_MERGER,              "AI_ET_COMPANY_MERGER");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_COMPANY_BANKRUPT,            "AI_ET_COMPANY_BANKRUPT");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_VEHICLE_CRASHED,             "AI_ET_VEHICLE_CRASHED");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_VEHICLE_LOST,                "AI_ET_VEHICLE_LOST");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_VEHICLE_WAITING_IN_DEPOT,    "AI_ET_VEHICLE_WAITING_IN_DEPOT");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_VEHICLE_UNPROFITABLE,        "AI_ET_VEHICLE_UNPROFITABLE");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_INDUSTRY_OPEN,               "AI_ET_INDUSTRY_OPEN");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_INDUSTRY_CLOSE,              "AI_ET_INDUSTRY_CLOSE");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_ENGINE_AVAILABLE,            "AI_ET_ENGINE_AVAILABLE");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_STATION_FIRST_VEHICLE,       "AI_ET_STATION_FIRST_VEHICLE");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_DISASTER_ZEPPELINER_CRASHED, "AI_ET_DISASTER_ZEPPELINER_CRASHED");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_DISASTER_ZEPPELINER_CLEARED, "AI_ET_DISASTER_ZEPPELINER_CLEARED");
-	SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_TOWN_FOUNDED,                "AI_ET_TOWN_FOUNDED");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_INVALID,                     "AI_ET_INVALID");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_TEST,                        "AI_ET_TEST");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_SUBSIDY_OFFER,               "AI_ET_SUBSIDY_OFFER");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_SUBSIDY_OFFER_EXPIRED,       "AI_ET_SUBSIDY_OFFER_EXPIRED");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_SUBSIDY_AWARDED,             "AI_ET_SUBSIDY_AWARDED");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_SUBSIDY_EXPIRED,             "AI_ET_SUBSIDY_EXPIRED");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_ENGINE_PREVIEW,              "AI_ET_ENGINE_PREVIEW");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_COMPANY_NEW,                 "AI_ET_COMPANY_NEW");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_COMPANY_IN_TROUBLE,          "AI_ET_COMPANY_IN_TROUBLE");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_COMPANY_ASK_MERGER,          "AI_ET_COMPANY_ASK_MERGER");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_COMPANY_MERGER,              "AI_ET_COMPANY_MERGER");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_COMPANY_BANKRUPT,            "AI_ET_COMPANY_BANKRUPT");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_VEHICLE_CRASHED,             "AI_ET_VEHICLE_CRASHED");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_VEHICLE_LOST,                "AI_ET_VEHICLE_LOST");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_VEHICLE_WAITING_IN_DEPOT,    "AI_ET_VEHICLE_WAITING_IN_DEPOT");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_VEHICLE_UNPROFITABLE,        "AI_ET_VEHICLE_UNPROFITABLE");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_INDUSTRY_OPEN,               "AI_ET_INDUSTRY_OPEN");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_INDUSTRY_CLOSE,              "AI_ET_INDUSTRY_CLOSE");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_ENGINE_AVAILABLE,            "AI_ET_ENGINE_AVAILABLE");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_STATION_FIRST_VEHICLE,       "AI_ET_STATION_FIRST_VEHICLE");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_DISASTER_ZEPPELINER_CRASHED, "AI_ET_DISASTER_ZEPPELINER_CRASHED");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_DISASTER_ZEPPELINER_CLEARED, "AI_ET_DISASTER_ZEPPELINER_CLEARED");
+	SQAIEvent.DefSQConst(engine, ScriptEvent::AI_ET_TOWN_FOUNDED,                "AI_ET_TOWN_FOUNDED");
 
-	SQAIEvent.DefSQMethod(engine, &AIEvent::GetEventType, "GetEventType", 1, "x");
+	SQAIEvent.DefSQMethod(engine, &ScriptEvent::GetEventType, "GetEventType", 1, "x");
 
 	SQAIEvent.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventController to be used as Squirrel parameter */
-	template <> inline AIEventController *GetParam(ForceType<AIEventController *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventController *)instance; }
-	template <> inline AIEventController &GetParam(ForceType<AIEventController &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventController *)instance; }
-	template <> inline const AIEventController *GetParam(ForceType<const AIEventController *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventController *)instance; }
-	template <> inline const AIEventController &GetParam(ForceType<const AIEventController &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventController *)instance; }
-	template <> inline int Return<AIEventController *>(HSQUIRRELVM vm, AIEventController *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventController", res, NULL, DefSQDestructorCallback<AIEventController>, true); return 1; }
+	/* Allow ScriptEventController to be used as Squirrel parameter */
+	template <> inline ScriptEventController *GetParam(ForceType<ScriptEventController *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventController *)instance; }
+	template <> inline ScriptEventController &GetParam(ForceType<ScriptEventController &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventController *)instance; }
+	template <> inline const ScriptEventController *GetParam(ForceType<const ScriptEventController *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventController *)instance; }
+	template <> inline const ScriptEventController &GetParam(ForceType<const ScriptEventController &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventController *)instance; }
+	template <> inline int Return<ScriptEventController *>(HSQUIRRELVM vm, ScriptEventController *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventController", res, NULL, DefSQDestructorCallback<ScriptEventController>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventController, ST_AI>() { return "AIEventController"; }
+template <> const char *GetClassName<ScriptEventController, ST_AI>() { return "AIEventController"; }
 
 void SQAIEventController_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventController, ST_AI> SQAIEventController("AIEventController");
+	DefSQClass<ScriptEventController, ST_AI> SQAIEventController("AIEventController");
 	SQAIEventController.PreRegister(engine);
-	SQAIEventController.AddConstructor<void (AIEventController::*)(), 1>(engine, "x");
+	SQAIEventController.AddConstructor<void (ScriptEventController::*)(), 1>(engine, "x");
 
-	SQAIEventController.DefSQStaticMethod(engine, &AIEventController::IsEventWaiting, "IsEventWaiting", 1, ".");
-	SQAIEventController.DefSQStaticMethod(engine, &AIEventController::GetNextEvent,   "GetNextEvent",   1, ".");
+	SQAIEventController.DefSQStaticMethod(engine, &ScriptEventController::IsEventWaiting, "IsEventWaiting", 1, ".");
+	SQAIEventController.DefSQStaticMethod(engine, &ScriptEventController::GetNextEvent,   "GetNextEvent",   1, ".");
 
 	SQAIEventController.PostRegister(engine);
 }
--- a/src/ai/api/ai_event_types.hpp.sq
+++ b/src/ai/api/ai_event_types.hpp.sq
@@ -13,507 +13,507 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIEventVehicleCrashed::CrashReason GetParam(ForceType<AIEventVehicleCrashed::CrashReason>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIEventVehicleCrashed::CrashReason)tmp; }
-	template <> inline int Return<AIEventVehicleCrashed::CrashReason>(HSQUIRRELVM vm, AIEventVehicleCrashed::CrashReason res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptEventVehicleCrashed::CrashReason GetParam(ForceType<ScriptEventVehicleCrashed::CrashReason>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptEventVehicleCrashed::CrashReason)tmp; }
+	template <> inline int Return<ScriptEventVehicleCrashed::CrashReason>(HSQUIRRELVM vm, ScriptEventVehicleCrashed::CrashReason res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIEventVehicleCrashed to be used as Squirrel parameter */
-	template <> inline AIEventVehicleCrashed *GetParam(ForceType<AIEventVehicleCrashed *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventVehicleCrashed *)instance; }
-	template <> inline AIEventVehicleCrashed &GetParam(ForceType<AIEventVehicleCrashed &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventVehicleCrashed *)instance; }
-	template <> inline const AIEventVehicleCrashed *GetParam(ForceType<const AIEventVehicleCrashed *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventVehicleCrashed *)instance; }
-	template <> inline const AIEventVehicleCrashed &GetParam(ForceType<const AIEventVehicleCrashed &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventVehicleCrashed *)instance; }
-	template <> inline int Return<AIEventVehicleCrashed *>(HSQUIRRELVM vm, AIEventVehicleCrashed *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventVehicleCrashed", res, NULL, DefSQDestructorCallback<AIEventVehicleCrashed>, true); return 1; }
+	/* Allow ScriptEventVehicleCrashed to be used as Squirrel parameter */
+	template <> inline ScriptEventVehicleCrashed *GetParam(ForceType<ScriptEventVehicleCrashed *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventVehicleCrashed *)instance; }
+	template <> inline ScriptEventVehicleCrashed &GetParam(ForceType<ScriptEventVehicleCrashed &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventVehicleCrashed *)instance; }
+	template <> inline const ScriptEventVehicleCrashed *GetParam(ForceType<const ScriptEventVehicleCrashed *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventVehicleCrashed *)instance; }
+	template <> inline const ScriptEventVehicleCrashed &GetParam(ForceType<const ScriptEventVehicleCrashed &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventVehicleCrashed *)instance; }
+	template <> inline int Return<ScriptEventVehicleCrashed *>(HSQUIRRELVM vm, ScriptEventVehicleCrashed *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventVehicleCrashed", res, NULL, DefSQDestructorCallback<ScriptEventVehicleCrashed>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventVehicleCrashed, ST_AI>() { return "AIEventVehicleCrashed"; }
+template <> const char *GetClassName<ScriptEventVehicleCrashed, ST_AI>() { return "AIEventVehicleCrashed"; }
 
 void SQAIEventVehicleCrashed_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventVehicleCrashed, ST_AI> SQAIEventVehicleCrashed("AIEventVehicleCrashed");
+	DefSQClass<ScriptEventVehicleCrashed, ST_AI> SQAIEventVehicleCrashed("AIEventVehicleCrashed");
 	SQAIEventVehicleCrashed.PreRegister(engine, "AIEvent");
 
-	SQAIEventVehicleCrashed.DefSQConst(engine, AIEventVehicleCrashed::CRASH_TRAIN,               "CRASH_TRAIN");
-	SQAIEventVehicleCrashed.DefSQConst(engine, AIEventVehicleCrashed::CRASH_RV_LEVEL_CROSSING,   "CRASH_RV_LEVEL_CROSSING");
-	SQAIEventVehicleCrashed.DefSQConst(engine, AIEventVehicleCrashed::CRASH_RV_UFO,              "CRASH_RV_UFO");
-	SQAIEventVehicleCrashed.DefSQConst(engine, AIEventVehicleCrashed::CRASH_PLANE_LANDING,       "CRASH_PLANE_LANDING");
-	SQAIEventVehicleCrashed.DefSQConst(engine, AIEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT, "CRASH_AIRCRAFT_NO_AIRPORT");
-	SQAIEventVehicleCrashed.DefSQConst(engine, AIEventVehicleCrashed::CRASH_FLOODED,             "CRASH_FLOODED");
+	SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_TRAIN,               "CRASH_TRAIN");
+	SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_RV_LEVEL_CROSSING,   "CRASH_RV_LEVEL_CROSSING");
+	SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_RV_UFO,              "CRASH_RV_UFO");
+	SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_PLANE_LANDING,       "CRASH_PLANE_LANDING");
+	SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT, "CRASH_AIRCRAFT_NO_AIRPORT");
+	SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_FLOODED,             "CRASH_FLOODED");
 
-	SQAIEventVehicleCrashed.DefSQStaticMethod(engine, &AIEventVehicleCrashed::Convert, "Convert", 2, ".x");
+	SQAIEventVehicleCrashed.DefSQStaticMethod(engine, &ScriptEventVehicleCrashed::Convert, "Convert", 2, ".x");
 
-	SQAIEventVehicleCrashed.DefSQMethod(engine, &AIEventVehicleCrashed::GetVehicleID,   "GetVehicleID",   1, "x");
-	SQAIEventVehicleCrashed.DefSQMethod(engine, &AIEventVehicleCrashed::GetCrashSite,   "GetCrashSite",   1, "x");
-	SQAIEventVehicleCrashed.DefSQMethod(engine, &AIEventVehicleCrashed::GetCrashReason, "GetCrashReason", 1, "x");
+	SQAIEventVehicleCrashed.DefSQMethod(engine, &ScriptEventVehicleCrashed::GetVehicleID,   "GetVehicleID",   1, "x");
+	SQAIEventVehicleCrashed.DefSQMethod(engine, &ScriptEventVehicleCrashed::GetCrashSite,   "GetCrashSite",   1, "x");
+	SQAIEventVehicleCrashed.DefSQMethod(engine, &ScriptEventVehicleCrashed::GetCrashReason, "GetCrashReason", 1, "x");
 
 	SQAIEventVehicleCrashed.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventSubsidyOffer to be used as Squirrel parameter */
-	template <> inline AIEventSubsidyOffer *GetParam(ForceType<AIEventSubsidyOffer *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventSubsidyOffer *)instance; }
-	template <> inline AIEventSubsidyOffer &GetParam(ForceType<AIEventSubsidyOffer &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventSubsidyOffer *)instance; }
-	template <> inline const AIEventSubsidyOffer *GetParam(ForceType<const AIEventSubsidyOffer *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventSubsidyOffer *)instance; }
-	template <> inline const AIEventSubsidyOffer &GetParam(ForceType<const AIEventSubsidyOffer &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventSubsidyOffer *)instance; }
-	template <> inline int Return<AIEventSubsidyOffer *>(HSQUIRRELVM vm, AIEventSubsidyOffer *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventSubsidyOffer", res, NULL, DefSQDestructorCallback<AIEventSubsidyOffer>, true); return 1; }
+	/* Allow ScriptEventSubsidyOffer to be used as Squirrel parameter */
+	template <> inline ScriptEventSubsidyOffer *GetParam(ForceType<ScriptEventSubsidyOffer *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventSubsidyOffer *)instance; }
+	template <> inline ScriptEventSubsidyOffer &GetParam(ForceType<ScriptEventSubsidyOffer &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventSubsidyOffer *)instance; }
+	template <> inline const ScriptEventSubsidyOffer *GetParam(ForceType<const ScriptEventSubsidyOffer *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventSubsidyOffer *)instance; }
+	template <> inline const ScriptEventSubsidyOffer &GetParam(ForceType<const ScriptEventSubsidyOffer &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventSubsidyOffer *)instance; }
+	template <> inline int Return<ScriptEventSubsidyOffer *>(HSQUIRRELVM vm, ScriptEventSubsidyOffer *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventSubsidyOffer", res, NULL, DefSQDestructorCallback<ScriptEventSubsidyOffer>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventSubsidyOffer, ST_AI>() { return "AIEventSubsidyOffer"; }
+template <> const char *GetClassName<ScriptEventSubsidyOffer, ST_AI>() { return "AIEventSubsidyOffer"; }
 
 void SQAIEventSubsidyOffer_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventSubsidyOffer, ST_AI> SQAIEventSubsidyOffer("AIEventSubsidyOffer");
+	DefSQClass<ScriptEventSubsidyOffer, ST_AI> SQAIEventSubsidyOffer("AIEventSubsidyOffer");
 	SQAIEventSubsidyOffer.PreRegister(engine, "AIEvent");
 
-	SQAIEventSubsidyOffer.DefSQStaticMethod(engine, &AIEventSubsidyOffer::Convert, "Convert", 2, ".x");
+	SQAIEventSubsidyOffer.DefSQStaticMethod(engine, &ScriptEventSubsidyOffer::Convert, "Convert", 2, ".x");
 
-	SQAIEventSubsidyOffer.DefSQMethod(engine, &AIEventSubsidyOffer::GetSubsidyID, "GetSubsidyID", 1, "x");
+	SQAIEventSubsidyOffer.DefSQMethod(engine, &ScriptEventSubsidyOffer::GetSubsidyID, "GetSubsidyID", 1, "x");
 
 	SQAIEventSubsidyOffer.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventSubsidyOfferExpired to be used as Squirrel parameter */
-	template <> inline AIEventSubsidyOfferExpired *GetParam(ForceType<AIEventSubsidyOfferExpired *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventSubsidyOfferExpired *)instance; }
-	template <> inline AIEventSubsidyOfferExpired &GetParam(ForceType<AIEventSubsidyOfferExpired &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventSubsidyOfferExpired *)instance; }
-	template <> inline const AIEventSubsidyOfferExpired *GetParam(ForceType<const AIEventSubsidyOfferExpired *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventSubsidyOfferExpired *)instance; }
-	template <> inline const AIEventSubsidyOfferExpired &GetParam(ForceType<const AIEventSubsidyOfferExpired &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventSubsidyOfferExpired *)instance; }
-	template <> inline int Return<AIEventSubsidyOfferExpired *>(HSQUIRRELVM vm, AIEventSubsidyOfferExpired *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventSubsidyOfferExpired", res, NULL, DefSQDestructorCallback<AIEventSubsidyOfferExpired>, true); return 1; }
+	/* Allow ScriptEventSubsidyOfferExpired to be used as Squirrel parameter */
+	template <> inline ScriptEventSubsidyOfferExpired *GetParam(ForceType<ScriptEventSubsidyOfferExpired *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventSubsidyOfferExpired *)instance; }
+	template <> inline ScriptEventSubsidyOfferExpired &GetParam(ForceType<ScriptEventSubsidyOfferExpired &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventSubsidyOfferExpired *)instance; }
+	template <> inline const ScriptEventSubsidyOfferExpired *GetParam(ForceType<const ScriptEventSubsidyOfferExpired *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventSubsidyOfferExpired *)instance; }
+	template <> inline const ScriptEventSubsidyOfferExpired &GetParam(ForceType<const ScriptEventSubsidyOfferExpired &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventSubsidyOfferExpired *)instance; }
+	template <> inline int Return<ScriptEventSubsidyOfferExpired *>(HSQUIRRELVM vm, ScriptEventSubsidyOfferExpired *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventSubsidyOfferExpired", res, NULL, DefSQDestructorCallback<ScriptEventSubsidyOfferExpired>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventSubsidyOfferExpired, ST_AI>() { return "AIEventSubsidyOfferExpired"; }
+template <> const char *GetClassName<ScriptEventSubsidyOfferExpired, ST_AI>() { return "AIEventSubsidyOfferExpired"; }
 
 void SQAIEventSubsidyOfferExpired_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventSubsidyOfferExpired, ST_AI> SQAIEventSubsidyOfferExpired("AIEventSubsidyOfferExpired");
+	DefSQClass<ScriptEventSubsidyOfferExpired, ST_AI> SQAIEventSubsidyOfferExpired("AIEventSubsidyOfferExpired");
 	SQAIEventSubsidyOfferExpired.PreRegister(engine, "AIEvent");
 
-	SQAIEventSubsidyOfferExpired.DefSQStaticMethod(engine, &AIEventSubsidyOfferExpired::Convert, "Convert", 2, ".x");
+	SQAIEventSubsidyOfferExpired.DefSQStaticMethod(engine, &ScriptEventSubsidyOfferExpired::Convert, "Convert", 2, ".x");
 
-	SQAIEventSubsidyOfferExpired.DefSQMethod(engine, &AIEventSubsidyOfferExpired::GetSubsidyID, "GetSubsidyID", 1, "x");
+	SQAIEventSubsidyOfferExpired.DefSQMethod(engine, &ScriptEventSubsidyOfferExpired::GetSubsidyID, "GetSubsidyID", 1, "x");
 
 	SQAIEventSubsidyOfferExpired.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventSubsidyAwarded to be used as Squirrel parameter */
-	template <> inline AIEventSubsidyAwarded *GetParam(ForceType<AIEventSubsidyAwarded *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventSubsidyAwarded *)instance; }
-	template <> inline AIEventSubsidyAwarded &GetParam(ForceType<AIEventSubsidyAwarded &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventSubsidyAwarded *)instance; }
-	template <> inline const AIEventSubsidyAwarded *GetParam(ForceType<const AIEventSubsidyAwarded *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventSubsidyAwarded *)instance; }
-	template <> inline const AIEventSubsidyAwarded &GetParam(ForceType<const AIEventSubsidyAwarded &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventSubsidyAwarded *)instance; }
-	template <> inline int Return<AIEventSubsidyAwarded *>(HSQUIRRELVM vm, AIEventSubsidyAwarded *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventSubsidyAwarded", res, NULL, DefSQDestructorCallback<AIEventSubsidyAwarded>, true); return 1; }
+	/* Allow ScriptEventSubsidyAwarded to be used as Squirrel parameter */
+	template <> inline ScriptEventSubsidyAwarded *GetParam(ForceType<ScriptEventSubsidyAwarded *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventSubsidyAwarded *)instance; }
+	template <> inline ScriptEventSubsidyAwarded &GetParam(ForceType<ScriptEventSubsidyAwarded &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventSubsidyAwarded *)instance; }
+	template <> inline const ScriptEventSubsidyAwarded *GetParam(ForceType<const ScriptEventSubsidyAwarded *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventSubsidyAwarded *)instance; }
+	template <> inline const ScriptEventSubsidyAwarded &GetParam(ForceType<const ScriptEventSubsidyAwarded &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventSubsidyAwarded *)instance; }
+	template <> inline int Return<ScriptEventSubsidyAwarded *>(HSQUIRRELVM vm, ScriptEventSubsidyAwarded *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventSubsidyAwarded", res, NULL, DefSQDestructorCallback<ScriptEventSubsidyAwarded>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventSubsidyAwarded, ST_AI>() { return "AIEventSubsidyAwarded"; }
+template <> const char *GetClassName<ScriptEventSubsidyAwarded, ST_AI>() { return "AIEventSubsidyAwarded"; }
 
 void SQAIEventSubsidyAwarded_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventSubsidyAwarded, ST_AI> SQAIEventSubsidyAwarded("AIEventSubsidyAwarded");
+	DefSQClass<ScriptEventSubsidyAwarded, ST_AI> SQAIEventSubsidyAwarded("AIEventSubsidyAwarded");
 	SQAIEventSubsidyAwarded.PreRegister(engine, "AIEvent");
 
-	SQAIEventSubsidyAwarded.DefSQStaticMethod(engine, &AIEventSubsidyAwarded::Convert, "Convert", 2, ".x");
+	SQAIEventSubsidyAwarded.DefSQStaticMethod(engine, &ScriptEventSubsidyAwarded::Convert, "Convert", 2, ".x");
 
-	SQAIEventSubsidyAwarded.DefSQMethod(engine, &AIEventSubsidyAwarded::GetSubsidyID, "GetSubsidyID", 1, "x");
+	SQAIEventSubsidyAwarded.DefSQMethod(engine, &ScriptEventSubsidyAwarded::GetSubsidyID, "GetSubsidyID", 1, "x");
 
 	SQAIEventSubsidyAwarded.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventSubsidyExpired to be used as Squirrel parameter */
-	template <> inline AIEventSubsidyExpired *GetParam(ForceType<AIEventSubsidyExpired *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventSubsidyExpired *)instance; }
-	template <> inline AIEventSubsidyExpired &GetParam(ForceType<AIEventSubsidyExpired &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventSubsidyExpired *)instance; }
-	template <> inline const AIEventSubsidyExpired *GetParam(ForceType<const AIEventSubsidyExpired *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventSubsidyExpired *)instance; }
-	template <> inline const AIEventSubsidyExpired &GetParam(ForceType<const AIEventSubsidyExpired &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventSubsidyExpired *)instance; }
-	template <> inline int Return<AIEventSubsidyExpired *>(HSQUIRRELVM vm, AIEventSubsidyExpired *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventSubsidyExpired", res, NULL, DefSQDestructorCallback<AIEventSubsidyExpired>, true); return 1; }
+	/* Allow ScriptEventSubsidyExpired to be used as Squirrel parameter */
+	template <> inline ScriptEventSubsidyExpired *GetParam(ForceType<ScriptEventSubsidyExpired *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventSubsidyExpired *)instance; }
+	template <> inline ScriptEventSubsidyExpired &GetParam(ForceType<ScriptEventSubsidyExpired &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventSubsidyExpired *)instance; }
+	template <> inline const ScriptEventSubsidyExpired *GetParam(ForceType<const ScriptEventSubsidyExpired *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventSubsidyExpired *)instance; }
+	template <> inline const ScriptEventSubsidyExpired &GetParam(ForceType<const ScriptEventSubsidyExpired &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventSubsidyExpired *)instance; }
+	template <> inline int Return<ScriptEventSubsidyExpired *>(HSQUIRRELVM vm, ScriptEventSubsidyExpired *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventSubsidyExpired", res, NULL, DefSQDestructorCallback<ScriptEventSubsidyExpired>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventSubsidyExpired, ST_AI>() { return "AIEventSubsidyExpired"; }
+template <> const char *GetClassName<ScriptEventSubsidyExpired, ST_AI>() { return "AIEventSubsidyExpired"; }
 
 void SQAIEventSubsidyExpired_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventSubsidyExpired, ST_AI> SQAIEventSubsidyExpired("AIEventSubsidyExpired");
+	DefSQClass<ScriptEventSubsidyExpired, ST_AI> SQAIEventSubsidyExpired("AIEventSubsidyExpired");
 	SQAIEventSubsidyExpired.PreRegister(engine, "AIEvent");
 
-	SQAIEventSubsidyExpired.DefSQStaticMethod(engine, &AIEventSubsidyExpired::Convert, "Convert", 2, ".x");
+	SQAIEventSubsidyExpired.DefSQStaticMethod(engine, &ScriptEventSubsidyExpired::Convert, "Convert", 2, ".x");
 
-	SQAIEventSubsidyExpired.DefSQMethod(engine, &AIEventSubsidyExpired::GetSubsidyID, "GetSubsidyID", 1, "x");
+	SQAIEventSubsidyExpired.DefSQMethod(engine, &ScriptEventSubsidyExpired::GetSubsidyID, "GetSubsidyID", 1, "x");
 
 	SQAIEventSubsidyExpired.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventEnginePreview to be used as Squirrel parameter */
-	template <> inline AIEventEnginePreview *GetParam(ForceType<AIEventEnginePreview *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventEnginePreview *)instance; }
-	template <> inline AIEventEnginePreview &GetParam(ForceType<AIEventEnginePreview &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventEnginePreview *)instance; }
-	template <> inline const AIEventEnginePreview *GetParam(ForceType<const AIEventEnginePreview *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventEnginePreview *)instance; }
-	template <> inline const AIEventEnginePreview &GetParam(ForceType<const AIEventEnginePreview &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventEnginePreview *)instance; }
-	template <> inline int Return<AIEventEnginePreview *>(HSQUIRRELVM vm, AIEventEnginePreview *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventEnginePreview", res, NULL, DefSQDestructorCallback<AIEventEnginePreview>, true); return 1; }
+	/* Allow ScriptEventEnginePreview to be used as Squirrel parameter */
+	template <> inline ScriptEventEnginePreview *GetParam(ForceType<ScriptEventEnginePreview *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventEnginePreview *)instance; }
+	template <> inline ScriptEventEnginePreview &GetParam(ForceType<ScriptEventEnginePreview &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventEnginePreview *)instance; }
+	template <> inline const ScriptEventEnginePreview *GetParam(ForceType<const ScriptEventEnginePreview *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventEnginePreview *)instance; }
+	template <> inline const ScriptEventEnginePreview &GetParam(ForceType<const ScriptEventEnginePreview &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventEnginePreview *)instance; }
+	template <> inline int Return<ScriptEventEnginePreview *>(HSQUIRRELVM vm, ScriptEventEnginePreview *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventEnginePreview", res, NULL, DefSQDestructorCallback<ScriptEventEnginePreview>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventEnginePreview, ST_AI>() { return "AIEventEnginePreview"; }
+template <> const char *GetClassName<ScriptEventEnginePreview, ST_AI>() { return "AIEventEnginePreview"; }
 
 void SQAIEventEnginePreview_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventEnginePreview, ST_AI> SQAIEventEnginePreview("AIEventEnginePreview");
+	DefSQClass<ScriptEventEnginePreview, ST_AI> SQAIEventEnginePreview("AIEventEnginePreview");
 	SQAIEventEnginePreview.PreRegister(engine, "AIEvent");
 
-	SQAIEventEnginePreview.DefSQStaticMethod(engine, &AIEventEnginePreview::Convert, "Convert", 2, ".x");
+	SQAIEventEnginePreview.DefSQStaticMethod(engine, &ScriptEventEnginePreview::Convert, "Convert", 2, ".x");
 
-	SQAIEventEnginePreview.DefSQMethod(engine, &AIEventEnginePreview::GetName,        "GetName",        1, "x");
-	SQAIEventEnginePreview.DefSQMethod(engine, &AIEventEnginePreview::GetCargoType,   "GetCargoType",   1, "x");
-	SQAIEventEnginePreview.DefSQMethod(engine, &AIEventEnginePreview::GetCapacity,    "GetCapacity",    1, "x");
-	SQAIEventEnginePreview.DefSQMethod(engine, &AIEventEnginePreview::GetMaxSpeed,    "GetMaxSpeed",    1, "x");
-	SQAIEventEnginePreview.DefSQMethod(engine, &AIEventEnginePreview::GetPrice,       "GetPrice",       1, "x");
-	SQAIEventEnginePreview.DefSQMethod(engine, &AIEventEnginePreview::GetRunningCost, "GetRunningCost", 1, "x");
-	SQAIEventEnginePreview.DefSQMethod(engine, &AIEventEnginePreview::GetVehicleType, "GetVehicleType", 1, "x");
-	SQAIEventEnginePreview.DefSQMethod(engine, &AIEventEnginePreview::AcceptPreview,  "AcceptPreview",  1, "x");
+	SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetName,        "GetName",        1, "x");
+	SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetCargoType,   "GetCargoType",   1, "x");
+	SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetCapacity,    "GetCapacity",    1, "x");
+	SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetMaxSpeed,    "GetMaxSpeed",    1, "x");
+	SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetPrice,       "GetPrice",       1, "x");
+	SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetRunningCost, "GetRunningCost", 1, "x");
+	SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetVehicleType, "GetVehicleType", 1, "x");
+	SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::AcceptPreview,  "AcceptPreview",  1, "x");
 
 	SQAIEventEnginePreview.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventCompanyNew to be used as Squirrel parameter */
-	template <> inline AIEventCompanyNew *GetParam(ForceType<AIEventCompanyNew *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventCompanyNew *)instance; }
-	template <> inline AIEventCompanyNew &GetParam(ForceType<AIEventCompanyNew &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventCompanyNew *)instance; }
-	template <> inline const AIEventCompanyNew *GetParam(ForceType<const AIEventCompanyNew *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventCompanyNew *)instance; }
-	template <> inline const AIEventCompanyNew &GetParam(ForceType<const AIEventCompanyNew &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventCompanyNew *)instance; }
-	template <> inline int Return<AIEventCompanyNew *>(HSQUIRRELVM vm, AIEventCompanyNew *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyNew", res, NULL, DefSQDestructorCallback<AIEventCompanyNew>, true); return 1; }
+	/* Allow ScriptEventCompanyNew to be used as Squirrel parameter */
+	template <> inline ScriptEventCompanyNew *GetParam(ForceType<ScriptEventCompanyNew *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventCompanyNew *)instance; }
+	template <> inline ScriptEventCompanyNew &GetParam(ForceType<ScriptEventCompanyNew &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventCompanyNew *)instance; }
+	template <> inline const ScriptEventCompanyNew *GetParam(ForceType<const ScriptEventCompanyNew *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventCompanyNew *)instance; }
+	template <> inline const ScriptEventCompanyNew &GetParam(ForceType<const ScriptEventCompanyNew &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventCompanyNew *)instance; }
+	template <> inline int Return<ScriptEventCompanyNew *>(HSQUIRRELVM vm, ScriptEventCompanyNew *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyNew", res, NULL, DefSQDestructorCallback<ScriptEventCompanyNew>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventCompanyNew, ST_AI>() { return "AIEventCompanyNew"; }
+template <> const char *GetClassName<ScriptEventCompanyNew, ST_AI>() { return "AIEventCompanyNew"; }
 
 void SQAIEventCompanyNew_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventCompanyNew, ST_AI> SQAIEventCompanyNew("AIEventCompanyNew");
+	DefSQClass<ScriptEventCompanyNew, ST_AI> SQAIEventCompanyNew("AIEventCompanyNew");
 	SQAIEventCompanyNew.PreRegister(engine, "AIEvent");
 
-	SQAIEventCompanyNew.DefSQStaticMethod(engine, &AIEventCompanyNew::Convert, "Convert", 2, ".x");
+	SQAIEventCompanyNew.DefSQStaticMethod(engine, &ScriptEventCompanyNew::Convert, "Convert", 2, ".x");
 
-	SQAIEventCompanyNew.DefSQMethod(engine, &AIEventCompanyNew::GetCompanyID, "GetCompanyID", 1, "x");
+	SQAIEventCompanyNew.DefSQMethod(engine, &ScriptEventCompanyNew::GetCompanyID, "GetCompanyID", 1, "x");
 
 	SQAIEventCompanyNew.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventCompanyInTrouble to be used as Squirrel parameter */
-	template <> inline AIEventCompanyInTrouble *GetParam(ForceType<AIEventCompanyInTrouble *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventCompanyInTrouble *)instance; }
-	template <> inline AIEventCompanyInTrouble &GetParam(ForceType<AIEventCompanyInTrouble &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventCompanyInTrouble *)instance; }
-	template <> inline const AIEventCompanyInTrouble *GetParam(ForceType<const AIEventCompanyInTrouble *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventCompanyInTrouble *)instance; }
-	template <> inline const AIEventCompanyInTrouble &GetParam(ForceType<const AIEventCompanyInTrouble &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventCompanyInTrouble *)instance; }
-	template <> inline int Return<AIEventCompanyInTrouble *>(HSQUIRRELVM vm, AIEventCompanyInTrouble *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyInTrouble", res, NULL, DefSQDestructorCallback<AIEventCompanyInTrouble>, true); return 1; }
+	/* Allow ScriptEventCompanyInTrouble to be used as Squirrel parameter */
+	template <> inline ScriptEventCompanyInTrouble *GetParam(ForceType<ScriptEventCompanyInTrouble *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventCompanyInTrouble *)instance; }
+	template <> inline ScriptEventCompanyInTrouble &GetParam(ForceType<ScriptEventCompanyInTrouble &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventCompanyInTrouble *)instance; }
+	template <> inline const ScriptEventCompanyInTrouble *GetParam(ForceType<const ScriptEventCompanyInTrouble *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventCompanyInTrouble *)instance; }
+	template <> inline const ScriptEventCompanyInTrouble &GetParam(ForceType<const ScriptEventCompanyInTrouble &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventCompanyInTrouble *)instance; }
+	template <> inline int Return<ScriptEventCompanyInTrouble *>(HSQUIRRELVM vm, ScriptEventCompanyInTrouble *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyInTrouble", res, NULL, DefSQDestructorCallback<ScriptEventCompanyInTrouble>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventCompanyInTrouble, ST_AI>() { return "AIEventCompanyInTrouble"; }
+template <> const char *GetClassName<ScriptEventCompanyInTrouble, ST_AI>() { return "AIEventCompanyInTrouble"; }
 
 void SQAIEventCompanyInTrouble_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventCompanyInTrouble, ST_AI> SQAIEventCompanyInTrouble("AIEventCompanyInTrouble");
+	DefSQClass<ScriptEventCompanyInTrouble, ST_AI> SQAIEventCompanyInTrouble("AIEventCompanyInTrouble");
 	SQAIEventCompanyInTrouble.PreRegister(engine, "AIEvent");
 
-	SQAIEventCompanyInTrouble.DefSQStaticMethod(engine, &AIEventCompanyInTrouble::Convert, "Convert", 2, ".x");
+	SQAIEventCompanyInTrouble.DefSQStaticMethod(engine, &ScriptEventCompanyInTrouble::Convert, "Convert", 2, ".x");
 
-	SQAIEventCompanyInTrouble.DefSQMethod(engine, &AIEventCompanyInTrouble::GetCompanyID, "GetCompanyID", 1, "x");
+	SQAIEventCompanyInTrouble.DefSQMethod(engine, &ScriptEventCompanyInTrouble::GetCompanyID, "GetCompanyID", 1, "x");
 
 	SQAIEventCompanyInTrouble.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventCompanyAskMerger to be used as Squirrel parameter */
-	template <> inline AIEventCompanyAskMerger *GetParam(ForceType<AIEventCompanyAskMerger *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventCompanyAskMerger *)instance; }
-	template <> inline AIEventCompanyAskMerger &GetParam(ForceType<AIEventCompanyAskMerger &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventCompanyAskMerger *)instance; }
-	template <> inline const AIEventCompanyAskMerger *GetParam(ForceType<const AIEventCompanyAskMerger *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventCompanyAskMerger *)instance; }
-	template <> inline const AIEventCompanyAskMerger &GetParam(ForceType<const AIEventCompanyAskMerger &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventCompanyAskMerger *)instance; }
-	template <> inline int Return<AIEventCompanyAskMerger *>(HSQUIRRELVM vm, AIEventCompanyAskMerger *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyAskMerger", res, NULL, DefSQDestructorCallback<AIEventCompanyAskMerger>, true); return 1; }
+	/* Allow ScriptEventCompanyAskMerger to be used as Squirrel parameter */
+	template <> inline ScriptEventCompanyAskMerger *GetParam(ForceType<ScriptEventCompanyAskMerger *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventCompanyAskMerger *)instance; }
+	template <> inline ScriptEventCompanyAskMerger &GetParam(ForceType<ScriptEventCompanyAskMerger &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventCompanyAskMerger *)instance; }
+	template <> inline const ScriptEventCompanyAskMerger *GetParam(ForceType<const ScriptEventCompanyAskMerger *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventCompanyAskMerger *)instance; }
+	template <> inline const ScriptEventCompanyAskMerger &GetParam(ForceType<const ScriptEventCompanyAskMerger &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventCompanyAskMerger *)instance; }
+	template <> inline int Return<ScriptEventCompanyAskMerger *>(HSQUIRRELVM vm, ScriptEventCompanyAskMerger *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyAskMerger", res, NULL, DefSQDestructorCallback<ScriptEventCompanyAskMerger>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventCompanyAskMerger, ST_AI>() { return "AIEventCompanyAskMerger"; }
+template <> const char *GetClassName<ScriptEventCompanyAskMerger, ST_AI>() { return "AIEventCompanyAskMerger"; }
 
 void SQAIEventCompanyAskMerger_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventCompanyAskMerger, ST_AI> SQAIEventCompanyAskMerger("AIEventCompanyAskMerger");
+	DefSQClass<ScriptEventCompanyAskMerger, ST_AI> SQAIEventCompanyAskMerger("AIEventCompanyAskMerger");
 	SQAIEventCompanyAskMerger.PreRegister(engine, "AIEvent");
 
-	SQAIEventCompanyAskMerger.DefSQStaticMethod(engine, &AIEventCompanyAskMerger::Convert, "Convert", 2, ".x");
+	SQAIEventCompanyAskMerger.DefSQStaticMethod(engine, &ScriptEventCompanyAskMerger::Convert, "Convert", 2, ".x");
 
-	SQAIEventCompanyAskMerger.DefSQMethod(engine, &AIEventCompanyAskMerger::GetCompanyID, "GetCompanyID", 1, "x");
-	SQAIEventCompanyAskMerger.DefSQMethod(engine, &AIEventCompanyAskMerger::GetValue,     "GetValue",     1, "x");
-	SQAIEventCompanyAskMerger.DefSQMethod(engine, &AIEventCompanyAskMerger::AcceptMerger, "AcceptMerger", 1, "x");
+	SQAIEventCompanyAskMerger.DefSQMethod(engine, &ScriptEventCompanyAskMerger::GetCompanyID, "GetCompanyID", 1, "x");
+	SQAIEventCompanyAskMerger.DefSQMethod(engine, &ScriptEventCompanyAskMerger::GetValue,     "GetValue",     1, "x");
+	SQAIEventCompanyAskMerger.DefSQMethod(engine, &ScriptEventCompanyAskMerger::AcceptMerger, "AcceptMerger", 1, "x");
 
 	SQAIEventCompanyAskMerger.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventCompanyMerger to be used as Squirrel parameter */
-	template <> inline AIEventCompanyMerger *GetParam(ForceType<AIEventCompanyMerger *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventCompanyMerger *)instance; }
-	template <> inline AIEventCompanyMerger &GetParam(ForceType<AIEventCompanyMerger &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventCompanyMerger *)instance; }
-	template <> inline const AIEventCompanyMerger *GetParam(ForceType<const AIEventCompanyMerger *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventCompanyMerger *)instance; }
-	template <> inline const AIEventCompanyMerger &GetParam(ForceType<const AIEventCompanyMerger &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventCompanyMerger *)instance; }
-	template <> inline int Return<AIEventCompanyMerger *>(HSQUIRRELVM vm, AIEventCompanyMerger *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyMerger", res, NULL, DefSQDestructorCallback<AIEventCompanyMerger>, true); return 1; }
+	/* Allow ScriptEventCompanyMerger to be used as Squirrel parameter */
+	template <> inline ScriptEventCompanyMerger *GetParam(ForceType<ScriptEventCompanyMerger *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventCompanyMerger *)instance; }
+	template <> inline ScriptEventCompanyMerger &GetParam(ForceType<ScriptEventCompanyMerger &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventCompanyMerger *)instance; }
+	template <> inline const ScriptEventCompanyMerger *GetParam(ForceType<const ScriptEventCompanyMerger *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventCompanyMerger *)instance; }
+	template <> inline const ScriptEventCompanyMerger &GetParam(ForceType<const ScriptEventCompanyMerger &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventCompanyMerger *)instance; }
+	template <> inline int Return<ScriptEventCompanyMerger *>(HSQUIRRELVM vm, ScriptEventCompanyMerger *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyMerger", res, NULL, DefSQDestructorCallback<ScriptEventCompanyMerger>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventCompanyMerger, ST_AI>() { return "AIEventCompanyMerger"; }
+template <> const char *GetClassName<ScriptEventCompanyMerger, ST_AI>() { return "AIEventCompanyMerger"; }
 
 void SQAIEventCompanyMerger_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventCompanyMerger, ST_AI> SQAIEventCompanyMerger("AIEventCompanyMerger");
+	DefSQClass<ScriptEventCompanyMerger, ST_AI> SQAIEventCompanyMerger("AIEventCompanyMerger");
 	SQAIEventCompanyMerger.PreRegister(engine, "AIEvent");
 
-	SQAIEventCompanyMerger.DefSQStaticMethod(engine, &AIEventCompanyMerger::Convert, "Convert", 2, ".x");
+	SQAIEventCompanyMerger.DefSQStaticMethod(engine, &ScriptEventCompanyMerger::Convert, "Convert", 2, ".x");
 
-	SQAIEventCompanyMerger.DefSQMethod(engine, &AIEventCompanyMerger::GetOldCompanyID, "GetOldCompanyID", 1, "x");
-	SQAIEventCompanyMerger.DefSQMethod(engine, &AIEventCompanyMerger::GetNewCompanyID, "GetNewCompanyID", 1, "x");
+	SQAIEventCompanyMerger.DefSQMethod(engine, &ScriptEventCompanyMerger::GetOldCompanyID, "GetOldCompanyID", 1, "x");
+	SQAIEventCompanyMerger.DefSQMethod(engine, &ScriptEventCompanyMerger::GetNewCompanyID, "GetNewCompanyID", 1, "x");
 
 	SQAIEventCompanyMerger.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventCompanyBankrupt to be used as Squirrel parameter */
-	template <> inline AIEventCompanyBankrupt *GetParam(ForceType<AIEventCompanyBankrupt *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventCompanyBankrupt *)instance; }
-	template <> inline AIEventCompanyBankrupt &GetParam(ForceType<AIEventCompanyBankrupt &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventCompanyBankrupt *)instance; }
-	template <> inline const AIEventCompanyBankrupt *GetParam(ForceType<const AIEventCompanyBankrupt *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventCompanyBankrupt *)instance; }
-	template <> inline const AIEventCompanyBankrupt &GetParam(ForceType<const AIEventCompanyBankrupt &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventCompanyBankrupt *)instance; }
-	template <> inline int Return<AIEventCompanyBankrupt *>(HSQUIRRELVM vm, AIEventCompanyBankrupt *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyBankrupt", res, NULL, DefSQDestructorCallback<AIEventCompanyBankrupt>, true); return 1; }
+	/* Allow ScriptEventCompanyBankrupt to be used as Squirrel parameter */
+	template <> inline ScriptEventCompanyBankrupt *GetParam(ForceType<ScriptEventCompanyBankrupt *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventCompanyBankrupt *)instance; }
+	template <> inline ScriptEventCompanyBankrupt &GetParam(ForceType<ScriptEventCompanyBankrupt &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventCompanyBankrupt *)instance; }
+	template <> inline const ScriptEventCompanyBankrupt *GetParam(ForceType<const ScriptEventCompanyBankrupt *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventCompanyBankrupt *)instance; }
+	template <> inline const ScriptEventCompanyBankrupt &GetParam(ForceType<const ScriptEventCompanyBankrupt &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventCompanyBankrupt *)instance; }
+	template <> inline int Return<ScriptEventCompanyBankrupt *>(HSQUIRRELVM vm, ScriptEventCompanyBankrupt *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyBankrupt", res, NULL, DefSQDestructorCallback<ScriptEventCompanyBankrupt>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventCompanyBankrupt, ST_AI>() { return "AIEventCompanyBankrupt"; }
+template <> const char *GetClassName<ScriptEventCompanyBankrupt, ST_AI>() { return "AIEventCompanyBankrupt"; }
 
 void SQAIEventCompanyBankrupt_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventCompanyBankrupt, ST_AI> SQAIEventCompanyBankrupt("AIEventCompanyBankrupt");
+	DefSQClass<ScriptEventCompanyBankrupt, ST_AI> SQAIEventCompanyBankrupt("AIEventCompanyBankrupt");
 	SQAIEventCompanyBankrupt.PreRegister(engine, "AIEvent");
 
-	SQAIEventCompanyBankrupt.DefSQStaticMethod(engine, &AIEventCompanyBankrupt::Convert, "Convert", 2, ".x");
+	SQAIEventCompanyBankrupt.DefSQStaticMethod(engine, &ScriptEventCompanyBankrupt::Convert, "Convert", 2, ".x");
 
-	SQAIEventCompanyBankrupt.DefSQMethod(engine, &AIEventCompanyBankrupt::GetCompanyID, "GetCompanyID", 1, "x");
+	SQAIEventCompanyBankrupt.DefSQMethod(engine, &ScriptEventCompanyBankrupt::GetCompanyID, "GetCompanyID", 1, "x");
 
 	SQAIEventCompanyBankrupt.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventVehicleLost to be used as Squirrel parameter */
-	template <> inline AIEventVehicleLost *GetParam(ForceType<AIEventVehicleLost *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventVehicleLost *)instance; }
-	template <> inline AIEventVehicleLost &GetParam(ForceType<AIEventVehicleLost &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventVehicleLost *)instance; }
-	template <> inline const AIEventVehicleLost *GetParam(ForceType<const AIEventVehicleLost *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventVehicleLost *)instance; }
-	template <> inline const AIEventVehicleLost &GetParam(ForceType<const AIEventVehicleLost &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventVehicleLost *)instance; }
-	template <> inline int Return<AIEventVehicleLost *>(HSQUIRRELVM vm, AIEventVehicleLost *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventVehicleLost", res, NULL, DefSQDestructorCallback<AIEventVehicleLost>, true); return 1; }
+	/* Allow ScriptEventVehicleLost to be used as Squirrel parameter */
+	template <> inline ScriptEventVehicleLost *GetParam(ForceType<ScriptEventVehicleLost *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventVehicleLost *)instance; }
+	template <> inline ScriptEventVehicleLost &GetParam(ForceType<ScriptEventVehicleLost &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventVehicleLost *)instance; }
+	template <> inline const ScriptEventVehicleLost *GetParam(ForceType<const ScriptEventVehicleLost *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventVehicleLost *)instance; }
+	template <> inline const ScriptEventVehicleLost &GetParam(ForceType<const ScriptEventVehicleLost &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventVehicleLost *)instance; }
+	template <> inline int Return<ScriptEventVehicleLost *>(HSQUIRRELVM vm, ScriptEventVehicleLost *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventVehicleLost", res, NULL, DefSQDestructorCallback<ScriptEventVehicleLost>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventVehicleLost, ST_AI>() { return "AIEventVehicleLost"; }
+template <> const char *GetClassName<ScriptEventVehicleLost, ST_AI>() { return "AIEventVehicleLost"; }
 
 void SQAIEventVehicleLost_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventVehicleLost, ST_AI> SQAIEventVehicleLost("AIEventVehicleLost");
+	DefSQClass<ScriptEventVehicleLost, ST_AI> SQAIEventVehicleLost("AIEventVehicleLost");
 	SQAIEventVehicleLost.PreRegister(engine, "AIEvent");
 
-	SQAIEventVehicleLost.DefSQStaticMethod(engine, &AIEventVehicleLost::Convert, "Convert", 2, ".x");
+	SQAIEventVehicleLost.DefSQStaticMethod(engine, &ScriptEventVehicleLost::Convert, "Convert", 2, ".x");
 
-	SQAIEventVehicleLost.DefSQMethod(engine, &AIEventVehicleLost::GetVehicleID, "GetVehicleID", 1, "x");
+	SQAIEventVehicleLost.DefSQMethod(engine, &ScriptEventVehicleLost::GetVehicleID, "GetVehicleID", 1, "x");
 
 	SQAIEventVehicleLost.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventVehicleWaitingInDepot to be used as Squirrel parameter */
-	template <> inline AIEventVehicleWaitingInDepot *GetParam(ForceType<AIEventVehicleWaitingInDepot *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventVehicleWaitingInDepot *)instance; }
-	template <> inline AIEventVehicleWaitingInDepot &GetParam(ForceType<AIEventVehicleWaitingInDepot &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventVehicleWaitingInDepot *)instance; }
-	template <> inline const AIEventVehicleWaitingInDepot *GetParam(ForceType<const AIEventVehicleWaitingInDepot *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventVehicleWaitingInDepot *)instance; }
-	template <> inline const AIEventVehicleWaitingInDepot &GetParam(ForceType<const AIEventVehicleWaitingInDepot &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventVehicleWaitingInDepot *)instance; }
-	template <> inline int Return<AIEventVehicleWaitingInDepot *>(HSQUIRRELVM vm, AIEventVehicleWaitingInDepot *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventVehicleWaitingInDepot", res, NULL, DefSQDestructorCallback<AIEventVehicleWaitingInDepot>, true); return 1; }
+	/* Allow ScriptEventVehicleWaitingInDepot to be used as Squirrel parameter */
+	template <> inline ScriptEventVehicleWaitingInDepot *GetParam(ForceType<ScriptEventVehicleWaitingInDepot *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventVehicleWaitingInDepot *)instance; }
+	template <> inline ScriptEventVehicleWaitingInDepot &GetParam(ForceType<ScriptEventVehicleWaitingInDepot &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventVehicleWaitingInDepot *)instance; }
+	template <> inline const ScriptEventVehicleWaitingInDepot *GetParam(ForceType<const ScriptEventVehicleWaitingInDepot *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventVehicleWaitingInDepot *)instance; }
+	template <> inline const ScriptEventVehicleWaitingInDepot &GetParam(ForceType<const ScriptEventVehicleWaitingInDepot &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventVehicleWaitingInDepot *)instance; }
+	template <> inline int Return<ScriptEventVehicleWaitingInDepot *>(HSQUIRRELVM vm, ScriptEventVehicleWaitingInDepot *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventVehicleWaitingInDepot", res, NULL, DefSQDestructorCallback<ScriptEventVehicleWaitingInDepot>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventVehicleWaitingInDepot, ST_AI>() { return "AIEventVehicleWaitingInDepot"; }
+template <> const char *GetClassName<ScriptEventVehicleWaitingInDepot, ST_AI>() { return "AIEventVehicleWaitingInDepot"; }
 
 void SQAIEventVehicleWaitingInDepot_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventVehicleWaitingInDepot, ST_AI> SQAIEventVehicleWaitingInDepot("AIEventVehicleWaitingInDepot");
+	DefSQClass<ScriptEventVehicleWaitingInDepot, ST_AI> SQAIEventVehicleWaitingInDepot("AIEventVehicleWaitingInDepot");
 	SQAIEventVehicleWaitingInDepot.PreRegister(engine, "AIEvent");
 
-	SQAIEventVehicleWaitingInDepot.DefSQStaticMethod(engine, &AIEventVehicleWaitingInDepot::Convert, "Convert", 2, ".x");
+	SQAIEventVehicleWaitingInDepot.DefSQStaticMethod(engine, &ScriptEventVehicleWaitingInDepot::Convert, "Convert", 2, ".x");
 
-	SQAIEventVehicleWaitingInDepot.DefSQMethod(engine, &AIEventVehicleWaitingInDepot::GetVehicleID, "GetVehicleID", 1, "x");
+	SQAIEventVehicleWaitingInDepot.DefSQMethod(engine, &ScriptEventVehicleWaitingInDepot::GetVehicleID, "GetVehicleID", 1, "x");
 
 	SQAIEventVehicleWaitingInDepot.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventVehicleUnprofitable to be used as Squirrel parameter */
-	template <> inline AIEventVehicleUnprofitable *GetParam(ForceType<AIEventVehicleUnprofitable *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventVehicleUnprofitable *)instance; }
-	template <> inline AIEventVehicleUnprofitable &GetParam(ForceType<AIEventVehicleUnprofitable &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventVehicleUnprofitable *)instance; }
-	template <> inline const AIEventVehicleUnprofitable *GetParam(ForceType<const AIEventVehicleUnprofitable *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventVehicleUnprofitable *)instance; }
-	template <> inline const AIEventVehicleUnprofitable &GetParam(ForceType<const AIEventVehicleUnprofitable &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventVehicleUnprofitable *)instance; }
-	template <> inline int Return<AIEventVehicleUnprofitable *>(HSQUIRRELVM vm, AIEventVehicleUnprofitable *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventVehicleUnprofitable", res, NULL, DefSQDestructorCallback<AIEventVehicleUnprofitable>, true); return 1; }
+	/* Allow ScriptEventVehicleUnprofitable to be used as Squirrel parameter */
+	template <> inline ScriptEventVehicleUnprofitable *GetParam(ForceType<ScriptEventVehicleUnprofitable *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventVehicleUnprofitable *)instance; }
+	template <> inline ScriptEventVehicleUnprofitable &GetParam(ForceType<ScriptEventVehicleUnprofitable &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventVehicleUnprofitable *)instance; }
+	template <> inline const ScriptEventVehicleUnprofitable *GetParam(ForceType<const ScriptEventVehicleUnprofitable *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventVehicleUnprofitable *)instance; }
+	template <> inline const ScriptEventVehicleUnprofitable &GetParam(ForceType<const ScriptEventVehicleUnprofitable &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventVehicleUnprofitable *)instance; }
+	template <> inline int Return<ScriptEventVehicleUnprofitable *>(HSQUIRRELVM vm, ScriptEventVehicleUnprofitable *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventVehicleUnprofitable", res, NULL, DefSQDestructorCallback<ScriptEventVehicleUnprofitable>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventVehicleUnprofitable, ST_AI>() { return "AIEventVehicleUnprofitable"; }
+template <> const char *GetClassName<ScriptEventVehicleUnprofitable, ST_AI>() { return "AIEventVehicleUnprofitable"; }
 
 void SQAIEventVehicleUnprofitable_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventVehicleUnprofitable, ST_AI> SQAIEventVehicleUnprofitable("AIEventVehicleUnprofitable");
+	DefSQClass<ScriptEventVehicleUnprofitable, ST_AI> SQAIEventVehicleUnprofitable("AIEventVehicleUnprofitable");
 	SQAIEventVehicleUnprofitable.PreRegister(engine, "AIEvent");
 
-	SQAIEventVehicleUnprofitable.DefSQStaticMethod(engine, &AIEventVehicleUnprofitable::Convert, "Convert", 2, ".x");
+	SQAIEventVehicleUnprofitable.DefSQStaticMethod(engine, &ScriptEventVehicleUnprofitable::Convert, "Convert", 2, ".x");
 
-	SQAIEventVehicleUnprofitable.DefSQMethod(engine, &AIEventVehicleUnprofitable::GetVehicleID, "GetVehicleID", 1, "x");
+	SQAIEventVehicleUnprofitable.DefSQMethod(engine, &ScriptEventVehicleUnprofitable::GetVehicleID, "GetVehicleID", 1, "x");
 
 	SQAIEventVehicleUnprofitable.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventIndustryOpen to be used as Squirrel parameter */
-	template <> inline AIEventIndustryOpen *GetParam(ForceType<AIEventIndustryOpen *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventIndustryOpen *)instance; }
-	template <> inline AIEventIndustryOpen &GetParam(ForceType<AIEventIndustryOpen &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventIndustryOpen *)instance; }
-	template <> inline const AIEventIndustryOpen *GetParam(ForceType<const AIEventIndustryOpen *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventIndustryOpen *)instance; }
-	template <> inline const AIEventIndustryOpen &GetParam(ForceType<const AIEventIndustryOpen &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventIndustryOpen *)instance; }
-	template <> inline int Return<AIEventIndustryOpen *>(HSQUIRRELVM vm, AIEventIndustryOpen *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventIndustryOpen", res, NULL, DefSQDestructorCallback<AIEventIndustryOpen>, true); return 1; }
+	/* Allow ScriptEventIndustryOpen to be used as Squirrel parameter */
+	template <> inline ScriptEventIndustryOpen *GetParam(ForceType<ScriptEventIndustryOpen *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventIndustryOpen *)instance; }
+	template <> inline ScriptEventIndustryOpen &GetParam(ForceType<ScriptEventIndustryOpen &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventIndustryOpen *)instance; }
+	template <> inline const ScriptEventIndustryOpen *GetParam(ForceType<const ScriptEventIndustryOpen *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventIndustryOpen *)instance; }
+	template <> inline const ScriptEventIndustryOpen &GetParam(ForceType<const ScriptEventIndustryOpen &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventIndustryOpen *)instance; }
+	template <> inline int Return<ScriptEventIndustryOpen *>(HSQUIRRELVM vm, ScriptEventIndustryOpen *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventIndustryOpen", res, NULL, DefSQDestructorCallback<ScriptEventIndustryOpen>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventIndustryOpen, ST_AI>() { return "AIEventIndustryOpen"; }
+template <> const char *GetClassName<ScriptEventIndustryOpen, ST_AI>() { return "AIEventIndustryOpen"; }
 
 void SQAIEventIndustryOpen_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventIndustryOpen, ST_AI> SQAIEventIndustryOpen("AIEventIndustryOpen");
+	DefSQClass<ScriptEventIndustryOpen, ST_AI> SQAIEventIndustryOpen("AIEventIndustryOpen");
 	SQAIEventIndustryOpen.PreRegister(engine, "AIEvent");
 
-	SQAIEventIndustryOpen.DefSQStaticMethod(engine, &AIEventIndustryOpen::Convert, "Convert", 2, ".x");
+	SQAIEventIndustryOpen.DefSQStaticMethod(engine, &ScriptEventIndustryOpen::Convert, "Convert", 2, ".x");
 
-	SQAIEventIndustryOpen.DefSQMethod(engine, &AIEventIndustryOpen::GetIndustryID, "GetIndustryID", 1, "x");
+	SQAIEventIndustryOpen.DefSQMethod(engine, &ScriptEventIndustryOpen::GetIndustryID, "GetIndustryID", 1, "x");
 
 	SQAIEventIndustryOpen.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventIndustryClose to be used as Squirrel parameter */
-	template <> inline AIEventIndustryClose *GetParam(ForceType<AIEventIndustryClose *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventIndustryClose *)instance; }
-	template <> inline AIEventIndustryClose &GetParam(ForceType<AIEventIndustryClose &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventIndustryClose *)instance; }
-	template <> inline const AIEventIndustryClose *GetParam(ForceType<const AIEventIndustryClose *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventIndustryClose *)instance; }
-	template <> inline const AIEventIndustryClose &GetParam(ForceType<const AIEventIndustryClose &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventIndustryClose *)instance; }
-	template <> inline int Return<AIEventIndustryClose *>(HSQUIRRELVM vm, AIEventIndustryClose *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventIndustryClose", res, NULL, DefSQDestructorCallback<AIEventIndustryClose>, true); return 1; }
+	/* Allow ScriptEventIndustryClose to be used as Squirrel parameter */
+	template <> inline ScriptEventIndustryClose *GetParam(ForceType<ScriptEventIndustryClose *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventIndustryClose *)instance; }
+	template <> inline ScriptEventIndustryClose &GetParam(ForceType<ScriptEventIndustryClose &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventIndustryClose *)instance; }
+	template <> inline const ScriptEventIndustryClose *GetParam(ForceType<const ScriptEventIndustryClose *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventIndustryClose *)instance; }
+	template <> inline const ScriptEventIndustryClose &GetParam(ForceType<const ScriptEventIndustryClose &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventIndustryClose *)instance; }
+	template <> inline int Return<ScriptEventIndustryClose *>(HSQUIRRELVM vm, ScriptEventIndustryClose *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventIndustryClose", res, NULL, DefSQDestructorCallback<ScriptEventIndustryClose>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventIndustryClose, ST_AI>() { return "AIEventIndustryClose"; }
+template <> const char *GetClassName<ScriptEventIndustryClose, ST_AI>() { return "AIEventIndustryClose"; }
 
 void SQAIEventIndustryClose_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventIndustryClose, ST_AI> SQAIEventIndustryClose("AIEventIndustryClose");
+	DefSQClass<ScriptEventIndustryClose, ST_AI> SQAIEventIndustryClose("AIEventIndustryClose");
 	SQAIEventIndustryClose.PreRegister(engine, "AIEvent");
 
-	SQAIEventIndustryClose.DefSQStaticMethod(engine, &AIEventIndustryClose::Convert, "Convert", 2, ".x");
+	SQAIEventIndustryClose.DefSQStaticMethod(engine, &ScriptEventIndustryClose::Convert, "Convert", 2, ".x");
 
-	SQAIEventIndustryClose.DefSQMethod(engine, &AIEventIndustryClose::GetIndustryID, "GetIndustryID", 1, "x");
+	SQAIEventIndustryClose.DefSQMethod(engine, &ScriptEventIndustryClose::GetIndustryID, "GetIndustryID", 1, "x");
 
 	SQAIEventIndustryClose.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventEngineAvailable to be used as Squirrel parameter */
-	template <> inline AIEventEngineAvailable *GetParam(ForceType<AIEventEngineAvailable *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventEngineAvailable *)instance; }
-	template <> inline AIEventEngineAvailable &GetParam(ForceType<AIEventEngineAvailable &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventEngineAvailable *)instance; }
-	template <> inline const AIEventEngineAvailable *GetParam(ForceType<const AIEventEngineAvailable *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventEngineAvailable *)instance; }
-	template <> inline const AIEventEngineAvailable &GetParam(ForceType<const AIEventEngineAvailable &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventEngineAvailable *)instance; }
-	template <> inline int Return<AIEventEngineAvailable *>(HSQUIRRELVM vm, AIEventEngineAvailable *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventEngineAvailable", res, NULL, DefSQDestructorCallback<AIEventEngineAvailable>, true); return 1; }
+	/* Allow ScriptEventEngineAvailable to be used as Squirrel parameter */
+	template <> inline ScriptEventEngineAvailable *GetParam(ForceType<ScriptEventEngineAvailable *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventEngineAvailable *)instance; }
+	template <> inline ScriptEventEngineAvailable &GetParam(ForceType<ScriptEventEngineAvailable &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventEngineAvailable *)instance; }
+	template <> inline const ScriptEventEngineAvailable *GetParam(ForceType<const ScriptEventEngineAvailable *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventEngineAvailable *)instance; }
+	template <> inline const ScriptEventEngineAvailable &GetParam(ForceType<const ScriptEventEngineAvailable &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventEngineAvailable *)instance; }
+	template <> inline int Return<ScriptEventEngineAvailable *>(HSQUIRRELVM vm, ScriptEventEngineAvailable *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventEngineAvailable", res, NULL, DefSQDestructorCallback<ScriptEventEngineAvailable>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventEngineAvailable, ST_AI>() { return "AIEventEngineAvailable"; }
+template <> const char *GetClassName<ScriptEventEngineAvailable, ST_AI>() { return "AIEventEngineAvailable"; }
 
 void SQAIEventEngineAvailable_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventEngineAvailable, ST_AI> SQAIEventEngineAvailable("AIEventEngineAvailable");
+	DefSQClass<ScriptEventEngineAvailable, ST_AI> SQAIEventEngineAvailable("AIEventEngineAvailable");
 	SQAIEventEngineAvailable.PreRegister(engine, "AIEvent");
 
-	SQAIEventEngineAvailable.DefSQStaticMethod(engine, &AIEventEngineAvailable::Convert, "Convert", 2, ".x");
+	SQAIEventEngineAvailable.DefSQStaticMethod(engine, &ScriptEventEngineAvailable::Convert, "Convert", 2, ".x");
 
-	SQAIEventEngineAvailable.DefSQMethod(engine, &AIEventEngineAvailable::GetEngineID, "GetEngineID", 1, "x");
+	SQAIEventEngineAvailable.DefSQMethod(engine, &ScriptEventEngineAvailable::GetEngineID, "GetEngineID", 1, "x");
 
 	SQAIEventEngineAvailable.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventStationFirstVehicle to be used as Squirrel parameter */
-	template <> inline AIEventStationFirstVehicle *GetParam(ForceType<AIEventStationFirstVehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventStationFirstVehicle *)instance; }
-	template <> inline AIEventStationFirstVehicle &GetParam(ForceType<AIEventStationFirstVehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventStationFirstVehicle *)instance; }
-	template <> inline const AIEventStationFirstVehicle *GetParam(ForceType<const AIEventStationFirstVehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventStationFirstVehicle *)instance; }
-	template <> inline const AIEventStationFirstVehicle &GetParam(ForceType<const AIEventStationFirstVehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventStationFirstVehicle *)instance; }
-	template <> inline int Return<AIEventStationFirstVehicle *>(HSQUIRRELVM vm, AIEventStationFirstVehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventStationFirstVehicle", res, NULL, DefSQDestructorCallback<AIEventStationFirstVehicle>, true); return 1; }
+	/* Allow ScriptEventStationFirstVehicle to be used as Squirrel parameter */
+	template <> inline ScriptEventStationFirstVehicle *GetParam(ForceType<ScriptEventStationFirstVehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventStationFirstVehicle *)instance; }
+	template <> inline ScriptEventStationFirstVehicle &GetParam(ForceType<ScriptEventStationFirstVehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventStationFirstVehicle *)instance; }
+	template <> inline const ScriptEventStationFirstVehicle *GetParam(ForceType<const ScriptEventStationFirstVehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventStationFirstVehicle *)instance; }
+	template <> inline const ScriptEventStationFirstVehicle &GetParam(ForceType<const ScriptEventStationFirstVehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventStationFirstVehicle *)instance; }
+	template <> inline int Return<ScriptEventStationFirstVehicle *>(HSQUIRRELVM vm, ScriptEventStationFirstVehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventStationFirstVehicle", res, NULL, DefSQDestructorCallback<ScriptEventStationFirstVehicle>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventStationFirstVehicle, ST_AI>() { return "AIEventStationFirstVehicle"; }
+template <> const char *GetClassName<ScriptEventStationFirstVehicle, ST_AI>() { return "AIEventStationFirstVehicle"; }
 
 void SQAIEventStationFirstVehicle_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventStationFirstVehicle, ST_AI> SQAIEventStationFirstVehicle("AIEventStationFirstVehicle");
+	DefSQClass<ScriptEventStationFirstVehicle, ST_AI> SQAIEventStationFirstVehicle("AIEventStationFirstVehicle");
 	SQAIEventStationFirstVehicle.PreRegister(engine, "AIEvent");
 
-	SQAIEventStationFirstVehicle.DefSQStaticMethod(engine, &AIEventStationFirstVehicle::Convert, "Convert", 2, ".x");
+	SQAIEventStationFirstVehicle.DefSQStaticMethod(engine, &ScriptEventStationFirstVehicle::Convert, "Convert", 2, ".x");
 
-	SQAIEventStationFirstVehicle.DefSQMethod(engine, &AIEventStationFirstVehicle::GetStationID, "GetStationID", 1, "x");
-	SQAIEventStationFirstVehicle.DefSQMethod(engine, &AIEventStationFirstVehicle::GetVehicleID, "GetVehicleID", 1, "x");
+	SQAIEventStationFirstVehicle.DefSQMethod(engine, &ScriptEventStationFirstVehicle::GetStationID, "GetStationID", 1, "x");
+	SQAIEventStationFirstVehicle.DefSQMethod(engine, &ScriptEventStationFirstVehicle::GetVehicleID, "GetVehicleID", 1, "x");
 
 	SQAIEventStationFirstVehicle.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventDisasterZeppelinerCrashed to be used as Squirrel parameter */
-	template <> inline AIEventDisasterZeppelinerCrashed *GetParam(ForceType<AIEventDisasterZeppelinerCrashed *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventDisasterZeppelinerCrashed *)instance; }
-	template <> inline AIEventDisasterZeppelinerCrashed &GetParam(ForceType<AIEventDisasterZeppelinerCrashed &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventDisasterZeppelinerCrashed *)instance; }
-	template <> inline const AIEventDisasterZeppelinerCrashed *GetParam(ForceType<const AIEventDisasterZeppelinerCrashed *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventDisasterZeppelinerCrashed *)instance; }
-	template <> inline const AIEventDisasterZeppelinerCrashed &GetParam(ForceType<const AIEventDisasterZeppelinerCrashed &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventDisasterZeppelinerCrashed *)instance; }
-	template <> inline int Return<AIEventDisasterZeppelinerCrashed *>(HSQUIRRELVM vm, AIEventDisasterZeppelinerCrashed *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventDisasterZeppelinerCrashed", res, NULL, DefSQDestructorCallback<AIEventDisasterZeppelinerCrashed>, true); return 1; }
+	/* Allow ScriptEventDisasterZeppelinerCrashed to be used as Squirrel parameter */
+	template <> inline ScriptEventDisasterZeppelinerCrashed *GetParam(ForceType<ScriptEventDisasterZeppelinerCrashed *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventDisasterZeppelinerCrashed *)instance; }
+	template <> inline ScriptEventDisasterZeppelinerCrashed &GetParam(ForceType<ScriptEventDisasterZeppelinerCrashed &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventDisasterZeppelinerCrashed *)instance; }
+	template <> inline const ScriptEventDisasterZeppelinerCrashed *GetParam(ForceType<const ScriptEventDisasterZeppelinerCrashed *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventDisasterZeppelinerCrashed *)instance; }
+	template <> inline const ScriptEventDisasterZeppelinerCrashed &GetParam(ForceType<const ScriptEventDisasterZeppelinerCrashed &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventDisasterZeppelinerCrashed *)instance; }
+	template <> inline int Return<ScriptEventDisasterZeppelinerCrashed *>(HSQUIRRELVM vm, ScriptEventDisasterZeppelinerCrashed *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventDisasterZeppelinerCrashed", res, NULL, DefSQDestructorCallback<ScriptEventDisasterZeppelinerCrashed>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventDisasterZeppelinerCrashed, ST_AI>() { return "AIEventDisasterZeppelinerCrashed"; }
+template <> const char *GetClassName<ScriptEventDisasterZeppelinerCrashed, ST_AI>() { return "AIEventDisasterZeppelinerCrashed"; }
 
 void SQAIEventDisasterZeppelinerCrashed_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventDisasterZeppelinerCrashed, ST_AI> SQAIEventDisasterZeppelinerCrashed("AIEventDisasterZeppelinerCrashed");
+	DefSQClass<ScriptEventDisasterZeppelinerCrashed, ST_AI> SQAIEventDisasterZeppelinerCrashed("AIEventDisasterZeppelinerCrashed");
 	SQAIEventDisasterZeppelinerCrashed.PreRegister(engine, "AIEvent");
 
-	SQAIEventDisasterZeppelinerCrashed.DefSQStaticMethod(engine, &AIEventDisasterZeppelinerCrashed::Convert, "Convert", 2, ".x");
+	SQAIEventDisasterZeppelinerCrashed.DefSQStaticMethod(engine, &ScriptEventDisasterZeppelinerCrashed::Convert, "Convert", 2, ".x");
 
-	SQAIEventDisasterZeppelinerCrashed.DefSQMethod(engine, &AIEventDisasterZeppelinerCrashed::GetStationID, "GetStationID", 1, "x");
+	SQAIEventDisasterZeppelinerCrashed.DefSQMethod(engine, &ScriptEventDisasterZeppelinerCrashed::GetStationID, "GetStationID", 1, "x");
 
 	SQAIEventDisasterZeppelinerCrashed.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventDisasterZeppelinerCleared to be used as Squirrel parameter */
-	template <> inline AIEventDisasterZeppelinerCleared *GetParam(ForceType<AIEventDisasterZeppelinerCleared *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventDisasterZeppelinerCleared *)instance; }
-	template <> inline AIEventDisasterZeppelinerCleared &GetParam(ForceType<AIEventDisasterZeppelinerCleared &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventDisasterZeppelinerCleared *)instance; }
-	template <> inline const AIEventDisasterZeppelinerCleared *GetParam(ForceType<const AIEventDisasterZeppelinerCleared *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventDisasterZeppelinerCleared *)instance; }
-	template <> inline const AIEventDisasterZeppelinerCleared &GetParam(ForceType<const AIEventDisasterZeppelinerCleared &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventDisasterZeppelinerCleared *)instance; }
-	template <> inline int Return<AIEventDisasterZeppelinerCleared *>(HSQUIRRELVM vm, AIEventDisasterZeppelinerCleared *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventDisasterZeppelinerCleared", res, NULL, DefSQDestructorCallback<AIEventDisasterZeppelinerCleared>, true); return 1; }
+	/* Allow ScriptEventDisasterZeppelinerCleared to be used as Squirrel parameter */
+	template <> inline ScriptEventDisasterZeppelinerCleared *GetParam(ForceType<ScriptEventDisasterZeppelinerCleared *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventDisasterZeppelinerCleared *)instance; }
+	template <> inline ScriptEventDisasterZeppelinerCleared &GetParam(ForceType<ScriptEventDisasterZeppelinerCleared &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventDisasterZeppelinerCleared *)instance; }
+	template <> inline const ScriptEventDisasterZeppelinerCleared *GetParam(ForceType<const ScriptEventDisasterZeppelinerCleared *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventDisasterZeppelinerCleared *)instance; }
+	template <> inline const ScriptEventDisasterZeppelinerCleared &GetParam(ForceType<const ScriptEventDisasterZeppelinerCleared &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventDisasterZeppelinerCleared *)instance; }
+	template <> inline int Return<ScriptEventDisasterZeppelinerCleared *>(HSQUIRRELVM vm, ScriptEventDisasterZeppelinerCleared *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventDisasterZeppelinerCleared", res, NULL, DefSQDestructorCallback<ScriptEventDisasterZeppelinerCleared>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventDisasterZeppelinerCleared, ST_AI>() { return "AIEventDisasterZeppelinerCleared"; }
+template <> const char *GetClassName<ScriptEventDisasterZeppelinerCleared, ST_AI>() { return "AIEventDisasterZeppelinerCleared"; }
 
 void SQAIEventDisasterZeppelinerCleared_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventDisasterZeppelinerCleared, ST_AI> SQAIEventDisasterZeppelinerCleared("AIEventDisasterZeppelinerCleared");
+	DefSQClass<ScriptEventDisasterZeppelinerCleared, ST_AI> SQAIEventDisasterZeppelinerCleared("AIEventDisasterZeppelinerCleared");
 	SQAIEventDisasterZeppelinerCleared.PreRegister(engine, "AIEvent");
 
-	SQAIEventDisasterZeppelinerCleared.DefSQStaticMethod(engine, &AIEventDisasterZeppelinerCleared::Convert, "Convert", 2, ".x");
+	SQAIEventDisasterZeppelinerCleared.DefSQStaticMethod(engine, &ScriptEventDisasterZeppelinerCleared::Convert, "Convert", 2, ".x");
 
-	SQAIEventDisasterZeppelinerCleared.DefSQMethod(engine, &AIEventDisasterZeppelinerCleared::GetStationID, "GetStationID", 1, "x");
+	SQAIEventDisasterZeppelinerCleared.DefSQMethod(engine, &ScriptEventDisasterZeppelinerCleared::GetStationID, "GetStationID", 1, "x");
 
 	SQAIEventDisasterZeppelinerCleared.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIEventTownFounded to be used as Squirrel parameter */
-	template <> inline AIEventTownFounded *GetParam(ForceType<AIEventTownFounded *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventTownFounded *)instance; }
-	template <> inline AIEventTownFounded &GetParam(ForceType<AIEventTownFounded &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventTownFounded *)instance; }
-	template <> inline const AIEventTownFounded *GetParam(ForceType<const AIEventTownFounded *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEventTownFounded *)instance; }
-	template <> inline const AIEventTownFounded &GetParam(ForceType<const AIEventTownFounded &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventTownFounded *)instance; }
-	template <> inline int Return<AIEventTownFounded *>(HSQUIRRELVM vm, AIEventTownFounded *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventTownFounded", res, NULL, DefSQDestructorCallback<AIEventTownFounded>, true); return 1; }
+	/* Allow ScriptEventTownFounded to be used as Squirrel parameter */
+	template <> inline ScriptEventTownFounded *GetParam(ForceType<ScriptEventTownFounded *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventTownFounded *)instance; }
+	template <> inline ScriptEventTownFounded &GetParam(ForceType<ScriptEventTownFounded &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventTownFounded *)instance; }
+	template <> inline const ScriptEventTownFounded *GetParam(ForceType<const ScriptEventTownFounded *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptEventTownFounded *)instance; }
+	template <> inline const ScriptEventTownFounded &GetParam(ForceType<const ScriptEventTownFounded &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventTownFounded *)instance; }
+	template <> inline int Return<ScriptEventTownFounded *>(HSQUIRRELVM vm, ScriptEventTownFounded *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventTownFounded", res, NULL, DefSQDestructorCallback<ScriptEventTownFounded>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIEventTownFounded, ST_AI>() { return "AIEventTownFounded"; }
+template <> const char *GetClassName<ScriptEventTownFounded, ST_AI>() { return "AIEventTownFounded"; }
 
 void SQAIEventTownFounded_Register(Squirrel *engine)
 {
-	DefSQClass<AIEventTownFounded, ST_AI> SQAIEventTownFounded("AIEventTownFounded");
+	DefSQClass<ScriptEventTownFounded, ST_AI> SQAIEventTownFounded("AIEventTownFounded");
 	SQAIEventTownFounded.PreRegister(engine, "AIEvent");
 
-	SQAIEventTownFounded.DefSQStaticMethod(engine, &AIEventTownFounded::Convert, "Convert", 2, ".x");
+	SQAIEventTownFounded.DefSQStaticMethod(engine, &ScriptEventTownFounded::Convert, "Convert", 2, ".x");
 
-	SQAIEventTownFounded.DefSQMethod(engine, &AIEventTownFounded::GetTownID, "GetTownID", 1, "x");
+	SQAIEventTownFounded.DefSQMethod(engine, &ScriptEventTownFounded::GetTownID, "GetTownID", 1, "x");
 
 	SQAIEventTownFounded.PostRegister(engine);
 }
--- a/src/ai/api/ai_execmode.hpp.sq
+++ b/src/ai/api/ai_execmode.hpp.sq
@@ -12,21 +12,21 @@
 #include "../../script/api/script_execmode.hpp"
 
 namespace SQConvert {
-	/* Allow AIExecMode to be used as Squirrel parameter */
-	template <> inline AIExecMode *GetParam(ForceType<AIExecMode *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIExecMode *)instance; }
-	template <> inline AIExecMode &GetParam(ForceType<AIExecMode &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIExecMode *)instance; }
-	template <> inline const AIExecMode *GetParam(ForceType<const AIExecMode *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIExecMode *)instance; }
-	template <> inline const AIExecMode &GetParam(ForceType<const AIExecMode &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIExecMode *)instance; }
-	template <> inline int Return<AIExecMode *>(HSQUIRRELVM vm, AIExecMode *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "ExecMode", res, NULL, DefSQDestructorCallback<AIExecMode>, true); return 1; }
+	/* Allow ScriptExecMode to be used as Squirrel parameter */
+	template <> inline ScriptExecMode *GetParam(ForceType<ScriptExecMode *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptExecMode *)instance; }
+	template <> inline ScriptExecMode &GetParam(ForceType<ScriptExecMode &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptExecMode *)instance; }
+	template <> inline const ScriptExecMode *GetParam(ForceType<const ScriptExecMode *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptExecMode *)instance; }
+	template <> inline const ScriptExecMode &GetParam(ForceType<const ScriptExecMode &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptExecMode *)instance; }
+	template <> inline int Return<ScriptExecMode *>(HSQUIRRELVM vm, ScriptExecMode *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "ExecMode", res, NULL, DefSQDestructorCallback<ScriptExecMode>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIExecMode, ST_AI>() { return "AIExecMode"; }
+template <> const char *GetClassName<ScriptExecMode, ST_AI>() { return "AIExecMode"; }
 
 void SQAIExecMode_Register(Squirrel *engine)
 {
-	DefSQClass<AIExecMode, ST_AI> SQAIExecMode("AIExecMode");
+	DefSQClass<ScriptExecMode, ST_AI> SQAIExecMode("AIExecMode");
 	SQAIExecMode.PreRegister(engine);
-	SQAIExecMode.AddConstructor<void (AIExecMode::*)(), 1>(engine, "x");
+	SQAIExecMode.AddConstructor<void (ScriptExecMode::*)(), 1>(engine, "x");
 
 	SQAIExecMode.PostRegister(engine);
 }
--- a/src/ai/api/ai_gamesettings.hpp.sq
+++ b/src/ai/api/ai_gamesettings.hpp.sq
@@ -12,25 +12,25 @@
 #include "../../script/api/script_gamesettings.hpp"
 
 namespace SQConvert {
-	/* Allow AIGameSettings to be used as Squirrel parameter */
-	template <> inline AIGameSettings *GetParam(ForceType<AIGameSettings *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIGameSettings *)instance; }
-	template <> inline AIGameSettings &GetParam(ForceType<AIGameSettings &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIGameSettings *)instance; }
-	template <> inline const AIGameSettings *GetParam(ForceType<const AIGameSettings *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIGameSettings *)instance; }
-	template <> inline const AIGameSettings &GetParam(ForceType<const AIGameSettings &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIGameSettings *)instance; }
-	template <> inline int Return<AIGameSettings *>(HSQUIRRELVM vm, AIGameSettings *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "GameSettings", res, NULL, DefSQDestructorCallback<AIGameSettings>, true); return 1; }
+	/* Allow ScriptGameSettings to be used as Squirrel parameter */
+	template <> inline ScriptGameSettings *GetParam(ForceType<ScriptGameSettings *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptGameSettings *)instance; }
+	template <> inline ScriptGameSettings &GetParam(ForceType<ScriptGameSettings &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptGameSettings *)instance; }
+	template <> inline const ScriptGameSettings *GetParam(ForceType<const ScriptGameSettings *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptGameSettings *)instance; }
+	template <> inline const ScriptGameSettings &GetParam(ForceType<const ScriptGameSettings &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptGameSettings *)instance; }
+	template <> inline int Return<ScriptGameSettings *>(HSQUIRRELVM vm, ScriptGameSettings *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "GameSettings", res, NULL, DefSQDestructorCallback<ScriptGameSettings>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIGameSettings, ST_AI>() { return "AIGameSettings"; }
+template <> const char *GetClassName<ScriptGameSettings, ST_AI>() { return "AIGameSettings"; }
 
 void SQAIGameSettings_Register(Squirrel *engine)
 {
-	DefSQClass<AIGameSettings, ST_AI> SQAIGameSettings("AIGameSettings");
+	DefSQClass<ScriptGameSettings, ST_AI> SQAIGameSettings("AIGameSettings");
 	SQAIGameSettings.PreRegister(engine);
-	SQAIGameSettings.AddConstructor<void (AIGameSettings::*)(), 1>(engine, "x");
+	SQAIGameSettings.AddConstructor<void (ScriptGameSettings::*)(), 1>(engine, "x");
 
-	SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::IsValid,               "IsValid",               2, "..");
-	SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::GetValue,              "GetValue",              2, "..");
-	SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::IsDisabledVehicleType, "IsDisabledVehicleType", 2, ".i");
+	SQAIGameSettings.DefSQStaticMethod(engine, &ScriptGameSettings::IsValid,               "IsValid",               2, "..");
+	SQAIGameSettings.DefSQStaticMethod(engine, &ScriptGameSettings::GetValue,              "GetValue",              2, "..");
+	SQAIGameSettings.DefSQStaticMethod(engine, &ScriptGameSettings::IsDisabledVehicleType, "IsDisabledVehicleType", 2, ".i");
 
 	SQAIGameSettings.PostRegister(engine);
 }
--- a/src/ai/api/ai_group.hpp.sq
+++ b/src/ai/api/ai_group.hpp.sq
@@ -13,44 +13,44 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIGroup::GroupID GetParam(ForceType<AIGroup::GroupID>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIGroup::GroupID)tmp; }
-	template <> inline int Return<AIGroup::GroupID>(HSQUIRRELVM vm, AIGroup::GroupID res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptGroup::GroupID GetParam(ForceType<ScriptGroup::GroupID>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptGroup::GroupID)tmp; }
+	template <> inline int Return<ScriptGroup::GroupID>(HSQUIRRELVM vm, ScriptGroup::GroupID res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIGroup to be used as Squirrel parameter */
-	template <> inline AIGroup *GetParam(ForceType<AIGroup *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIGroup *)instance; }
-	template <> inline AIGroup &GetParam(ForceType<AIGroup &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIGroup *)instance; }
-	template <> inline const AIGroup *GetParam(ForceType<const AIGroup *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIGroup *)instance; }
-	template <> inline const AIGroup &GetParam(ForceType<const AIGroup &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIGroup *)instance; }
-	template <> inline int Return<AIGroup *>(HSQUIRRELVM vm, AIGroup *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Group", res, NULL, DefSQDestructorCallback<AIGroup>, true); return 1; }
+	/* Allow ScriptGroup to be used as Squirrel parameter */
+	template <> inline ScriptGroup *GetParam(ForceType<ScriptGroup *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptGroup *)instance; }
+	template <> inline ScriptGroup &GetParam(ForceType<ScriptGroup &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptGroup *)instance; }
+	template <> inline const ScriptGroup *GetParam(ForceType<const ScriptGroup *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptGroup *)instance; }
+	template <> inline const ScriptGroup &GetParam(ForceType<const ScriptGroup &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptGroup *)instance; }
+	template <> inline int Return<ScriptGroup *>(HSQUIRRELVM vm, ScriptGroup *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Group", res, NULL, DefSQDestructorCallback<ScriptGroup>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIGroup, ST_AI>() { return "AIGroup"; }
+template <> const char *GetClassName<ScriptGroup, ST_AI>() { return "AIGroup"; }
 
 void SQAIGroup_Register(Squirrel *engine)
 {
-	DefSQClass<AIGroup, ST_AI> SQAIGroup("AIGroup");
+	DefSQClass<ScriptGroup, ST_AI> SQAIGroup("AIGroup");
 	SQAIGroup.PreRegister(engine);
-	SQAIGroup.AddConstructor<void (AIGroup::*)(), 1>(engine, "x");
+	SQAIGroup.AddConstructor<void (ScriptGroup::*)(), 1>(engine, "x");
 
-	SQAIGroup.DefSQConst(engine, AIGroup::GROUP_ALL,     "GROUP_ALL");
-	SQAIGroup.DefSQConst(engine, AIGroup::GROUP_DEFAULT, "GROUP_DEFAULT");
-	SQAIGroup.DefSQConst(engine, AIGroup::GROUP_INVALID, "GROUP_INVALID");
+	SQAIGroup.DefSQConst(engine, ScriptGroup::GROUP_ALL,     "GROUP_ALL");
+	SQAIGroup.DefSQConst(engine, ScriptGroup::GROUP_DEFAULT, "GROUP_DEFAULT");
+	SQAIGroup.DefSQConst(engine, ScriptGroup::GROUP_INVALID, "GROUP_INVALID");
 
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::IsValidGroup,                "IsValidGroup",                2, ".i");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::CreateGroup,                 "CreateGroup",                 2, ".i");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::DeleteGroup,                 "DeleteGroup",                 2, ".i");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetVehicleType,              "GetVehicleType",              2, ".i");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::SetName,                     "SetName",                     3, ".i.");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetName,                     "GetName",                     2, ".i");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::EnableAutoReplaceProtection, "EnableAutoReplaceProtection", 3, ".ib");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetAutoReplaceProtection,    "GetAutoReplaceProtection",    2, ".i");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetNumEngines,               "GetNumEngines",               3, ".ii");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::MoveVehicle,                 "MoveVehicle",                 3, ".ii");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::EnableWagonRemoval,          "EnableWagonRemoval",          2, ".b");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::HasWagonRemoval,             "HasWagonRemoval",             1, ".");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::SetAutoReplace,              "SetAutoReplace",              4, ".iii");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetEngineReplacement,        "GetEngineReplacement",        3, ".ii");
-	SQAIGroup.DefSQStaticMethod(engine, &AIGroup::StopAutoReplace,             "StopAutoReplace",             3, ".ii");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::IsValidGroup,                "IsValidGroup",                2, ".i");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::CreateGroup,                 "CreateGroup",                 2, ".i");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::DeleteGroup,                 "DeleteGroup",                 2, ".i");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::GetVehicleType,              "GetVehicleType",              2, ".i");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::SetName,                     "SetName",                     3, ".i.");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::GetName,                     "GetName",                     2, ".i");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::EnableAutoReplaceProtection, "EnableAutoReplaceProtection", 3, ".ib");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::GetAutoReplaceProtection,    "GetAutoReplaceProtection",    2, ".i");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::GetNumEngines,               "GetNumEngines",               3, ".ii");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::MoveVehicle,                 "MoveVehicle",                 3, ".ii");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::EnableWagonRemoval,          "EnableWagonRemoval",          2, ".b");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::HasWagonRemoval,             "HasWagonRemoval",             1, ".");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::SetAutoReplace,              "SetAutoReplace",              4, ".iii");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::GetEngineReplacement,        "GetEngineReplacement",        3, ".ii");
+	SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::StopAutoReplace,             "StopAutoReplace",             3, ".ii");
 
 	SQAIGroup.PostRegister(engine);
 }
--- a/src/ai/api/ai_grouplist.hpp.sq
+++ b/src/ai/api/ai_grouplist.hpp.sq
@@ -12,21 +12,21 @@
 #include "../../script/api/script_grouplist.hpp"
 
 namespace SQConvert {
-	/* Allow AIGroupList to be used as Squirrel parameter */
-	template <> inline AIGroupList *GetParam(ForceType<AIGroupList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIGroupList *)instance; }
-	template <> inline AIGroupList &GetParam(ForceType<AIGroupList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIGroupList *)instance; }
-	template <> inline const AIGroupList *GetParam(ForceType<const AIGroupList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIGroupList *)instance; }
-	template <> inline const AIGroupList &GetParam(ForceType<const AIGroupList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIGroupList *)instance; }
-	template <> inline int Return<AIGroupList *>(HSQUIRRELVM vm, AIGroupList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "GroupList", res, NULL, DefSQDestructorCallback<AIGroupList>, true); return 1; }
+	/* Allow ScriptGroupList to be used as Squirrel parameter */
+	template <> inline ScriptGroupList *GetParam(ForceType<ScriptGroupList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptGroupList *)instance; }
+	template <> inline ScriptGroupList &GetParam(ForceType<ScriptGroupList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptGroupList *)instance; }
+	template <> inline const ScriptGroupList *GetParam(ForceType<const ScriptGroupList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptGroupList *)instance; }
+	template <> inline const ScriptGroupList &GetParam(ForceType<const ScriptGroupList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptGroupList *)instance; }
+	template <> inline int Return<ScriptGroupList *>(HSQUIRRELVM vm, ScriptGroupList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "GroupList", res, NULL, DefSQDestructorCallback<ScriptGroupList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIGroupList, ST_AI>() { return "AIGroupList"; }
+template <> const char *GetClassName<ScriptGroupList, ST_AI>() { return "AIGroupList"; }
 
 void SQAIGroupList_Register(Squirrel *engine)
 {
-	DefSQClass<AIGroupList, ST_AI> SQAIGroupList("AIGroupList");
+	DefSQClass<ScriptGroupList, ST_AI> SQAIGroupList("AIGroupList");
 	SQAIGroupList.PreRegister(engine, "AIList");
-	SQAIGroupList.AddConstructor<void (AIGroupList::*)(), 1>(engine, "x");
+	SQAIGroupList.AddConstructor<void (ScriptGroupList::*)(), 1>(engine, "x");
 
 	SQAIGroupList.PostRegister(engine);
 }
--- a/src/ai/api/ai_industry.hpp.sq
+++ b/src/ai/api/ai_industry.hpp.sq
@@ -13,48 +13,48 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIIndustry::CargoAcceptState GetParam(ForceType<AIIndustry::CargoAcceptState>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIIndustry::CargoAcceptState)tmp; }
-	template <> inline int Return<AIIndustry::CargoAcceptState>(HSQUIRRELVM vm, AIIndustry::CargoAcceptState res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptIndustry::CargoAcceptState GetParam(ForceType<ScriptIndustry::CargoAcceptState>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptIndustry::CargoAcceptState)tmp; }
+	template <> inline int Return<ScriptIndustry::CargoAcceptState>(HSQUIRRELVM vm, ScriptIndustry::CargoAcceptState res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIIndustry to be used as Squirrel parameter */
-	template <> inline AIIndustry *GetParam(ForceType<AIIndustry *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIIndustry *)instance; }
-	template <> inline AIIndustry &GetParam(ForceType<AIIndustry &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIIndustry *)instance; }
-	template <> inline const AIIndustry *GetParam(ForceType<const AIIndustry *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIIndustry *)instance; }
-	template <> inline const AIIndustry &GetParam(ForceType<const AIIndustry &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIIndustry *)instance; }
-	template <> inline int Return<AIIndustry *>(HSQUIRRELVM vm, AIIndustry *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Industry", res, NULL, DefSQDestructorCallback<AIIndustry>, true); return 1; }
+	/* Allow ScriptIndustry to be used as Squirrel parameter */
+	template <> inline ScriptIndustry *GetParam(ForceType<ScriptIndustry *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptIndustry *)instance; }
+	template <> inline ScriptIndustry &GetParam(ForceType<ScriptIndustry &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustry *)instance; }
+	template <> inline const ScriptIndustry *GetParam(ForceType<const ScriptIndustry *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptIndustry *)instance; }
+	template <> inline const ScriptIndustry &GetParam(ForceType<const ScriptIndustry &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustry *)instance; }
+	template <> inline int Return<ScriptIndustry *>(HSQUIRRELVM vm, ScriptIndustry *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Industry", res, NULL, DefSQDestructorCallback<ScriptIndustry>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIIndustry, ST_AI>() { return "AIIndustry"; }
+template <> const char *GetClassName<ScriptIndustry, ST_AI>() { return "AIIndustry"; }
 
 void SQAIIndustry_Register(Squirrel *engine)
 {
-	DefSQClass<AIIndustry, ST_AI> SQAIIndustry("AIIndustry");
+	DefSQClass<ScriptIndustry, ST_AI> SQAIIndustry("AIIndustry");
 	SQAIIndustry.PreRegister(engine);
-	SQAIIndustry.AddConstructor<void (AIIndustry::*)(), 1>(engine, "x");
+	SQAIIndustry.AddConstructor<void (ScriptIndustry::*)(), 1>(engine, "x");
 
-	SQAIIndustry.DefSQConst(engine, AIIndustry::CAS_NOT_ACCEPTED, "CAS_NOT_ACCEPTED");
-	SQAIIndustry.DefSQConst(engine, AIIndustry::CAS_ACCEPTED,     "CAS_ACCEPTED");
-	SQAIIndustry.DefSQConst(engine, AIIndustry::CAS_TEMP_REFUSED, "CAS_TEMP_REFUSED");
+	SQAIIndustry.DefSQConst(engine, ScriptIndustry::CAS_NOT_ACCEPTED, "CAS_NOT_ACCEPTED");
+	SQAIIndustry.DefSQConst(engine, ScriptIndustry::CAS_ACCEPTED,     "CAS_ACCEPTED");
+	SQAIIndustry.DefSQConst(engine, ScriptIndustry::CAS_TEMP_REFUSED, "CAS_TEMP_REFUSED");
 
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetIndustryCount,                  "GetIndustryCount",                  1, ".");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsValidIndustry,                   "IsValidIndustry",                   2, ".i");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetIndustryID,                     "GetIndustryID",                     2, ".i");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetName,                           "GetName",                           2, ".i");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsCargoAccepted,                   "IsCargoAccepted",                   3, ".ii");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetStockpiledCargo,                "GetStockpiledCargo",                3, ".ii");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLastMonthProduction,            "GetLastMonthProduction",            3, ".ii");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLastMonthTransported,           "GetLastMonthTransported",           3, ".ii");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLastMonthTransportedPercentage, "GetLastMonthTransportedPercentage", 3, ".ii");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLocation,                       "GetLocation",                       2, ".i");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetAmountOfStationsAround,         "GetAmountOfStationsAround",         2, ".i");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDistanceManhattanToTile,        "GetDistanceManhattanToTile",        3, ".ii");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDistanceSquareToTile,           "GetDistanceSquareToTile",           3, ".ii");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsBuiltOnWater,                    "IsBuiltOnWater",                    2, ".i");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::HasHeliport,                       "HasHeliport",                       2, ".i");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetHeliportLocation,               "GetHeliportLocation",               2, ".i");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::HasDock,                           "HasDock",                           2, ".i");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDockLocation,                   "GetDockLocation",                   2, ".i");
-	SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetIndustryType,                   "GetIndustryType",                   2, ".i");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetIndustryCount,                  "GetIndustryCount",                  1, ".");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::IsValidIndustry,                   "IsValidIndustry",                   2, ".i");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetIndustryID,                     "GetIndustryID",                     2, ".i");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetName,                           "GetName",                           2, ".i");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::IsCargoAccepted,                   "IsCargoAccepted",                   3, ".ii");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetStockpiledCargo,                "GetStockpiledCargo",                3, ".ii");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetLastMonthProduction,            "GetLastMonthProduction",            3, ".ii");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetLastMonthTransported,           "GetLastMonthTransported",           3, ".ii");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetLastMonthTransportedPercentage, "GetLastMonthTransportedPercentage", 3, ".ii");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetLocation,                       "GetLocation",                       2, ".i");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetAmountOfStationsAround,         "GetAmountOfStationsAround",         2, ".i");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetDistanceManhattanToTile,        "GetDistanceManhattanToTile",        3, ".ii");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetDistanceSquareToTile,           "GetDistanceSquareToTile",           3, ".ii");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::IsBuiltOnWater,                    "IsBuiltOnWater",                    2, ".i");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::HasHeliport,                       "HasHeliport",                       2, ".i");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetHeliportLocation,               "GetHeliportLocation",               2, ".i");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::HasDock,                           "HasDock",                           2, ".i");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetDockLocation,                   "GetDockLocation",                   2, ".i");
+	SQAIIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetIndustryType,                   "GetIndustryType",                   2, ".i");
 
 	SQAIIndustry.PostRegister(engine);
 }
--- a/src/ai/api/ai_industrylist.hpp.sq
+++ b/src/ai/api/ai_industrylist.hpp.sq
@@ -12,61 +12,61 @@
 #include "../../script/api/script_industrylist.hpp"
 
 namespace SQConvert {
-	/* Allow AIIndustryList to be used as Squirrel parameter */
-	template <> inline AIIndustryList *GetParam(ForceType<AIIndustryList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIIndustryList *)instance; }
-	template <> inline AIIndustryList &GetParam(ForceType<AIIndustryList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIIndustryList *)instance; }
-	template <> inline const AIIndustryList *GetParam(ForceType<const AIIndustryList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIIndustryList *)instance; }
-	template <> inline const AIIndustryList &GetParam(ForceType<const AIIndustryList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIIndustryList *)instance; }
-	template <> inline int Return<AIIndustryList *>(HSQUIRRELVM vm, AIIndustryList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryList", res, NULL, DefSQDestructorCallback<AIIndustryList>, true); return 1; }
+	/* Allow ScriptIndustryList to be used as Squirrel parameter */
+	template <> inline ScriptIndustryList *GetParam(ForceType<ScriptIndustryList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptIndustryList *)instance; }
+	template <> inline ScriptIndustryList &GetParam(ForceType<ScriptIndustryList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryList *)instance; }
+	template <> inline const ScriptIndustryList *GetParam(ForceType<const ScriptIndustryList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptIndustryList *)instance; }
+	template <> inline const ScriptIndustryList &GetParam(ForceType<const ScriptIndustryList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryList *)instance; }
+	template <> inline int Return<ScriptIndustryList *>(HSQUIRRELVM vm, ScriptIndustryList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryList", res, NULL, DefSQDestructorCallback<ScriptIndustryList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIIndustryList, ST_AI>() { return "AIIndustryList"; }
+template <> const char *GetClassName<ScriptIndustryList, ST_AI>() { return "AIIndustryList"; }
 
 void SQAIIndustryList_Register(Squirrel *engine)
 {
-	DefSQClass<AIIndustryList, ST_AI> SQAIIndustryList("AIIndustryList");
+	DefSQClass<ScriptIndustryList, ST_AI> SQAIIndustryList("AIIndustryList");
 	SQAIIndustryList.PreRegister(engine, "AIList");
-	SQAIIndustryList.AddConstructor<void (AIIndustryList::*)(), 1>(engine, "x");
+	SQAIIndustryList.AddConstructor<void (ScriptIndustryList::*)(), 1>(engine, "x");
 
 	SQAIIndustryList.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIIndustryList_CargoAccepting to be used as Squirrel parameter */
-	template <> inline AIIndustryList_CargoAccepting *GetParam(ForceType<AIIndustryList_CargoAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIIndustryList_CargoAccepting *)instance; }
-	template <> inline AIIndustryList_CargoAccepting &GetParam(ForceType<AIIndustryList_CargoAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIIndustryList_CargoAccepting *)instance; }
-	template <> inline const AIIndustryList_CargoAccepting *GetParam(ForceType<const AIIndustryList_CargoAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIIndustryList_CargoAccepting *)instance; }
-	template <> inline const AIIndustryList_CargoAccepting &GetParam(ForceType<const AIIndustryList_CargoAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIIndustryList_CargoAccepting *)instance; }
-	template <> inline int Return<AIIndustryList_CargoAccepting *>(HSQUIRRELVM vm, AIIndustryList_CargoAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryList_CargoAccepting", res, NULL, DefSQDestructorCallback<AIIndustryList_CargoAccepting>, true); return 1; }
+	/* Allow ScriptIndustryList_CargoAccepting to be used as Squirrel parameter */
+	template <> inline ScriptIndustryList_CargoAccepting *GetParam(ForceType<ScriptIndustryList_CargoAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptIndustryList_CargoAccepting *)instance; }
+	template <> inline ScriptIndustryList_CargoAccepting &GetParam(ForceType<ScriptIndustryList_CargoAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryList_CargoAccepting *)instance; }
+	template <> inline const ScriptIndustryList_CargoAccepting *GetParam(ForceType<const ScriptIndustryList_CargoAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptIndustryList_CargoAccepting *)instance; }
+	template <> inline const ScriptIndustryList_CargoAccepting &GetParam(ForceType<const ScriptIndustryList_CargoAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryList_CargoAccepting *)instance; }
+	template <> inline int Return<ScriptIndustryList_CargoAccepting *>(HSQUIRRELVM vm, ScriptIndustryList_CargoAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryList_CargoAccepting", res, NULL, DefSQDestructorCallback<ScriptIndustryList_CargoAccepting>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIIndustryList_CargoAccepting, ST_AI>() { return "AIIndustryList_CargoAccepting"; }
+template <> const char *GetClassName<ScriptIndustryList_CargoAccepting, ST_AI>() { return "AIIndustryList_CargoAccepting"; }
 
 void SQAIIndustryList_CargoAccepting_Register(Squirrel *engine)
 {
-	DefSQClass<AIIndustryList_CargoAccepting, ST_AI> SQAIIndustryList_CargoAccepting("AIIndustryList_CargoAccepting");
+	DefSQClass<ScriptIndustryList_CargoAccepting, ST_AI> SQAIIndustryList_CargoAccepting("AIIndustryList_CargoAccepting");
 	SQAIIndustryList_CargoAccepting.PreRegister(engine, "AIList");
-	SQAIIndustryList_CargoAccepting.AddConstructor<void (AIIndustryList_CargoAccepting::*)(CargoID cargo_id), 2>(engine, "xi");
+	SQAIIndustryList_CargoAccepting.AddConstructor<void (ScriptIndustryList_CargoAccepting::*)(CargoID cargo_id), 2>(engine, "xi");
 
 	SQAIIndustryList_CargoAccepting.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIIndustryList_CargoProducing to be used as Squirrel parameter */
-	template <> inline AIIndustryList_CargoProducing *GetParam(ForceType<AIIndustryList_CargoProducing *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIIndustryList_CargoProducing *)instance; }
-	template <> inline AIIndustryList_CargoProducing &GetParam(ForceType<AIIndustryList_CargoProducing &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIIndustryList_CargoProducing *)instance; }
-	template <> inline const AIIndustryList_CargoProducing *GetParam(ForceType<const AIIndustryList_CargoProducing *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIIndustryList_CargoProducing *)instance; }
-	template <> inline const AIIndustryList_CargoProducing &GetParam(ForceType<const AIIndustryList_CargoProducing &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIIndustryList_CargoProducing *)instance; }
-	template <> inline int Return<AIIndustryList_CargoProducing *>(HSQUIRRELVM vm, AIIndustryList_CargoProducing *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryList_CargoProducing", res, NULL, DefSQDestructorCallback<AIIndustryList_CargoProducing>, true); return 1; }
+	/* Allow ScriptIndustryList_CargoProducing to be used as Squirrel parameter */
+	template <> inline ScriptIndustryList_CargoProducing *GetParam(ForceType<ScriptIndustryList_CargoProducing *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptIndustryList_CargoProducing *)instance; }
+	template <> inline ScriptIndustryList_CargoProducing &GetParam(ForceType<ScriptIndustryList_CargoProducing &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryList_CargoProducing *)instance; }
+	template <> inline const ScriptIndustryList_CargoProducing *GetParam(ForceType<const ScriptIndustryList_CargoProducing *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptIndustryList_CargoProducing *)instance; }
+	template <> inline const ScriptIndustryList_CargoProducing &GetParam(ForceType<const ScriptIndustryList_CargoProducing &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryList_CargoProducing *)instance; }
+	template <> inline int Return<ScriptIndustryList_CargoProducing *>(HSQUIRRELVM vm, ScriptIndustryList_CargoProducing *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryList_CargoProducing", res, NULL, DefSQDestructorCallback<ScriptIndustryList_CargoProducing>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIIndustryList_CargoProducing, ST_AI>() { return "AIIndustryList_CargoProducing"; }
+template <> const char *GetClassName<ScriptIndustryList_CargoProducing, ST_AI>() { return "AIIndustryList_CargoProducing"; }
 
 void SQAIIndustryList_CargoProducing_Register(Squirrel *engine)
 {
-	DefSQClass<AIIndustryList_CargoProducing, ST_AI> SQAIIndustryList_CargoProducing("AIIndustryList_CargoProducing");
+	DefSQClass<ScriptIndustryList_CargoProducing, ST_AI> SQAIIndustryList_CargoProducing("AIIndustryList_CargoProducing");
 	SQAIIndustryList_CargoProducing.PreRegister(engine, "AIList");
-	SQAIIndustryList_CargoProducing.AddConstructor<void (AIIndustryList_CargoProducing::*)(CargoID cargo_id), 2>(engine, "xi");
+	SQAIIndustryList_CargoProducing.AddConstructor<void (ScriptIndustryList_CargoProducing::*)(CargoID cargo_id), 2>(engine, "xi");
 
 	SQAIIndustryList_CargoProducing.PostRegister(engine);
 }
--- a/src/ai/api/ai_industrytype.hpp.sq
+++ b/src/ai/api/ai_industrytype.hpp.sq
@@ -13,42 +13,42 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIIndustryType::SpecialIndustryType GetParam(ForceType<AIIndustryType::SpecialIndustryType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIIndustryType::SpecialIndustryType)tmp; }
-	template <> inline int Return<AIIndustryType::SpecialIndustryType>(HSQUIRRELVM vm, AIIndustryType::SpecialIndustryType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptIndustryType::SpecialIndustryType GetParam(ForceType<ScriptIndustryType::SpecialIndustryType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptIndustryType::SpecialIndustryType)tmp; }
+	template <> inline int Return<ScriptIndustryType::SpecialIndustryType>(HSQUIRRELVM vm, ScriptIndustryType::SpecialIndustryType res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIIndustryType to be used as Squirrel parameter */
-	template <> inline AIIndustryType *GetParam(ForceType<AIIndustryType *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIIndustryType *)instance; }
-	template <> inline AIIndustryType &GetParam(ForceType<AIIndustryType &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIIndustryType *)instance; }
-	template <> inline const AIIndustryType *GetParam(ForceType<const AIIndustryType *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIIndustryType *)instance; }
-	template <> inline const AIIndustryType &GetParam(ForceType<const AIIndustryType &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIIndustryType *)instance; }
-	template <> inline int Return<AIIndustryType *>(HSQUIRRELVM vm, AIIndustryType *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryType", res, NULL, DefSQDestructorCallback<AIIndustryType>, true); return 1; }
+	/* Allow ScriptIndustryType to be used as Squirrel parameter */
+	template <> inline ScriptIndustryType *GetParam(ForceType<ScriptIndustryType *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptIndustryType *)instance; }
+	template <> inline ScriptIndustryType &GetParam(ForceType<ScriptIndustryType &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryType *)instance; }
+	template <> inline const ScriptIndustryType *GetParam(ForceType<const ScriptIndustryType *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptIndustryType *)instance; }
+	template <> inline const ScriptIndustryType &GetParam(ForceType<const ScriptIndustryType &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryType *)instance; }
+	template <> inline int Return<ScriptIndustryType *>(HSQUIRRELVM vm, ScriptIndustryType *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryType", res, NULL, DefSQDestructorCallback<ScriptIndustryType>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIIndustryType, ST_AI>() { return "AIIndustryType"; }
+template <> const char *GetClassName<ScriptIndustryType, ST_AI>() { return "AIIndustryType"; }
 
 void SQAIIndustryType_Register(Squirrel *engine)
 {
-	DefSQClass<AIIndustryType, ST_AI> SQAIIndustryType("AIIndustryType");
+	DefSQClass<ScriptIndustryType, ST_AI> SQAIIndustryType("AIIndustryType");
 	SQAIIndustryType.PreRegister(engine);
-	SQAIIndustryType.AddConstructor<void (AIIndustryType::*)(), 1>(engine, "x");
+	SQAIIndustryType.AddConstructor<void (ScriptIndustryType::*)(), 1>(engine, "x");
 
-	SQAIIndustryType.DefSQConst(engine, AIIndustryType::INDUSTRYTYPE_UNKNOWN, "INDUSTRYTYPE_UNKNOWN");
-	SQAIIndustryType.DefSQConst(engine, AIIndustryType::INDUSTRYTYPE_TOWN,    "INDUSTRYTYPE_TOWN");
+	SQAIIndustryType.DefSQConst(engine, ScriptIndustryType::INDUSTRYTYPE_UNKNOWN, "INDUSTRYTYPE_UNKNOWN");
+	SQAIIndustryType.DefSQConst(engine, ScriptIndustryType::INDUSTRYTYPE_TOWN,    "INDUSTRYTYPE_TOWN");
 
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::IsValidIndustryType,   "IsValidIndustryType",   2, ".i");
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::GetName,               "GetName",               2, ".i");
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::GetProducedCargo,      "GetProducedCargo",      2, ".i");
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::GetAcceptedCargo,      "GetAcceptedCargo",      2, ".i");
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::IsRawIndustry,         "IsRawIndustry",         2, ".i");
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::ProductionCanIncrease, "ProductionCanIncrease", 2, ".i");
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::GetConstructionCost,   "GetConstructionCost",   2, ".i");
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::CanBuildIndustry,      "CanBuildIndustry",      2, ".i");
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::CanProspectIndustry,   "CanProspectIndustry",   2, ".i");
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::BuildIndustry,         "BuildIndustry",         3, ".ii");
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::ProspectIndustry,      "ProspectIndustry",      2, ".i");
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::IsBuiltOnWater,        "IsBuiltOnWater",        2, ".i");
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::HasHeliport,           "HasHeliport",           2, ".i");
-	SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::HasDock,               "HasDock",               2, ".i");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::IsValidIndustryType,   "IsValidIndustryType",   2, ".i");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetName,               "GetName",               2, ".i");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetProducedCargo,      "GetProducedCargo",      2, ".i");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetAcceptedCargo,      "GetAcceptedCargo",      2, ".i");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::IsRawIndustry,         "IsRawIndustry",         2, ".i");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::ProductionCanIncrease, "ProductionCanIncrease", 2, ".i");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetConstructionCost,   "GetConstructionCost",   2, ".i");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::CanBuildIndustry,      "CanBuildIndustry",      2, ".i");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::CanProspectIndustry,   "CanProspectIndustry",   2, ".i");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::BuildIndustry,         "BuildIndustry",         3, ".ii");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::ProspectIndustry,      "ProspectIndustry",      2, ".i");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::IsBuiltOnWater,        "IsBuiltOnWater",        2, ".i");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::HasHeliport,           "HasHeliport",           2, ".i");
+	SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::HasDock,               "HasDock",               2, ".i");
 
 	SQAIIndustryType.PostRegister(engine);
 }
--- a/src/ai/api/ai_industrytypelist.hpp.sq
+++ b/src/ai/api/ai_industrytypelist.hpp.sq
@@ -12,21 +12,21 @@
 #include "../../script/api/script_industrytypelist.hpp"
 
 namespace SQConvert {
-	/* Allow AIIndustryTypeList to be used as Squirrel parameter */
-	template <> inline AIIndustryTypeList *GetParam(ForceType<AIIndustryTypeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIIndustryTypeList *)instance; }
-	template <> inline AIIndustryTypeList &GetParam(ForceType<AIIndustryTypeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIIndustryTypeList *)instance; }
-	template <> inline const AIIndustryTypeList *GetParam(ForceType<const AIIndustryTypeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIIndustryTypeList *)instance; }
-	template <> inline const AIIndustryTypeList &GetParam(ForceType<const AIIndustryTypeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIIndustryTypeList *)instance; }
-	template <> inline int Return<AIIndustryTypeList *>(HSQUIRRELVM vm, AIIndustryTypeList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryTypeList", res, NULL, DefSQDestructorCallback<AIIndustryTypeList>, true); return 1; }
+	/* Allow ScriptIndustryTypeList to be used as Squirrel parameter */
+	template <> inline ScriptIndustryTypeList *GetParam(ForceType<ScriptIndustryTypeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptIndustryTypeList *)instance; }
+	template <> inline ScriptIndustryTypeList &GetParam(ForceType<ScriptIndustryTypeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryTypeList *)instance; }
+	template <> inline const ScriptIndustryTypeList *GetParam(ForceType<const ScriptIndustryTypeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptIndustryTypeList *)instance; }
+	template <> inline const ScriptIndustryTypeList &GetParam(ForceType<const ScriptIndustryTypeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryTypeList *)instance; }
+	template <> inline int Return<ScriptIndustryTypeList *>(HSQUIRRELVM vm, ScriptIndustryTypeList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryTypeList", res, NULL, DefSQDestructorCallback<ScriptIndustryTypeList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIIndustryTypeList, ST_AI>() { return "AIIndustryTypeList"; }
+template <> const char *GetClassName<ScriptIndustryTypeList, ST_AI>() { return "AIIndustryTypeList"; }
 
 void SQAIIndustryTypeList_Register(Squirrel *engine)
 {
-	DefSQClass<AIIndustryTypeList, ST_AI> SQAIIndustryTypeList("AIIndustryTypeList");
+	DefSQClass<ScriptIndustryTypeList, ST_AI> SQAIIndustryTypeList("AIIndustryTypeList");
 	SQAIIndustryTypeList.PreRegister(engine, "AIList");
-	SQAIIndustryTypeList.AddConstructor<void (AIIndustryTypeList::*)(), 1>(engine, "x");
+	SQAIIndustryTypeList.AddConstructor<void (ScriptIndustryTypeList::*)(), 1>(engine, "x");
 
 	SQAIIndustryTypeList.PostRegister(engine);
 }
--- a/src/ai/api/ai_list.hpp.sq
+++ b/src/ai/api/ai_list.hpp.sq
@@ -13,62 +13,62 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIList::SorterType GetParam(ForceType<AIList::SorterType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIList::SorterType)tmp; }
-	template <> inline int Return<AIList::SorterType>(HSQUIRRELVM vm, AIList::SorterType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptList::SorterType GetParam(ForceType<ScriptList::SorterType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptList::SorterType)tmp; }
+	template <> inline int Return<ScriptList::SorterType>(HSQUIRRELVM vm, ScriptList::SorterType res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIList to be used as Squirrel parameter */
-	template <> inline AIList *GetParam(ForceType<AIList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIList *)instance; }
-	template <> inline AIList &GetParam(ForceType<AIList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIList *)instance; }
-	template <> inline const AIList *GetParam(ForceType<const AIList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIList *)instance; }
-	template <> inline const AIList &GetParam(ForceType<const AIList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIList *)instance; }
-	template <> inline int Return<AIList *>(HSQUIRRELVM vm, AIList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "List", res, NULL, DefSQDestructorCallback<AIList>, true); return 1; }
+	/* Allow ScriptList to be used as Squirrel parameter */
+	template <> inline ScriptList *GetParam(ForceType<ScriptList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptList *)instance; }
+	template <> inline ScriptList &GetParam(ForceType<ScriptList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptList *)instance; }
+	template <> inline const ScriptList *GetParam(ForceType<const ScriptList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptList *)instance; }
+	template <> inline const ScriptList &GetParam(ForceType<const ScriptList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptList *)instance; }
+	template <> inline int Return<ScriptList *>(HSQUIRRELVM vm, ScriptList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "List", res, NULL, DefSQDestructorCallback<ScriptList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIList, ST_AI>() { return "AIList"; }
+template <> const char *GetClassName<ScriptList, ST_AI>() { return "AIList"; }
 
 void SQAIList_Register(Squirrel *engine)
 {
-	DefSQClass<AIList, ST_AI> SQAIList("AIList");
+	DefSQClass<ScriptList, ST_AI> SQAIList("AIList");
 	SQAIList.PreRegister(engine);
-	SQAIList.AddConstructor<void (AIList::*)(), 1>(engine, "x");
+	SQAIList.AddConstructor<void (ScriptList::*)(), 1>(engine, "x");
 
-	SQAIList.DefSQConst(engine, AIList::SORT_BY_VALUE, "SORT_BY_VALUE");
-	SQAIList.DefSQConst(engine, AIList::SORT_BY_ITEM,  "SORT_BY_ITEM");
+	SQAIList.DefSQConst(engine, ScriptList::SORT_BY_VALUE, "SORT_BY_VALUE");
+	SQAIList.DefSQConst(engine, ScriptList::SORT_BY_ITEM,  "SORT_BY_ITEM");
 
-	SQAIList.DefSQConst(engine, AIList::SORT_ASCENDING,  "SORT_ASCENDING");
-	SQAIList.DefSQConst(engine, AIList::SORT_DESCENDING, "SORT_DESCENDING");
+	SQAIList.DefSQConst(engine, ScriptList::SORT_ASCENDING,  "SORT_ASCENDING");
+	SQAIList.DefSQConst(engine, ScriptList::SORT_DESCENDING, "SORT_DESCENDING");
 
-	SQAIList.DefSQMethod(engine, &AIList::AddItem,            "AddItem",            3, "xii");
-	SQAIList.DefSQMethod(engine, &AIList::RemoveItem,         "RemoveItem",         2, "xi");
-	SQAIList.DefSQMethod(engine, &AIList::Clear,              "Clear",              1, "x");
-	SQAIList.DefSQMethod(engine, &AIList::HasItem,            "HasItem",            2, "xi");
-	SQAIList.DefSQMethod(engine, &AIList::Begin,              "Begin",              1, "x");
-	SQAIList.DefSQMethod(engine, &AIList::Next,               "Next",               1, "x");
-	SQAIList.DefSQMethod(engine, &AIList::IsEmpty,            "IsEmpty",            1, "x");
-	SQAIList.DefSQMethod(engine, &AIList::IsEnd,              "IsEnd",              1, "x");
-	SQAIList.DefSQMethod(engine, &AIList::Count,              "Count",              1, "x");
-	SQAIList.DefSQMethod(engine, &AIList::GetValue,           "GetValue",           2, "xi");
-	SQAIList.DefSQMethod(engine, &AIList::SetValue,           "SetValue",           3, "xii");
-	SQAIList.DefSQMethod(engine, &AIList::Sort,               "Sort",               3, "xib");
-	SQAIList.DefSQMethod(engine, &AIList::AddList,            "AddList",            2, "xx");
-	SQAIList.DefSQMethod(engine, &AIList::RemoveAboveValue,   "RemoveAboveValue",   2, "xi");
-	SQAIList.DefSQMethod(engine, &AIList::RemoveBelowValue,   "RemoveBelowValue",   2, "xi");
-	SQAIList.DefSQMethod(engine, &AIList::RemoveBetweenValue, "RemoveBetweenValue", 3, "xii");
-	SQAIList.DefSQMethod(engine, &AIList::RemoveValue,        "RemoveValue",        2, "xi");
-	SQAIList.DefSQMethod(engine, &AIList::RemoveTop,          "RemoveTop",          2, "xi");
-	SQAIList.DefSQMethod(engine, &AIList::RemoveBottom,       "RemoveBottom",       2, "xi");
-	SQAIList.DefSQMethod(engine, &AIList::RemoveList,         "RemoveList",         2, "xx");
-	SQAIList.DefSQMethod(engine, &AIList::KeepAboveValue,     "KeepAboveValue",     2, "xi");
-	SQAIList.DefSQMethod(engine, &AIList::KeepBelowValue,     "KeepBelowValue",     2, "xi");
-	SQAIList.DefSQMethod(engine, &AIList::KeepBetweenValue,   "KeepBetweenValue",   3, "xii");
-	SQAIList.DefSQMethod(engine, &AIList::KeepValue,          "KeepValue",          2, "xi");
-	SQAIList.DefSQMethod(engine, &AIList::KeepTop,            "KeepTop",            2, "xi");
-	SQAIList.DefSQMethod(engine, &AIList::KeepBottom,         "KeepBottom",         2, "xi");
-	SQAIList.DefSQMethod(engine, &AIList::KeepList,           "KeepList",           2, "xx");
-	SQAIList.DefSQAdvancedMethod(engine, &AIList::_get,       "_get");
-	SQAIList.DefSQAdvancedMethod(engine, &AIList::_set,       "_set");
-	SQAIList.DefSQAdvancedMethod(engine, &AIList::_nexti,     "_nexti");
-	SQAIList.DefSQAdvancedMethod(engine, &AIList::Valuate,    "Valuate");
+	SQAIList.DefSQMethod(engine, &ScriptList::AddItem,            "AddItem",            3, "xii");
+	SQAIList.DefSQMethod(engine, &ScriptList::RemoveItem,         "RemoveItem",         2, "xi");
+	SQAIList.DefSQMethod(engine, &ScriptList::Clear,              "Clear",              1, "x");
+	SQAIList.DefSQMethod(engine, &ScriptList::HasItem,            "HasItem",            2, "xi");
+	SQAIList.DefSQMethod(engine, &ScriptList::Begin,              "Begin",              1, "x");
+	SQAIList.DefSQMethod(engine, &ScriptList::Next,               "Next",               1, "x");
+	SQAIList.DefSQMethod(engine, &ScriptList::IsEmpty,            "IsEmpty",            1, "x");
+	SQAIList.DefSQMethod(engine, &ScriptList::IsEnd,              "IsEnd",              1, "x");
+	SQAIList.DefSQMethod(engine, &ScriptList::Count,              "Count",              1, "x");
+	SQAIList.DefSQMethod(engine, &ScriptList::GetValue,           "GetValue",           2, "xi");
+	SQAIList.DefSQMethod(engine, &ScriptList::SetValue,           "SetValue",           3, "xii");
+	SQAIList.DefSQMethod(engine, &ScriptList::Sort,               "Sort",               3, "xib");
+	SQAIList.DefSQMethod(engine, &ScriptList::AddList,            "AddList",            2, "xx");
+	SQAIList.DefSQMethod(engine, &ScriptList::RemoveAboveValue,   "RemoveAboveValue",   2, "xi");
+	SQAIList.DefSQMethod(engine, &ScriptList::RemoveBelowValue,   "RemoveBelowValue",   2, "xi");
+	SQAIList.DefSQMethod(engine, &ScriptList::RemoveBetweenValue, "RemoveBetweenValue", 3, "xii");
+	SQAIList.DefSQMethod(engine, &ScriptList::RemoveValue,        "RemoveValue",        2, "xi");
+	SQAIList.DefSQMethod(engine, &ScriptList::RemoveTop,          "RemoveTop",          2, "xi");
+	SQAIList.DefSQMethod(engine, &ScriptList::RemoveBottom,       "RemoveBottom",       2, "xi");
+	SQAIList.DefSQMethod(engine, &ScriptList::RemoveList,         "RemoveList",         2, "xx");
+	SQAIList.DefSQMethod(engine, &ScriptList::KeepAboveValue,     "KeepAboveValue",     2, "xi");
+	SQAIList.DefSQMethod(engine, &ScriptList::KeepBelowValue,     "KeepBelowValue",     2, "xi");
+	SQAIList.DefSQMethod(engine, &ScriptList::KeepBetweenValue,   "KeepBetweenValue",   3, "xii");
+	SQAIList.DefSQMethod(engine, &ScriptList::KeepValue,          "KeepValue",          2, "xi");
+	SQAIList.DefSQMethod(engine, &ScriptList::KeepTop,            "KeepTop",            2, "xi");
+	SQAIList.DefSQMethod(engine, &ScriptList::KeepBottom,         "KeepBottom",         2, "xi");
+	SQAIList.DefSQMethod(engine, &ScriptList::KeepList,           "KeepList",           2, "xx");
+	SQAIList.DefSQAdvancedMethod(engine, &ScriptList::_get,       "_get");
+	SQAIList.DefSQAdvancedMethod(engine, &ScriptList::_set,       "_set");
+	SQAIList.DefSQAdvancedMethod(engine, &ScriptList::_nexti,     "_nexti");
+	SQAIList.DefSQAdvancedMethod(engine, &ScriptList::Valuate,    "Valuate");
 
 	SQAIList.PostRegister(engine);
 }
--- a/src/ai/api/ai_log.hpp.sq
+++ b/src/ai/api/ai_log.hpp.sq
@@ -12,25 +12,25 @@
 #include "../../script/api/script_log.hpp"
 
 namespace SQConvert {
-	/* Allow AILog to be used as Squirrel parameter */
-	template <> inline AILog *GetParam(ForceType<AILog *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AILog *)instance; }
-	template <> inline AILog &GetParam(ForceType<AILog &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AILog *)instance; }
-	template <> inline const AILog *GetParam(ForceType<const AILog *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AILog *)instance; }
-	template <> inline const AILog &GetParam(ForceType<const AILog &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AILog *)instance; }
-	template <> inline int Return<AILog *>(HSQUIRRELVM vm, AILog *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Log", res, NULL, DefSQDestructorCallback<AILog>, true); return 1; }
+	/* Allow ScriptLog to be used as Squirrel parameter */
+	template <> inline ScriptLog *GetParam(ForceType<ScriptLog *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptLog *)instance; }
+	template <> inline ScriptLog &GetParam(ForceType<ScriptLog &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptLog *)instance; }
+	template <> inline const ScriptLog *GetParam(ForceType<const ScriptLog *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptLog *)instance; }
+	template <> inline const ScriptLog &GetParam(ForceType<const ScriptLog &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptLog *)instance; }
+	template <> inline int Return<ScriptLog *>(HSQUIRRELVM vm, ScriptLog *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Log", res, NULL, DefSQDestructorCallback<ScriptLog>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AILog, ST_AI>() { return "AILog"; }
+template <> const char *GetClassName<ScriptLog, ST_AI>() { return "AILog"; }
 
 void SQAILog_Register(Squirrel *engine)
 {
-	DefSQClass<AILog, ST_AI> SQAILog("AILog");
+	DefSQClass<ScriptLog, ST_AI> SQAILog("AILog");
 	SQAILog.PreRegister(engine);
-	SQAILog.AddConstructor<void (AILog::*)(), 1>(engine, "x");
+	SQAILog.AddConstructor<void (ScriptLog::*)(), 1>(engine, "x");
 
-	SQAILog.DefSQStaticMethod(engine, &AILog::Info,    "Info",    2, "..");
-	SQAILog.DefSQStaticMethod(engine, &AILog::Warning, "Warning", 2, "..");
-	SQAILog.DefSQStaticMethod(engine, &AILog::Error,   "Error",   2, "..");
+	SQAILog.DefSQStaticMethod(engine, &ScriptLog::Info,    "Info",    2, "..");
+	SQAILog.DefSQStaticMethod(engine, &ScriptLog::Warning, "Warning", 2, "..");
+	SQAILog.DefSQStaticMethod(engine, &ScriptLog::Error,   "Error",   2, "..");
 
 	SQAILog.PostRegister(engine);
 }
--- a/src/ai/api/ai_map.hpp.sq
+++ b/src/ai/api/ai_map.hpp.sq
@@ -12,35 +12,35 @@
 #include "../../script/api/script_map.hpp"
 
 namespace SQConvert {
-	/* Allow AIMap to be used as Squirrel parameter */
-	template <> inline AIMap *GetParam(ForceType<AIMap *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIMap *)instance; }
-	template <> inline AIMap &GetParam(ForceType<AIMap &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIMap *)instance; }
-	template <> inline const AIMap *GetParam(ForceType<const AIMap *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIMap *)instance; }
-	template <> inline const AIMap &GetParam(ForceType<const AIMap &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIMap *)instance; }
-	template <> inline int Return<AIMap *>(HSQUIRRELVM vm, AIMap *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Map", res, NULL, DefSQDestructorCallback<AIMap>, true); return 1; }
+	/* Allow ScriptMap to be used as Squirrel parameter */
+	template <> inline ScriptMap *GetParam(ForceType<ScriptMap *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptMap *)instance; }
+	template <> inline ScriptMap &GetParam(ForceType<ScriptMap &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptMap *)instance; }
+	template <> inline const ScriptMap *GetParam(ForceType<const ScriptMap *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptMap *)instance; }
+	template <> inline const ScriptMap &GetParam(ForceType<const ScriptMap &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptMap *)instance; }
+	template <> inline int Return<ScriptMap *>(HSQUIRRELVM vm, ScriptMap *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Map", res, NULL, DefSQDestructorCallback<ScriptMap>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIMap, ST_AI>() { return "AIMap"; }
+template <> const char *GetClassName<ScriptMap, ST_AI>() { return "AIMap"; }
 
 void SQAIMap_Register(Squirrel *engine)
 {
-	DefSQClass<AIMap, ST_AI> SQAIMap("AIMap");
+	DefSQClass<ScriptMap, ST_AI> SQAIMap("AIMap");
 	SQAIMap.PreRegister(engine);
-	SQAIMap.AddConstructor<void (AIMap::*)(), 1>(engine, "x");
+	SQAIMap.AddConstructor<void (ScriptMap::*)(), 1>(engine, "x");
 
-	SQAIMap.DefSQConst(engine, AIMap::TILE_INVALID, "TILE_INVALID");
+	SQAIMap.DefSQConst(engine, ScriptMap::TILE_INVALID, "TILE_INVALID");
 
-	SQAIMap.DefSQStaticMethod(engine, &AIMap::IsValidTile,       "IsValidTile",       2, ".i");
-	SQAIMap.DefSQStaticMethod(engine, &AIMap::GetMapSize,        "GetMapSize",        1, ".");
-	SQAIMap.DefSQStaticMethod(engine, &AIMap::GetMapSizeX,       "GetMapSizeX",       1, ".");
-	SQAIMap.DefSQStaticMethod(engine, &AIMap::GetMapSizeY,       "GetMapSizeY",       1, ".");
-	SQAIMap.DefSQStaticMethod(engine, &AIMap::GetTileX,          "GetTileX",          2, ".i");
-	SQAIMap.DefSQStaticMethod(engine, &AIMap::GetTileY,          "GetTileY",          2, ".i");
-	SQAIMap.DefSQStaticMethod(engine, &AIMap::GetTileIndex,      "GetTileIndex",      3, ".ii");
-	SQAIMap.DefSQStaticMethod(engine, &AIMap::DistanceManhattan, "DistanceManhattan", 3, ".ii");
-	SQAIMap.DefSQStaticMethod(engine, &AIMap::DistanceMax,       "DistanceMax",       3, ".ii");
-	SQAIMap.DefSQStaticMethod(engine, &AIMap::DistanceSquare,    "DistanceSquare",    3, ".ii");
-	SQAIMap.DefSQStaticMethod(engine, &AIMap::DistanceFromEdge,  "DistanceFromEdge",  2, ".i");
+	SQAIMap.DefSQStaticMethod(engine, &ScriptMap::IsValidTile,       "IsValidTile",       2, ".i");
+	SQAIMap.DefSQStaticMethod(engine, &ScriptMap::GetMapSize,        "GetMapSize",        1, ".");
+	SQAIMap.DefSQStaticMethod(engine, &ScriptMap::GetMapSizeX,       "GetMapSizeX",       1, ".");
+	SQAIMap.DefSQStaticMethod(engine, &ScriptMap::GetMapSizeY,       "GetMapSizeY",       1, ".");
+	SQAIMap.DefSQStaticMethod(engine, &ScriptMap::GetTileX,          "GetTileX",          2, ".i");
+	SQAIMap.DefSQStaticMethod(engine, &ScriptMap::GetTileY,          "GetTileY",          2, ".i");
+	SQAIMap.DefSQStaticMethod(engine, &ScriptMap::GetTileIndex,      "GetTileIndex",      3, ".ii");
+	SQAIMap.DefSQStaticMethod(engine, &ScriptMap::DistanceManhattan, "DistanceManhattan", 3, ".ii");
+	SQAIMap.DefSQStaticMethod(engine, &ScriptMap::DistanceMax,       "DistanceMax",       3, ".ii");
+	SQAIMap.DefSQStaticMethod(engine, &ScriptMap::DistanceSquare,    "DistanceSquare",    3, ".ii");
+	SQAIMap.DefSQStaticMethod(engine, &ScriptMap::DistanceFromEdge,  "DistanceFromEdge",  2, ".i");
 
 	SQAIMap.PostRegister(engine);
 }
--- a/src/ai/api/ai_marine.hpp.sq
+++ b/src/ai/api/ai_marine.hpp.sq
@@ -13,54 +13,54 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIMarine::ErrorMessages GetParam(ForceType<AIMarine::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIMarine::ErrorMessages)tmp; }
-	template <> inline int Return<AIMarine::ErrorMessages>(HSQUIRRELVM vm, AIMarine::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIMarine::BuildType GetParam(ForceType<AIMarine::BuildType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIMarine::BuildType)tmp; }
-	template <> inline int Return<AIMarine::BuildType>(HSQUIRRELVM vm, AIMarine::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptMarine::ErrorMessages GetParam(ForceType<ScriptMarine::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptMarine::ErrorMessages)tmp; }
+	template <> inline int Return<ScriptMarine::ErrorMessages>(HSQUIRRELVM vm, ScriptMarine::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptMarine::BuildType GetParam(ForceType<ScriptMarine::BuildType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptMarine::BuildType)tmp; }
+	template <> inline int Return<ScriptMarine::BuildType>(HSQUIRRELVM vm, ScriptMarine::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIMarine to be used as Squirrel parameter */
-	template <> inline AIMarine *GetParam(ForceType<AIMarine *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIMarine *)instance; }
-	template <> inline AIMarine &GetParam(ForceType<AIMarine &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIMarine *)instance; }
-	template <> inline const AIMarine *GetParam(ForceType<const AIMarine *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIMarine *)instance; }
-	template <> inline const AIMarine &GetParam(ForceType<const AIMarine &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIMarine *)instance; }
-	template <> inline int Return<AIMarine *>(HSQUIRRELVM vm, AIMarine *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Marine", res, NULL, DefSQDestructorCallback<AIMarine>, true); return 1; }
+	/* Allow ScriptMarine to be used as Squirrel parameter */
+	template <> inline ScriptMarine *GetParam(ForceType<ScriptMarine *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptMarine *)instance; }
+	template <> inline ScriptMarine &GetParam(ForceType<ScriptMarine &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptMarine *)instance; }
+	template <> inline const ScriptMarine *GetParam(ForceType<const ScriptMarine *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptMarine *)instance; }
+	template <> inline const ScriptMarine &GetParam(ForceType<const ScriptMarine &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptMarine *)instance; }
+	template <> inline int Return<ScriptMarine *>(HSQUIRRELVM vm, ScriptMarine *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Marine", res, NULL, DefSQDestructorCallback<ScriptMarine>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIMarine, ST_AI>() { return "AIMarine"; }
+template <> const char *GetClassName<ScriptMarine, ST_AI>() { return "AIMarine"; }
 
 void SQAIMarine_Register(Squirrel *engine)
 {
-	DefSQClass<AIMarine, ST_AI> SQAIMarine("AIMarine");
+	DefSQClass<ScriptMarine, ST_AI> SQAIMarine("AIMarine");
 	SQAIMarine.PreRegister(engine);
-	SQAIMarine.AddConstructor<void (AIMarine::*)(), 1>(engine, "x");
+	SQAIMarine.AddConstructor<void (ScriptMarine::*)(), 1>(engine, "x");
 
-	SQAIMarine.DefSQConst(engine, AIMarine::ERR_MARINE_BASE,                   "ERR_MARINE_BASE");
-	SQAIMarine.DefSQConst(engine, AIMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER, "ERR_MARINE_MUST_BE_BUILT_ON_WATER");
-	SQAIMarine.DefSQConst(engine, AIMarine::BT_DOCK,                           "BT_DOCK");
-	SQAIMarine.DefSQConst(engine, AIMarine::BT_DEPOT,                          "BT_DEPOT");
-	SQAIMarine.DefSQConst(engine, AIMarine::BT_BUOY,                           "BT_BUOY");
+	SQAIMarine.DefSQConst(engine, ScriptMarine::ERR_MARINE_BASE,                   "ERR_MARINE_BASE");
+	SQAIMarine.DefSQConst(engine, ScriptMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER, "ERR_MARINE_MUST_BE_BUILT_ON_WATER");
+	SQAIMarine.DefSQConst(engine, ScriptMarine::BT_DOCK,                           "BT_DOCK");
+	SQAIMarine.DefSQConst(engine, ScriptMarine::BT_DEPOT,                          "BT_DEPOT");
+	SQAIMarine.DefSQConst(engine, ScriptMarine::BT_BUOY,                           "BT_BUOY");
 
-	AIError::RegisterErrorMap(STR_ERROR_MUST_BE_BUILT_ON_WATER, AIMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER);
+	ScriptError::RegisterErrorMap(STR_ERROR_MUST_BE_BUILT_ON_WATER, ScriptMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER);
 
-	AIError::RegisterErrorMapString(AIMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER, "ERR_MARINE_MUST_BE_BUILT_ON_WATER");
+	ScriptError::RegisterErrorMapString(ScriptMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER, "ERR_MARINE_MUST_BE_BUILT_ON_WATER");
 
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::IsWaterDepotTile,       "IsWaterDepotTile",       2, ".i");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::IsDockTile,             "IsDockTile",             2, ".i");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::IsBuoyTile,             "IsBuoyTile",             2, ".i");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::IsLockTile,             "IsLockTile",             2, ".i");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::IsCanalTile,            "IsCanalTile",            2, ".i");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::AreWaterTilesConnected, "AreWaterTilesConnected", 3, ".ii");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::BuildWaterDepot,        "BuildWaterDepot",        3, ".ii");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::BuildDock,              "BuildDock",              3, ".ii");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::BuildBuoy,              "BuildBuoy",              2, ".i");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::BuildLock,              "BuildLock",              2, ".i");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::BuildCanal,             "BuildCanal",             2, ".i");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::RemoveWaterDepot,       "RemoveWaterDepot",       2, ".i");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::RemoveDock,             "RemoveDock",             2, ".i");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::RemoveBuoy,             "RemoveBuoy",             2, ".i");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::RemoveLock,             "RemoveLock",             2, ".i");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::RemoveCanal,            "RemoveCanal",            2, ".i");
-	SQAIMarine.DefSQStaticMethod(engine, &AIMarine::GetBuildCost,           "GetBuildCost",           2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::IsWaterDepotTile,       "IsWaterDepotTile",       2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::IsDockTile,             "IsDockTile",             2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::IsBuoyTile,             "IsBuoyTile",             2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::IsLockTile,             "IsLockTile",             2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::IsCanalTile,            "IsCanalTile",            2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::AreWaterTilesConnected, "AreWaterTilesConnected", 3, ".ii");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::BuildWaterDepot,        "BuildWaterDepot",        3, ".ii");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::BuildDock,              "BuildDock",              3, ".ii");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::BuildBuoy,              "BuildBuoy",              2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::BuildLock,              "BuildLock",              2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::BuildCanal,             "BuildCanal",             2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::RemoveWaterDepot,       "RemoveWaterDepot",       2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::RemoveDock,             "RemoveDock",             2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::RemoveBuoy,             "RemoveBuoy",             2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::RemoveLock,             "RemoveLock",             2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::RemoveCanal,            "RemoveCanal",            2, ".i");
+	SQAIMarine.DefSQStaticMethod(engine, &ScriptMarine::GetBuildCost,           "GetBuildCost",           2, ".i");
 
 	SQAIMarine.PostRegister(engine);
 }
--- a/src/ai/api/ai_order.hpp.sq
+++ b/src/ai/api/ai_order.hpp.sq
@@ -13,122 +13,122 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIOrder::ErrorMessages GetParam(ForceType<AIOrder::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIOrder::ErrorMessages)tmp; }
-	template <> inline int Return<AIOrder::ErrorMessages>(HSQUIRRELVM vm, AIOrder::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIOrder::AIOrderFlags GetParam(ForceType<AIOrder::AIOrderFlags>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIOrder::AIOrderFlags)tmp; }
-	template <> inline int Return<AIOrder::AIOrderFlags>(HSQUIRRELVM vm, AIOrder::AIOrderFlags res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIOrder::OrderCondition GetParam(ForceType<AIOrder::OrderCondition>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIOrder::OrderCondition)tmp; }
-	template <> inline int Return<AIOrder::OrderCondition>(HSQUIRRELVM vm, AIOrder::OrderCondition res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIOrder::CompareFunction GetParam(ForceType<AIOrder::CompareFunction>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIOrder::CompareFunction)tmp; }
-	template <> inline int Return<AIOrder::CompareFunction>(HSQUIRRELVM vm, AIOrder::CompareFunction res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIOrder::OrderPosition GetParam(ForceType<AIOrder::OrderPosition>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIOrder::OrderPosition)tmp; }
-	template <> inline int Return<AIOrder::OrderPosition>(HSQUIRRELVM vm, AIOrder::OrderPosition res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIOrder::StopLocation GetParam(ForceType<AIOrder::StopLocation>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIOrder::StopLocation)tmp; }
-	template <> inline int Return<AIOrder::StopLocation>(HSQUIRRELVM vm, AIOrder::StopLocation res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptOrder::ErrorMessages GetParam(ForceType<ScriptOrder::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::ErrorMessages)tmp; }
+	template <> inline int Return<ScriptOrder::ErrorMessages>(HSQUIRRELVM vm, ScriptOrder::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptOrder::ScriptOrderFlags GetParam(ForceType<ScriptOrder::ScriptOrderFlags>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::ScriptOrderFlags)tmp; }
+	template <> inline int Return<ScriptOrder::ScriptOrderFlags>(HSQUIRRELVM vm, ScriptOrder::ScriptOrderFlags res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptOrder::OrderCondition GetParam(ForceType<ScriptOrder::OrderCondition>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::OrderCondition)tmp; }
+	template <> inline int Return<ScriptOrder::OrderCondition>(HSQUIRRELVM vm, ScriptOrder::OrderCondition res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptOrder::CompareFunction GetParam(ForceType<ScriptOrder::CompareFunction>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::CompareFunction)tmp; }
+	template <> inline int Return<ScriptOrder::CompareFunction>(HSQUIRRELVM vm, ScriptOrder::CompareFunction res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptOrder::OrderPosition GetParam(ForceType<ScriptOrder::OrderPosition>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::OrderPosition)tmp; }
+	template <> inline int Return<ScriptOrder::OrderPosition>(HSQUIRRELVM vm, ScriptOrder::OrderPosition res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptOrder::StopLocation GetParam(ForceType<ScriptOrder::StopLocation>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::StopLocation)tmp; }
+	template <> inline int Return<ScriptOrder::StopLocation>(HSQUIRRELVM vm, ScriptOrder::StopLocation res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIOrder to be used as Squirrel parameter */
-	template <> inline AIOrder *GetParam(ForceType<AIOrder *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIOrder *)instance; }
-	template <> inline AIOrder &GetParam(ForceType<AIOrder &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIOrder *)instance; }
-	template <> inline const AIOrder *GetParam(ForceType<const AIOrder *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIOrder *)instance; }
-	template <> inline const AIOrder &GetParam(ForceType<const AIOrder &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIOrder *)instance; }
-	template <> inline int Return<AIOrder *>(HSQUIRRELVM vm, AIOrder *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Order", res, NULL, DefSQDestructorCallback<AIOrder>, true); return 1; }
+	/* Allow ScriptOrder to be used as Squirrel parameter */
+	template <> inline ScriptOrder *GetParam(ForceType<ScriptOrder *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptOrder *)instance; }
+	template <> inline ScriptOrder &GetParam(ForceType<ScriptOrder &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptOrder *)instance; }
+	template <> inline const ScriptOrder *GetParam(ForceType<const ScriptOrder *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptOrder *)instance; }
+	template <> inline const ScriptOrder &GetParam(ForceType<const ScriptOrder &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptOrder *)instance; }
+	template <> inline int Return<ScriptOrder *>(HSQUIRRELVM vm, ScriptOrder *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Order", res, NULL, DefSQDestructorCallback<ScriptOrder>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIOrder, ST_AI>() { return "AIOrder"; }
+template <> const char *GetClassName<ScriptOrder, ST_AI>() { return "AIOrder"; }
 
 void SQAIOrder_Register(Squirrel *engine)
 {
-	DefSQClass<AIOrder, ST_AI> SQAIOrder("AIOrder");
+	DefSQClass<ScriptOrder, ST_AI> SQAIOrder("AIOrder");
 	SQAIOrder.PreRegister(engine);
-	SQAIOrder.AddConstructor<void (AIOrder::*)(), 1>(engine, "x");
+	SQAIOrder.AddConstructor<void (ScriptOrder::*)(), 1>(engine, "x");
 
-	SQAIOrder.DefSQConst(engine, AIOrder::ERR_ORDER_BASE,                                   "ERR_ORDER_BASE");
-	SQAIOrder.DefSQConst(engine, AIOrder::ERR_ORDER_TOO_MANY,                               "ERR_ORDER_TOO_MANY");
-	SQAIOrder.DefSQConst(engine, AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, "ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NONE,                                        "AIOF_NONE");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NON_STOP_INTERMEDIATE,                       "AIOF_NON_STOP_INTERMEDIATE");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NON_STOP_DESTINATION,                        "AIOF_NON_STOP_DESTINATION");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_UNLOAD,                                      "AIOF_UNLOAD");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_TRANSFER,                                    "AIOF_TRANSFER");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NO_UNLOAD,                                   "AIOF_NO_UNLOAD");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_FULL_LOAD,                                   "AIOF_FULL_LOAD");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_FULL_LOAD_ANY,                               "AIOF_FULL_LOAD_ANY");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NO_LOAD,                                     "AIOF_NO_LOAD");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_SERVICE_IF_NEEDED,                           "AIOF_SERVICE_IF_NEEDED");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_STOP_IN_DEPOT,                               "AIOF_STOP_IN_DEPOT");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_GOTO_NEAREST_DEPOT,                          "AIOF_GOTO_NEAREST_DEPOT");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NON_STOP_FLAGS,                              "AIOF_NON_STOP_FLAGS");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_UNLOAD_FLAGS,                                "AIOF_UNLOAD_FLAGS");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_LOAD_FLAGS,                                  "AIOF_LOAD_FLAGS");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_DEPOT_FLAGS,                                 "AIOF_DEPOT_FLAGS");
-	SQAIOrder.DefSQConst(engine, AIOrder::AIOF_INVALID,                                     "AIOF_INVALID");
-	SQAIOrder.DefSQConst(engine, AIOrder::OC_LOAD_PERCENTAGE,                               "OC_LOAD_PERCENTAGE");
-	SQAIOrder.DefSQConst(engine, AIOrder::OC_RELIABILITY,                                   "OC_RELIABILITY");
-	SQAIOrder.DefSQConst(engine, AIOrder::OC_MAX_SPEED,                                     "OC_MAX_SPEED");
-	SQAIOrder.DefSQConst(engine, AIOrder::OC_AGE,                                           "OC_AGE");
-	SQAIOrder.DefSQConst(engine, AIOrder::OC_REQUIRES_SERVICE,                              "OC_REQUIRES_SERVICE");
-	SQAIOrder.DefSQConst(engine, AIOrder::OC_UNCONDITIONALLY,                               "OC_UNCONDITIONALLY");
-	SQAIOrder.DefSQConst(engine, AIOrder::OC_REMAINING_LIFETIME,                            "OC_REMAINING_LIFETIME");
-	SQAIOrder.DefSQConst(engine, AIOrder::OC_INVALID,                                       "OC_INVALID");
-	SQAIOrder.DefSQConst(engine, AIOrder::CF_EQUALS,                                        "CF_EQUALS");
-	SQAIOrder.DefSQConst(engine, AIOrder::CF_NOT_EQUALS,                                    "CF_NOT_EQUALS");
-	SQAIOrder.DefSQConst(engine, AIOrder::CF_LESS_THAN,                                     "CF_LESS_THAN");
-	SQAIOrder.DefSQConst(engine, AIOrder::CF_LESS_EQUALS,                                   "CF_LESS_EQUALS");
-	SQAIOrder.DefSQConst(engine, AIOrder::CF_MORE_THAN,                                     "CF_MORE_THAN");
-	SQAIOrder.DefSQConst(engine, AIOrder::CF_MORE_EQUALS,                                   "CF_MORE_EQUALS");
-	SQAIOrder.DefSQConst(engine, AIOrder::CF_IS_TRUE,                                       "CF_IS_TRUE");
-	SQAIOrder.DefSQConst(engine, AIOrder::CF_IS_FALSE,                                      "CF_IS_FALSE");
-	SQAIOrder.DefSQConst(engine, AIOrder::CF_INVALID,                                       "CF_INVALID");
-	SQAIOrder.DefSQConst(engine, AIOrder::ORDER_CURRENT,                                    "ORDER_CURRENT");
-	SQAIOrder.DefSQConst(engine, AIOrder::ORDER_INVALID,                                    "ORDER_INVALID");
-	SQAIOrder.DefSQConst(engine, AIOrder::STOPLOCATION_NEAR,                                "STOPLOCATION_NEAR");
-	SQAIOrder.DefSQConst(engine, AIOrder::STOPLOCATION_MIDDLE,                              "STOPLOCATION_MIDDLE");
-	SQAIOrder.DefSQConst(engine, AIOrder::STOPLOCATION_FAR,                                 "STOPLOCATION_FAR");
-	SQAIOrder.DefSQConst(engine, AIOrder::STOPLOCATION_INVALID,                             "STOPLOCATION_INVALID");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_BASE,                                   "ERR_ORDER_BASE");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_TOO_MANY,                               "ERR_ORDER_TOO_MANY");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, "ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NONE,                                        "AIOF_NONE");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_INTERMEDIATE,                       "AIOF_NON_STOP_INTERMEDIATE");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_DESTINATION,                        "AIOF_NON_STOP_DESTINATION");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_UNLOAD,                                      "AIOF_UNLOAD");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_TRANSFER,                                    "AIOF_TRANSFER");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NO_UNLOAD,                                   "AIOF_NO_UNLOAD");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_FULL_LOAD,                                   "AIOF_FULL_LOAD");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_FULL_LOAD_ANY,                               "AIOF_FULL_LOAD_ANY");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NO_LOAD,                                     "AIOF_NO_LOAD");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_SERVICE_IF_NEEDED,                           "AIOF_SERVICE_IF_NEEDED");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_STOP_IN_DEPOT,                               "AIOF_STOP_IN_DEPOT");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_GOTO_NEAREST_DEPOT,                          "AIOF_GOTO_NEAREST_DEPOT");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_FLAGS,                              "AIOF_NON_STOP_FLAGS");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_UNLOAD_FLAGS,                                "AIOF_UNLOAD_FLAGS");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_LOAD_FLAGS,                                  "AIOF_LOAD_FLAGS");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_DEPOT_FLAGS,                                 "AIOF_DEPOT_FLAGS");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_INVALID,                                     "AIOF_INVALID");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::OC_LOAD_PERCENTAGE,                               "OC_LOAD_PERCENTAGE");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::OC_RELIABILITY,                                   "OC_RELIABILITY");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::OC_MAX_SPEED,                                     "OC_MAX_SPEED");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::OC_AGE,                                           "OC_AGE");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::OC_REQUIRES_SERVICE,                              "OC_REQUIRES_SERVICE");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::OC_UNCONDITIONALLY,                               "OC_UNCONDITIONALLY");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::OC_REMAINING_LIFETIME,                            "OC_REMAINING_LIFETIME");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::OC_INVALID,                                       "OC_INVALID");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::CF_EQUALS,                                        "CF_EQUALS");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::CF_NOT_EQUALS,                                    "CF_NOT_EQUALS");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::CF_LESS_THAN,                                     "CF_LESS_THAN");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::CF_LESS_EQUALS,                                   "CF_LESS_EQUALS");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::CF_MORE_THAN,                                     "CF_MORE_THAN");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::CF_MORE_EQUALS,                                   "CF_MORE_EQUALS");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::CF_IS_TRUE,                                       "CF_IS_TRUE");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::CF_IS_FALSE,                                      "CF_IS_FALSE");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::CF_INVALID,                                       "CF_INVALID");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::ORDER_CURRENT,                                    "ORDER_CURRENT");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::ORDER_INVALID,                                    "ORDER_INVALID");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::STOPLOCATION_NEAR,                                "STOPLOCATION_NEAR");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::STOPLOCATION_MIDDLE,                              "STOPLOCATION_MIDDLE");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::STOPLOCATION_FAR,                                 "STOPLOCATION_FAR");
+	SQAIOrder.DefSQConst(engine, ScriptOrder::STOPLOCATION_INVALID,                             "STOPLOCATION_INVALID");
 
-	AIError::RegisterErrorMap(STR_ERROR_NO_MORE_SPACE_FOR_ORDERS,          AIOrder::ERR_ORDER_TOO_MANY);
-	AIError::RegisterErrorMap(STR_ERROR_TOO_FAR_FROM_PREVIOUS_DESTINATION, AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION);
+	ScriptError::RegisterErrorMap(STR_ERROR_NO_MORE_SPACE_FOR_ORDERS,          ScriptOrder::ERR_ORDER_TOO_MANY);
+	ScriptError::RegisterErrorMap(STR_ERROR_TOO_FAR_FROM_PREVIOUS_DESTINATION, ScriptOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION);
 
-	AIError::RegisterErrorMapString(AIOrder::ERR_ORDER_TOO_MANY,                               "ERR_ORDER_TOO_MANY");
-	AIError::RegisterErrorMapString(AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, "ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION");
+	ScriptError::RegisterErrorMapString(ScriptOrder::ERR_ORDER_TOO_MANY,                               "ERR_ORDER_TOO_MANY");
+	ScriptError::RegisterErrorMapString(ScriptOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, "ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION");
 
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsValidVehicleOrder,           "IsValidVehicleOrder",           3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsGotoStationOrder,            "IsGotoStationOrder",            3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsGotoDepotOrder,              "IsGotoDepotOrder",              3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsGotoWaypointOrder,           "IsGotoWaypointOrder",           3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsConditionalOrder,            "IsConditionalOrder",            3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsVoidOrder,                   "IsVoidOrder",                   3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsRefitOrder,                  "IsRefitOrder",                  3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsCurrentOrderPartOfOrderList, "IsCurrentOrderPartOfOrderList", 2, ".i");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ResolveOrderPosition,          "ResolveOrderPosition",          3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AreOrderFlagsValid,            "AreOrderFlagsValid",            3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsValidConditionalOrder,       "IsValidConditionalOrder",       3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCount,                 "GetOrderCount",                 2, ".i");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderDestination,           "GetOrderDestination",           3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderFlags,                 "GetOrderFlags",                 3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderJumpTo,                "GetOrderJumpTo",                3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCondition,             "GetOrderCondition",             3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCompareFunction,       "GetOrderCompareFunction",       3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCompareValue,          "GetOrderCompareValue",          3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetStopLocation,               "GetStopLocation",               3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderRefit,                 "GetOrderRefit",                 3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderJumpTo,                "SetOrderJumpTo",                4, ".iii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCondition,             "SetOrderCondition",             4, ".iii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCompareFunction,       "SetOrderCompareFunction",       4, ".iii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCompareValue,          "SetOrderCompareValue",          4, ".iii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetStopLocation,               "SetStopLocation",               4, ".iii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderRefit,                 "SetOrderRefit",                 4, ".iii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AppendOrder,                   "AppendOrder",                   4, ".iii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AppendConditionalOrder,        "AppendConditionalOrder",        3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::InsertOrder,                   "InsertOrder",                   5, ".iiii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::InsertConditionalOrder,        "InsertConditionalOrder",        4, ".iii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::RemoveOrder,                   "RemoveOrder",                   3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderFlags,                 "SetOrderFlags",                 4, ".iii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::MoveOrder,                     "MoveOrder",                     4, ".iii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SkipToOrder,                   "SkipToOrder",                   3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::CopyOrders,                    "CopyOrders",                    3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ShareOrders,                   "ShareOrders",                   3, ".ii");
-	SQAIOrder.DefSQStaticMethod(engine, &AIOrder::UnshareOrders,                 "UnshareOrders",                 2, ".i");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::IsValidVehicleOrder,           "IsValidVehicleOrder",           3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::IsGotoStationOrder,            "IsGotoStationOrder",            3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::IsGotoDepotOrder,              "IsGotoDepotOrder",              3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::IsGotoWaypointOrder,           "IsGotoWaypointOrder",           3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::IsConditionalOrder,            "IsConditionalOrder",            3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::IsVoidOrder,                   "IsVoidOrder",                   3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::IsRefitOrder,                  "IsRefitOrder",                  3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::IsCurrentOrderPartOfOrderList, "IsCurrentOrderPartOfOrderList", 2, ".i");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::ResolveOrderPosition,          "ResolveOrderPosition",          3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::AreOrderFlagsValid,            "AreOrderFlagsValid",            3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::IsValidConditionalOrder,       "IsValidConditionalOrder",       3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::GetOrderCount,                 "GetOrderCount",                 2, ".i");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::GetOrderDestination,           "GetOrderDestination",           3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::GetOrderFlags,                 "GetOrderFlags",                 3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::GetOrderJumpTo,                "GetOrderJumpTo",                3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::GetOrderCondition,             "GetOrderCondition",             3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::GetOrderCompareFunction,       "GetOrderCompareFunction",       3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::GetOrderCompareValue,          "GetOrderCompareValue",          3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::GetStopLocation,               "GetStopLocation",               3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::GetOrderRefit,                 "GetOrderRefit",                 3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::SetOrderJumpTo,                "SetOrderJumpTo",                4, ".iii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::SetOrderCondition,             "SetOrderCondition",             4, ".iii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::SetOrderCompareFunction,       "SetOrderCompareFunction",       4, ".iii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::SetOrderCompareValue,          "SetOrderCompareValue",          4, ".iii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::SetStopLocation,               "SetStopLocation",               4, ".iii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::SetOrderRefit,                 "SetOrderRefit",                 4, ".iii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::AppendOrder,                   "AppendOrder",                   4, ".iii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::AppendConditionalOrder,        "AppendConditionalOrder",        3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::InsertOrder,                   "InsertOrder",                   5, ".iiii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::InsertConditionalOrder,        "InsertConditionalOrder",        4, ".iii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::RemoveOrder,                   "RemoveOrder",                   3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::SetOrderFlags,                 "SetOrderFlags",                 4, ".iii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::MoveOrder,                     "MoveOrder",                     4, ".iii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::SkipToOrder,                   "SkipToOrder",                   3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::CopyOrders,                    "CopyOrders",                    3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::ShareOrders,                   "ShareOrders",                   3, ".ii");
+	SQAIOrder.DefSQStaticMethod(engine, &ScriptOrder::UnshareOrders,                 "UnshareOrders",                 2, ".i");
 
 	SQAIOrder.PostRegister(engine);
 }
--- a/src/ai/api/ai_rail.hpp.sq
+++ b/src/ai/api/ai_rail.hpp.sq
@@ -13,103 +13,103 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIRail::ErrorMessages GetParam(ForceType<AIRail::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIRail::ErrorMessages)tmp; }
-	template <> inline int Return<AIRail::ErrorMessages>(HSQUIRRELVM vm, AIRail::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIRail::RailType GetParam(ForceType<AIRail::RailType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIRail::RailType)tmp; }
-	template <> inline int Return<AIRail::RailType>(HSQUIRRELVM vm, AIRail::RailType res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIRail::RailTrack GetParam(ForceType<AIRail::RailTrack>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIRail::RailTrack)tmp; }
-	template <> inline int Return<AIRail::RailTrack>(HSQUIRRELVM vm, AIRail::RailTrack res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIRail::SignalType GetParam(ForceType<AIRail::SignalType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIRail::SignalType)tmp; }
-	template <> inline int Return<AIRail::SignalType>(HSQUIRRELVM vm, AIRail::SignalType res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIRail::BuildType GetParam(ForceType<AIRail::BuildType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIRail::BuildType)tmp; }
-	template <> inline int Return<AIRail::BuildType>(HSQUIRRELVM vm, AIRail::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptRail::ErrorMessages GetParam(ForceType<ScriptRail::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::ErrorMessages)tmp; }
+	template <> inline int Return<ScriptRail::ErrorMessages>(HSQUIRRELVM vm, ScriptRail::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptRail::RailType GetParam(ForceType<ScriptRail::RailType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::RailType)tmp; }
+	template <> inline int Return<ScriptRail::RailType>(HSQUIRRELVM vm, ScriptRail::RailType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptRail::RailTrack GetParam(ForceType<ScriptRail::RailTrack>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::RailTrack)tmp; }
+	template <> inline int Return<ScriptRail::RailTrack>(HSQUIRRELVM vm, ScriptRail::RailTrack res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptRail::SignalType GetParam(ForceType<ScriptRail::SignalType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::SignalType)tmp; }
+	template <> inline int Return<ScriptRail::SignalType>(HSQUIRRELVM vm, ScriptRail::SignalType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptRail::BuildType GetParam(ForceType<ScriptRail::BuildType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::BuildType)tmp; }
+	template <> inline int Return<ScriptRail::BuildType>(HSQUIRRELVM vm, ScriptRail::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIRail to be used as Squirrel parameter */
-	template <> inline AIRail *GetParam(ForceType<AIRail *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIRail *)instance; }
-	template <> inline AIRail &GetParam(ForceType<AIRail &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIRail *)instance; }
-	template <> inline const AIRail *GetParam(ForceType<const AIRail *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIRail *)instance; }
-	template <> inline const AIRail &GetParam(ForceType<const AIRail &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIRail *)instance; }
-	template <> inline int Return<AIRail *>(HSQUIRRELVM vm, AIRail *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Rail", res, NULL, DefSQDestructorCallback<AIRail>, true); return 1; }
+	/* Allow ScriptRail to be used as Squirrel parameter */
+	template <> inline ScriptRail *GetParam(ForceType<ScriptRail *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptRail *)instance; }
+	template <> inline ScriptRail &GetParam(ForceType<ScriptRail &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRail *)instance; }
+	template <> inline const ScriptRail *GetParam(ForceType<const ScriptRail *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptRail *)instance; }
+	template <> inline const ScriptRail &GetParam(ForceType<const ScriptRail &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRail *)instance; }
+	template <> inline int Return<ScriptRail *>(HSQUIRRELVM vm, ScriptRail *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Rail", res, NULL, DefSQDestructorCallback<ScriptRail>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIRail, ST_AI>() { return "AIRail"; }
+template <> const char *GetClassName<ScriptRail, ST_AI>() { return "AIRail"; }
 
 void SQAIRail_Register(Squirrel *engine)
 {
-	DefSQClass<AIRail, ST_AI> SQAIRail("AIRail");
+	DefSQClass<ScriptRail, ST_AI> SQAIRail("AIRail");
 	SQAIRail.PreRegister(engine);
-	SQAIRail.AddConstructor<void (AIRail::*)(), 1>(engine, "x");
+	SQAIRail.AddConstructor<void (ScriptRail::*)(), 1>(engine, "x");
 
-	SQAIRail.DefSQConst(engine, AIRail::ERR_RAIL_BASE,                   "ERR_RAIL_BASE");
-	SQAIRail.DefSQConst(engine, AIRail::ERR_CROSSING_ON_ONEWAY_ROAD,     "ERR_CROSSING_ON_ONEWAY_ROAD");
-	SQAIRail.DefSQConst(engine, AIRail::ERR_UNSUITABLE_TRACK,            "ERR_UNSUITABLE_TRACK");
-	SQAIRail.DefSQConst(engine, AIRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING");
-	SQAIRail.DefSQConst(engine, AIRail::RAILTYPE_INVALID,                "RAILTYPE_INVALID");
-	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NE_SW,                 "RAILTRACK_NE_SW");
-	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_SE,                 "RAILTRACK_NW_SE");
-	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_NE,                 "RAILTRACK_NW_NE");
-	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_SW_SE,                 "RAILTRACK_SW_SE");
-	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_SW,                 "RAILTRACK_NW_SW");
-	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NE_SE,                 "RAILTRACK_NE_SE");
-	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_INVALID,               "RAILTRACK_INVALID");
-	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NORMAL,               "SIGNALTYPE_NORMAL");
-	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_ENTRY,                "SIGNALTYPE_ENTRY");
-	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_EXIT,                 "SIGNALTYPE_EXIT");
-	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_COMBO,                "SIGNALTYPE_COMBO");
-	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_PBS,                  "SIGNALTYPE_PBS");
-	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_PBS_ONEWAY,           "SIGNALTYPE_PBS_ONEWAY");
-	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_TWOWAY,               "SIGNALTYPE_TWOWAY");
-	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NORMAL_TWOWAY,        "SIGNALTYPE_NORMAL_TWOWAY");
-	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_ENTRY_TWOWAY,         "SIGNALTYPE_ENTRY_TWOWAY");
-	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_EXIT_TWOWAY,          "SIGNALTYPE_EXIT_TWOWAY");
-	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_COMBO_TWOWAY,         "SIGNALTYPE_COMBO_TWOWAY");
-	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NONE,                 "SIGNALTYPE_NONE");
-	SQAIRail.DefSQConst(engine, AIRail::BT_TRACK,                        "BT_TRACK");
-	SQAIRail.DefSQConst(engine, AIRail::BT_SIGNAL,                       "BT_SIGNAL");
-	SQAIRail.DefSQConst(engine, AIRail::BT_DEPOT,                        "BT_DEPOT");
-	SQAIRail.DefSQConst(engine, AIRail::BT_STATION,                      "BT_STATION");
-	SQAIRail.DefSQConst(engine, AIRail::BT_WAYPOINT,                     "BT_WAYPOINT");
+	SQAIRail.DefSQConst(engine, ScriptRail::ERR_RAIL_BASE,                   "ERR_RAIL_BASE");
+	SQAIRail.DefSQConst(engine, ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD,     "ERR_CROSSING_ON_ONEWAY_ROAD");
+	SQAIRail.DefSQConst(engine, ScriptRail::ERR_UNSUITABLE_TRACK,            "ERR_UNSUITABLE_TRACK");
+	SQAIRail.DefSQConst(engine, ScriptRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING");
+	SQAIRail.DefSQConst(engine, ScriptRail::RAILTYPE_INVALID,                "RAILTYPE_INVALID");
+	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_NE_SW,                 "RAILTRACK_NE_SW");
+	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_NW_SE,                 "RAILTRACK_NW_SE");
+	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_NW_NE,                 "RAILTRACK_NW_NE");
+	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_SW_SE,                 "RAILTRACK_SW_SE");
+	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_NW_SW,                 "RAILTRACK_NW_SW");
+	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_NE_SE,                 "RAILTRACK_NE_SE");
+	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_INVALID,               "RAILTRACK_INVALID");
+	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_NORMAL,               "SIGNALTYPE_NORMAL");
+	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_ENTRY,                "SIGNALTYPE_ENTRY");
+	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_EXIT,                 "SIGNALTYPE_EXIT");
+	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_COMBO,                "SIGNALTYPE_COMBO");
+	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_PBS,                  "SIGNALTYPE_PBS");
+	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_PBS_ONEWAY,           "SIGNALTYPE_PBS_ONEWAY");
+	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_TWOWAY,               "SIGNALTYPE_TWOWAY");
+	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_NORMAL_TWOWAY,        "SIGNALTYPE_NORMAL_TWOWAY");
+	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_ENTRY_TWOWAY,         "SIGNALTYPE_ENTRY_TWOWAY");
+	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_EXIT_TWOWAY,          "SIGNALTYPE_EXIT_TWOWAY");
+	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_COMBO_TWOWAY,         "SIGNALTYPE_COMBO_TWOWAY");
+	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_NONE,                 "SIGNALTYPE_NONE");
+	SQAIRail.DefSQConst(engine, ScriptRail::BT_TRACK,                        "BT_TRACK");
+	SQAIRail.DefSQConst(engine, ScriptRail::BT_SIGNAL,                       "BT_SIGNAL");
+	SQAIRail.DefSQConst(engine, ScriptRail::BT_DEPOT,                        "BT_DEPOT");
+	SQAIRail.DefSQConst(engine, ScriptRail::BT_STATION,                      "BT_STATION");
+	SQAIRail.DefSQConst(engine, ScriptRail::BT_WAYPOINT,                     "BT_WAYPOINT");
 
-	AIError::RegisterErrorMap(STR_ERROR_CROSSING_ON_ONEWAY_ROAD,    AIRail::ERR_CROSSING_ON_ONEWAY_ROAD);
-	AIError::RegisterErrorMap(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK, AIRail::ERR_UNSUITABLE_TRACK);
-	AIError::RegisterErrorMap(STR_ERROR_CROSSING_DISALLOWED,        AIRail::ERR_RAILTYPE_DISALLOWS_CROSSING);
+	ScriptError::RegisterErrorMap(STR_ERROR_CROSSING_ON_ONEWAY_ROAD,    ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD);
+	ScriptError::RegisterErrorMap(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK, ScriptRail::ERR_UNSUITABLE_TRACK);
+	ScriptError::RegisterErrorMap(STR_ERROR_CROSSING_DISALLOWED,        ScriptRail::ERR_RAILTYPE_DISALLOWS_CROSSING);
 
-	AIError::RegisterErrorMapString(AIRail::ERR_CROSSING_ON_ONEWAY_ROAD,     "ERR_CROSSING_ON_ONEWAY_ROAD");
-	AIError::RegisterErrorMapString(AIRail::ERR_UNSUITABLE_TRACK,            "ERR_UNSUITABLE_TRACK");
-	AIError::RegisterErrorMapString(AIRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING");
+	ScriptError::RegisterErrorMapString(ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD,     "ERR_CROSSING_ON_ONEWAY_ROAD");
+	ScriptError::RegisterErrorMapString(ScriptRail::ERR_UNSUITABLE_TRACK,            "ERR_UNSUITABLE_TRACK");
+	ScriptError::RegisterErrorMapString(ScriptRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING");
 
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetName,                         "GetName",                         2, ".i");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailTile,                      "IsRailTile",                      2, ".i");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsLevelCrossingTile,             "IsLevelCrossingTile",             2, ".i");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailDepotTile,                 "IsRailDepotTile",                 2, ".i");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailStationTile,               "IsRailStationTile",               2, ".i");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailWaypointTile,              "IsRailWaypointTile",              2, ".i");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailTypeAvailable,             "IsRailTypeAvailable",             2, ".i");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetCurrentRailType,              "GetCurrentRailType",              1, ".");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::SetCurrentRailType,              "SetCurrentRailType",              2, ".i");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::TrainCanRunOnRail,               "TrainCanRunOnRail",               3, ".ii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::TrainHasPowerOnRail,             "TrainHasPowerOnRail",             3, ".ii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetRailType,                     "GetRailType",                     2, ".i");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::ConvertRailType,                 "ConvertRailType",                 4, ".iii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetRailDepotFrontTile,           "GetRailDepotFrontTile",           2, ".i");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetRailStationDirection,         "GetRailStationDirection",         2, ".i");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRailDepot,                  "BuildRailDepot",                  3, ".ii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRailStation,                "BuildRailStation",                6, ".iiiii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildNewGRFRailStation,          "BuildNewGRFRailStation",          11, ".iiiiiiiiib");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRailWaypoint,               "BuildRailWaypoint",               2, ".i");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveRailWaypointTileRectangle, "RemoveRailWaypointTileRectangle", 4, ".iib");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveRailStationTileRectangle,  "RemoveRailStationTileRectangle",  4, ".iib");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetRailTracks,                   "GetRailTracks",                   2, ".i");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRailTrack,                  "BuildRailTrack",                  3, ".ii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveRailTrack,                 "RemoveRailTrack",                 3, ".ii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::AreTilesConnected,               "AreTilesConnected",               4, ".iii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRail,                       "BuildRail",                       4, ".iii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveRail,                      "RemoveRail",                      4, ".iii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetSignalType,                   "GetSignalType",                   3, ".ii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildSignal,                     "BuildSignal",                     4, ".iii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveSignal,                    "RemoveSignal",                    3, ".ii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetBuildCost,                    "GetBuildCost",                    3, ".ii");
-	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetMaxSpeed,                     "GetMaxSpeed",                     2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::GetName,                         "GetName",                         2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::IsRailTile,                      "IsRailTile",                      2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::IsLevelCrossingTile,             "IsLevelCrossingTile",             2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::IsRailDepotTile,                 "IsRailDepotTile",                 2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::IsRailStationTile,               "IsRailStationTile",               2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::IsRailWaypointTile,              "IsRailWaypointTile",              2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::IsRailTypeAvailable,             "IsRailTypeAvailable",             2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::GetCurrentRailType,              "GetCurrentRailType",              1, ".");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::SetCurrentRailType,              "SetCurrentRailType",              2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::TrainCanRunOnRail,               "TrainCanRunOnRail",               3, ".ii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::TrainHasPowerOnRail,             "TrainHasPowerOnRail",             3, ".ii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::GetRailType,                     "GetRailType",                     2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::ConvertRailType,                 "ConvertRailType",                 4, ".iii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::GetRailDepotFrontTile,           "GetRailDepotFrontTile",           2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::GetRailStationDirection,         "GetRailStationDirection",         2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::BuildRailDepot,                  "BuildRailDepot",                  3, ".ii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::BuildRailStation,                "BuildRailStation",                6, ".iiiii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::BuildNewGRFRailStation,          "BuildNewGRFRailStation",          11, ".iiiiiiiiib");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::BuildRailWaypoint,               "BuildRailWaypoint",               2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::RemoveRailWaypointTileRectangle, "RemoveRailWaypointTileRectangle", 4, ".iib");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::RemoveRailStationTileRectangle,  "RemoveRailStationTileRectangle",  4, ".iib");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::GetRailTracks,                   "GetRailTracks",                   2, ".i");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::BuildRailTrack,                  "BuildRailTrack",                  3, ".ii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::RemoveRailTrack,                 "RemoveRailTrack",                 3, ".ii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::AreTilesConnected,               "AreTilesConnected",               4, ".iii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::BuildRail,                       "BuildRail",                       4, ".iii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::RemoveRail,                      "RemoveRail",                      4, ".iii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::GetSignalType,                   "GetSignalType",                   3, ".ii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::BuildSignal,                     "BuildSignal",                     4, ".iii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::RemoveSignal,                    "RemoveSignal",                    3, ".ii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::GetBuildCost,                    "GetBuildCost",                    3, ".ii");
+	SQAIRail.DefSQStaticMethod(engine, &ScriptRail::GetMaxSpeed,                     "GetMaxSpeed",                     2, ".i");
 
 	SQAIRail.PostRegister(engine);
 }
--- a/src/ai/api/ai_railtypelist.hpp.sq
+++ b/src/ai/api/ai_railtypelist.hpp.sq
@@ -12,21 +12,21 @@
 #include "../../script/api/script_railtypelist.hpp"
 
 namespace SQConvert {
-	/* Allow AIRailTypeList to be used as Squirrel parameter */
-	template <> inline AIRailTypeList *GetParam(ForceType<AIRailTypeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIRailTypeList *)instance; }
-	template <> inline AIRailTypeList &GetParam(ForceType<AIRailTypeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIRailTypeList *)instance; }
-	template <> inline const AIRailTypeList *GetParam(ForceType<const AIRailTypeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIRailTypeList *)instance; }
-	template <> inline const AIRailTypeList &GetParam(ForceType<const AIRailTypeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIRailTypeList *)instance; }
-	template <> inline int Return<AIRailTypeList *>(HSQUIRRELVM vm, AIRailTypeList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "RailTypeList", res, NULL, DefSQDestructorCallback<AIRailTypeList>, true); return 1; }
+	/* Allow ScriptRailTypeList to be used as Squirrel parameter */
+	template <> inline ScriptRailTypeList *GetParam(ForceType<ScriptRailTypeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptRailTypeList *)instance; }
+	template <> inline ScriptRailTypeList &GetParam(ForceType<ScriptRailTypeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRailTypeList *)instance; }
+	template <> inline const ScriptRailTypeList *GetParam(ForceType<const ScriptRailTypeList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptRailTypeList *)instance; }
+	template <> inline const ScriptRailTypeList &GetParam(ForceType<const ScriptRailTypeList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRailTypeList *)instance; }
+	template <> inline int Return<ScriptRailTypeList *>(HSQUIRRELVM vm, ScriptRailTypeList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "RailTypeList", res, NULL, DefSQDestructorCallback<ScriptRailTypeList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIRailTypeList, ST_AI>() { return "AIRailTypeList"; }
+template <> const char *GetClassName<ScriptRailTypeList, ST_AI>() { return "AIRailTypeList"; }
 
 void SQAIRailTypeList_Register(Squirrel *engine)
 {
-	DefSQClass<AIRailTypeList, ST_AI> SQAIRailTypeList("AIRailTypeList");
+	DefSQClass<ScriptRailTypeList, ST_AI> SQAIRailTypeList("AIRailTypeList");
 	SQAIRailTypeList.PreRegister(engine, "AIList");
-	SQAIRailTypeList.AddConstructor<void (AIRailTypeList::*)(), 1>(engine, "x");
+	SQAIRailTypeList.AddConstructor<void (ScriptRailTypeList::*)(), 1>(engine, "x");
 
 	SQAIRailTypeList.PostRegister(engine);
 }
--- a/src/ai/api/ai_road.hpp.sq
+++ b/src/ai/api/ai_road.hpp.sq
@@ -13,84 +13,84 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIRoad::ErrorMessages GetParam(ForceType<AIRoad::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIRoad::ErrorMessages)tmp; }
-	template <> inline int Return<AIRoad::ErrorMessages>(HSQUIRRELVM vm, AIRoad::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIRoad::RoadType GetParam(ForceType<AIRoad::RoadType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIRoad::RoadType)tmp; }
-	template <> inline int Return<AIRoad::RoadType>(HSQUIRRELVM vm, AIRoad::RoadType res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIRoad::RoadVehicleType GetParam(ForceType<AIRoad::RoadVehicleType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIRoad::RoadVehicleType)tmp; }
-	template <> inline int Return<AIRoad::RoadVehicleType>(HSQUIRRELVM vm, AIRoad::RoadVehicleType res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIRoad::BuildType GetParam(ForceType<AIRoad::BuildType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIRoad::BuildType)tmp; }
-	template <> inline int Return<AIRoad::BuildType>(HSQUIRRELVM vm, AIRoad::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptRoad::ErrorMessages GetParam(ForceType<ScriptRoad::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::ErrorMessages)tmp; }
+	template <> inline int Return<ScriptRoad::ErrorMessages>(HSQUIRRELVM vm, ScriptRoad::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptRoad::RoadType GetParam(ForceType<ScriptRoad::RoadType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::RoadType)tmp; }
+	template <> inline int Return<ScriptRoad::RoadType>(HSQUIRRELVM vm, ScriptRoad::RoadType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptRoad::RoadVehicleType GetParam(ForceType<ScriptRoad::RoadVehicleType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::RoadVehicleType)tmp; }
+	template <> inline int Return<ScriptRoad::RoadVehicleType>(HSQUIRRELVM vm, ScriptRoad::RoadVehicleType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptRoad::BuildType GetParam(ForceType<ScriptRoad::BuildType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::BuildType)tmp; }
+	template <> inline int Return<ScriptRoad::BuildType>(HSQUIRRELVM vm, ScriptRoad::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIRoad to be used as Squirrel parameter */
-	template <> inline AIRoad *GetParam(ForceType<AIRoad *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIRoad *)instance; }
-	template <> inline AIRoad &GetParam(ForceType<AIRoad &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIRoad *)instance; }
-	template <> inline const AIRoad *GetParam(ForceType<const AIRoad *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIRoad *)instance; }
-	template <> inline const AIRoad &GetParam(ForceType<const AIRoad &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIRoad *)instance; }
-	template <> inline int Return<AIRoad *>(HSQUIRRELVM vm, AIRoad *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Road", res, NULL, DefSQDestructorCallback<AIRoad>, true); return 1; }
+	/* Allow ScriptRoad to be used as Squirrel parameter */
+	template <> inline ScriptRoad *GetParam(ForceType<ScriptRoad *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptRoad *)instance; }
+	template <> inline ScriptRoad &GetParam(ForceType<ScriptRoad &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRoad *)instance; }
+	template <> inline const ScriptRoad *GetParam(ForceType<const ScriptRoad *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptRoad *)instance; }
+	template <> inline const ScriptRoad &GetParam(ForceType<const ScriptRoad &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRoad *)instance; }
+	template <> inline int Return<ScriptRoad *>(HSQUIRRELVM vm, ScriptRoad *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Road", res, NULL, DefSQDestructorCallback<ScriptRoad>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIRoad, ST_AI>() { return "AIRoad"; }
+template <> const char *GetClassName<ScriptRoad, ST_AI>() { return "AIRoad"; }
 
 void SQAIRoad_Register(Squirrel *engine)
 {
-	DefSQClass<AIRoad, ST_AI> SQAIRoad("AIRoad");
+	DefSQClass<ScriptRoad, ST_AI> SQAIRoad("AIRoad");
 	SQAIRoad.PreRegister(engine);
-	SQAIRoad.AddConstructor<void (AIRoad::*)(), 1>(engine, "x");
+	SQAIRoad.AddConstructor<void (ScriptRoad::*)(), 1>(engine, "x");
 
-	SQAIRoad.DefSQConst(engine, AIRoad::ERR_ROAD_BASE,                                "ERR_ROAD_BASE");
-	SQAIRoad.DefSQConst(engine, AIRoad::ERR_ROAD_WORKS_IN_PROGRESS,                   "ERR_ROAD_WORKS_IN_PROGRESS");
-	SQAIRoad.DefSQConst(engine, AIRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION,       "ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION");
-	SQAIRoad.DefSQConst(engine, AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD,           "ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD");
-	SQAIRoad.DefSQConst(engine, AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS, "ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS");
-	SQAIRoad.DefSQConst(engine, AIRoad::ROADTYPE_ROAD,                                "ROADTYPE_ROAD");
-	SQAIRoad.DefSQConst(engine, AIRoad::ROADTYPE_TRAM,                                "ROADTYPE_TRAM");
-	SQAIRoad.DefSQConst(engine, AIRoad::ROADTYPE_INVALID,                             "ROADTYPE_INVALID");
-	SQAIRoad.DefSQConst(engine, AIRoad::ROADVEHTYPE_BUS,                              "ROADVEHTYPE_BUS");
-	SQAIRoad.DefSQConst(engine, AIRoad::ROADVEHTYPE_TRUCK,                            "ROADVEHTYPE_TRUCK");
-	SQAIRoad.DefSQConst(engine, AIRoad::BT_ROAD,                                      "BT_ROAD");
-	SQAIRoad.DefSQConst(engine, AIRoad::BT_DEPOT,                                     "BT_DEPOT");
-	SQAIRoad.DefSQConst(engine, AIRoad::BT_BUS_STOP,                                  "BT_BUS_STOP");
-	SQAIRoad.DefSQConst(engine, AIRoad::BT_TRUCK_STOP,                                "BT_TRUCK_STOP");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::ERR_ROAD_BASE,                                "ERR_ROAD_BASE");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS,                   "ERR_ROAD_WORKS_IN_PROGRESS");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION,       "ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD,           "ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS, "ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::ROADTYPE_ROAD,                                "ROADTYPE_ROAD");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::ROADTYPE_TRAM,                                "ROADTYPE_TRAM");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::ROADTYPE_INVALID,                             "ROADTYPE_INVALID");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::ROADVEHTYPE_BUS,                              "ROADVEHTYPE_BUS");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::ROADVEHTYPE_TRUCK,                            "ROADVEHTYPE_TRUCK");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::BT_ROAD,                                      "BT_ROAD");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::BT_DEPOT,                                     "BT_DEPOT");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::BT_BUS_STOP,                                  "BT_BUS_STOP");
+	SQAIRoad.DefSQConst(engine, ScriptRoad::BT_TRUCK_STOP,                                "BT_TRUCK_STOP");
 
-	AIError::RegisterErrorMap(STR_ERROR_ROAD_WORKS_IN_PROGRESS,           AIRoad::ERR_ROAD_WORKS_IN_PROGRESS);
-	AIError::RegisterErrorMap(STR_ERROR_DRIVE_THROUGH_DIRECTION,          AIRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION);
-	AIError::RegisterErrorMap(STR_ERROR_DRIVE_THROUGH_ON_TOWN_ROAD,       AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD);
-	AIError::RegisterErrorMap(STR_ERROR_ONEWAY_ROADS_CAN_T_HAVE_JUNCTION, AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS);
+	ScriptError::RegisterErrorMap(STR_ERROR_ROAD_WORKS_IN_PROGRESS,           ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS);
+	ScriptError::RegisterErrorMap(STR_ERROR_DRIVE_THROUGH_DIRECTION,          ScriptRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION);
+	ScriptError::RegisterErrorMap(STR_ERROR_DRIVE_THROUGH_ON_TOWN_ROAD,       ScriptRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD);
+	ScriptError::RegisterErrorMap(STR_ERROR_ONEWAY_ROADS_CAN_T_HAVE_JUNCTION, ScriptRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS);
 
-	AIError::RegisterErrorMapString(AIRoad::ERR_ROAD_WORKS_IN_PROGRESS,                   "ERR_ROAD_WORKS_IN_PROGRESS");
-	AIError::RegisterErrorMapString(AIRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION,       "ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION");
-	AIError::RegisterErrorMapString(AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD,           "ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD");
-	AIError::RegisterErrorMapString(AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS, "ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS");
+	ScriptError::RegisterErrorMapString(ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS,                   "ERR_ROAD_WORKS_IN_PROGRESS");
+	ScriptError::RegisterErrorMapString(ScriptRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION,       "ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION");
+	ScriptError::RegisterErrorMapString(ScriptRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD,           "ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD");
+	ScriptError::RegisterErrorMapString(ScriptRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS, "ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS");
 
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetRoadVehicleTypeForCargo,     "GetRoadVehicleTypeForCargo",     2, ".i");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::IsRoadTile,                     "IsRoadTile",                     2, ".i");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::IsRoadDepotTile,                "IsRoadDepotTile",                2, ".i");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::IsRoadStationTile,              "IsRoadStationTile",              2, ".i");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::IsDriveThroughRoadStationTile,  "IsDriveThroughRoadStationTile",  2, ".i");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::IsRoadTypeAvailable,            "IsRoadTypeAvailable",            2, ".i");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetCurrentRoadType,             "GetCurrentRoadType",             1, ".");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::SetCurrentRoadType,             "SetCurrentRoadType",             2, ".i");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::HasRoadType,                    "HasRoadType",                    3, ".ii");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::AreRoadTilesConnected,          "AreRoadTilesConnected",          3, ".ii");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::CanBuildConnectedRoadParts,     "CanBuildConnectedRoadParts",     5, ".iaii");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::CanBuildConnectedRoadPartsHere, "CanBuildConnectedRoadPartsHere", 4, ".iii");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetNeighbourRoadCount,          "GetNeighbourRoadCount",          2, ".i");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetRoadDepotFrontTile,          "GetRoadDepotFrontTile",          2, ".i");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetRoadStationFrontTile,        "GetRoadStationFrontTile",        2, ".i");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetDriveThroughBackTile,        "GetDriveThroughBackTile",        2, ".i");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::BuildRoad,                      "BuildRoad",                      3, ".ii");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::BuildOneWayRoad,                "BuildOneWayRoad",                3, ".ii");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::BuildRoadFull,                  "BuildRoadFull",                  3, ".ii");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::BuildOneWayRoadFull,            "BuildOneWayRoadFull",            3, ".ii");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::BuildRoadDepot,                 "BuildRoadDepot",                 3, ".ii");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::BuildRoadStation,               "BuildRoadStation",               5, ".iiii");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::BuildDriveThroughRoadStation,   "BuildDriveThroughRoadStation",   5, ".iiii");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::RemoveRoad,                     "RemoveRoad",                     3, ".ii");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::RemoveRoadFull,                 "RemoveRoadFull",                 3, ".ii");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::RemoveRoadDepot,                "RemoveRoadDepot",                2, ".i");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::RemoveRoadStation,              "RemoveRoadStation",              2, ".i");
-	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetBuildCost,                   "GetBuildCost",                   3, ".ii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::GetRoadVehicleTypeForCargo,     "GetRoadVehicleTypeForCargo",     2, ".i");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::IsRoadTile,                     "IsRoadTile",                     2, ".i");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::IsRoadDepotTile,                "IsRoadDepotTile",                2, ".i");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::IsRoadStationTile,              "IsRoadStationTile",              2, ".i");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::IsDriveThroughRoadStationTile,  "IsDriveThroughRoadStationTile",  2, ".i");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::IsRoadTypeAvailable,            "IsRoadTypeAvailable",            2, ".i");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::GetCurrentRoadType,             "GetCurrentRoadType",             1, ".");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::SetCurrentRoadType,             "SetCurrentRoadType",             2, ".i");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::HasRoadType,                    "HasRoadType",                    3, ".ii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::AreRoadTilesConnected,          "AreRoadTilesConnected",          3, ".ii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::CanBuildConnectedRoadParts,     "CanBuildConnectedRoadParts",     5, ".iaii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::CanBuildConnectedRoadPartsHere, "CanBuildConnectedRoadPartsHere", 4, ".iii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::GetNeighbourRoadCount,          "GetNeighbourRoadCount",          2, ".i");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::GetRoadDepotFrontTile,          "GetRoadDepotFrontTile",          2, ".i");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::GetRoadStationFrontTile,        "GetRoadStationFrontTile",        2, ".i");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::GetDriveThroughBackTile,        "GetDriveThroughBackTile",        2, ".i");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::BuildRoad,                      "BuildRoad",                      3, ".ii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::BuildOneWayRoad,                "BuildOneWayRoad",                3, ".ii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::BuildRoadFull,                  "BuildRoadFull",                  3, ".ii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::BuildOneWayRoadFull,            "BuildOneWayRoadFull",            3, ".ii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::BuildRoadDepot,                 "BuildRoadDepot",                 3, ".ii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::BuildRoadStation,               "BuildRoadStation",               5, ".iiii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::BuildDriveThroughRoadStation,   "BuildDriveThroughRoadStation",   5, ".iiii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::RemoveRoad,                     "RemoveRoad",                     3, ".ii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::RemoveRoadFull,                 "RemoveRoadFull",                 3, ".ii");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::RemoveRoadDepot,                "RemoveRoadDepot",                2, ".i");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::RemoveRoadStation,              "RemoveRoadStation",              2, ".i");
+	SQAIRoad.DefSQStaticMethod(engine, &ScriptRoad::GetBuildCost,                   "GetBuildCost",                   3, ".ii");
 
 	SQAIRoad.PostRegister(engine);
 }
--- a/src/ai/api/ai_sign.hpp.sq
+++ b/src/ai/api/ai_sign.hpp.sq
@@ -13,38 +13,38 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AISign::ErrorMessages GetParam(ForceType<AISign::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AISign::ErrorMessages)tmp; }
-	template <> inline int Return<AISign::ErrorMessages>(HSQUIRRELVM vm, AISign::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptSign::ErrorMessages GetParam(ForceType<ScriptSign::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptSign::ErrorMessages)tmp; }
+	template <> inline int Return<ScriptSign::ErrorMessages>(HSQUIRRELVM vm, ScriptSign::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AISign to be used as Squirrel parameter */
-	template <> inline AISign *GetParam(ForceType<AISign *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AISign *)instance; }
-	template <> inline AISign &GetParam(ForceType<AISign &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISign *)instance; }
-	template <> inline const AISign *GetParam(ForceType<const AISign *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AISign *)instance; }
-	template <> inline const AISign &GetParam(ForceType<const AISign &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISign *)instance; }
-	template <> inline int Return<AISign *>(HSQUIRRELVM vm, AISign *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Sign", res, NULL, DefSQDestructorCallback<AISign>, true); return 1; }
+	/* Allow ScriptSign to be used as Squirrel parameter */
+	template <> inline ScriptSign *GetParam(ForceType<ScriptSign *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptSign *)instance; }
+	template <> inline ScriptSign &GetParam(ForceType<ScriptSign &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptSign *)instance; }
+	template <> inline const ScriptSign *GetParam(ForceType<const ScriptSign *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptSign *)instance; }
+	template <> inline const ScriptSign &GetParam(ForceType<const ScriptSign &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptSign *)instance; }
+	template <> inline int Return<ScriptSign *>(HSQUIRRELVM vm, ScriptSign *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Sign", res, NULL, DefSQDestructorCallback<ScriptSign>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AISign, ST_AI>() { return "AISign"; }
+template <> const char *GetClassName<ScriptSign, ST_AI>() { return "AISign"; }
 
 void SQAISign_Register(Squirrel *engine)
 {
-	DefSQClass<AISign, ST_AI> SQAISign("AISign");
+	DefSQClass<ScriptSign, ST_AI> SQAISign("AISign");
 	SQAISign.PreRegister(engine);
-	SQAISign.AddConstructor<void (AISign::*)(), 1>(engine, "x");
+	SQAISign.AddConstructor<void (ScriptSign::*)(), 1>(engine, "x");
 
-	SQAISign.DefSQConst(engine, AISign::ERR_SIGN_BASE,           "ERR_SIGN_BASE");
-	SQAISign.DefSQConst(engine, AISign::ERR_SIGN_TOO_MANY_SIGNS, "ERR_SIGN_TOO_MANY_SIGNS");
+	SQAISign.DefSQConst(engine, ScriptSign::ERR_SIGN_BASE,           "ERR_SIGN_BASE");
+	SQAISign.DefSQConst(engine, ScriptSign::ERR_SIGN_TOO_MANY_SIGNS, "ERR_SIGN_TOO_MANY_SIGNS");
 
-	AIError::RegisterErrorMap(STR_ERROR_TOO_MANY_SIGNS, AISign::ERR_SIGN_TOO_MANY_SIGNS);
+	ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_SIGNS, ScriptSign::ERR_SIGN_TOO_MANY_SIGNS);
 
-	AIError::RegisterErrorMapString(AISign::ERR_SIGN_TOO_MANY_SIGNS, "ERR_SIGN_TOO_MANY_SIGNS");
+	ScriptError::RegisterErrorMapString(ScriptSign::ERR_SIGN_TOO_MANY_SIGNS, "ERR_SIGN_TOO_MANY_SIGNS");
 
-	SQAISign.DefSQStaticMethod(engine, &AISign::IsValidSign, "IsValidSign", 2, ".i");
-	SQAISign.DefSQStaticMethod(engine, &AISign::SetName,     "SetName",     3, ".i.");
-	SQAISign.DefSQStaticMethod(engine, &AISign::GetName,     "GetName",     2, ".i");
-	SQAISign.DefSQStaticMethod(engine, &AISign::GetLocation, "GetLocation", 2, ".i");
-	SQAISign.DefSQStaticMethod(engine, &AISign::BuildSign,   "BuildSign",   3, ".i.");
-	SQAISign.DefSQStaticMethod(engine, &AISign::RemoveSign,  "RemoveSign",  2, ".i");
+	SQAISign.DefSQStaticMethod(engine, &ScriptSign::IsValidSign, "IsValidSign", 2, ".i");
+	SQAISign.DefSQStaticMethod(engine, &ScriptSign::SetName,     "SetName",     3, ".i.");
+	SQAISign.DefSQStaticMethod(engine, &ScriptSign::GetName,     "GetName",     2, ".i");
+	SQAISign.DefSQStaticMethod(engine, &ScriptSign::GetLocation, "GetLocation", 2, ".i");
+	SQAISign.DefSQStaticMethod(engine, &ScriptSign::BuildSign,   "BuildSign",   3, ".i.");
+	SQAISign.DefSQStaticMethod(engine, &ScriptSign::RemoveSign,  "RemoveSign",  2, ".i");
 
 	SQAISign.PostRegister(engine);
 }
--- a/src/ai/api/ai_signlist.hpp.sq
+++ b/src/ai/api/ai_signlist.hpp.sq
@@ -12,21 +12,21 @@
 #include "../../script/api/script_signlist.hpp"
 
 namespace SQConvert {
-	/* Allow AISignList to be used as Squirrel parameter */
-	template <> inline AISignList *GetParam(ForceType<AISignList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AISignList *)instance; }
-	template <> inline AISignList &GetParam(ForceType<AISignList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISignList *)instance; }
-	template <> inline const AISignList *GetParam(ForceType<const AISignList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AISignList *)instance; }
-	template <> inline const AISignList &GetParam(ForceType<const AISignList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISignList *)instance; }
-	template <> inline int Return<AISignList *>(HSQUIRRELVM vm, AISignList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "SignList", res, NULL, DefSQDestructorCallback<AISignList>, true); return 1; }
+	/* Allow ScriptSignList to be used as Squirrel parameter */
+	template <> inline ScriptSignList *GetParam(ForceType<ScriptSignList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptSignList *)instance; }
+	template <> inline ScriptSignList &GetParam(ForceType<ScriptSignList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptSignList *)instance; }
+	template <> inline const ScriptSignList *GetParam(ForceType<const ScriptSignList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptSignList *)instance; }
+	template <> inline const ScriptSignList &GetParam(ForceType<const ScriptSignList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptSignList *)instance; }
+	template <> inline int Return<ScriptSignList *>(HSQUIRRELVM vm, ScriptSignList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "SignList", res, NULL, DefSQDestructorCallback<ScriptSignList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AISignList, ST_AI>() { return "AISignList"; }
+template <> const char *GetClassName<ScriptSignList, ST_AI>() { return "AISignList"; }
 
 void SQAISignList_Register(Squirrel *engine)
 {
-	DefSQClass<AISignList, ST_AI> SQAISignList("AISignList");
+	DefSQClass<ScriptSignList, ST_AI> SQAISignList("AISignList");
 	SQAISignList.PreRegister(engine, "AIList");
-	SQAISignList.AddConstructor<void (AISignList::*)(), 1>(engine, "x");
+	SQAISignList.AddConstructor<void (ScriptSignList::*)(), 1>(engine, "x");
 
 	SQAISignList.PostRegister(engine);
 }
--- a/src/ai/api/ai_station.hpp.sq
+++ b/src/ai/api/ai_station.hpp.sq
@@ -13,61 +13,61 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIStation::ErrorMessages GetParam(ForceType<AIStation::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIStation::ErrorMessages)tmp; }
-	template <> inline int Return<AIStation::ErrorMessages>(HSQUIRRELVM vm, AIStation::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIStation::StationType GetParam(ForceType<AIStation::StationType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIStation::StationType)tmp; }
-	template <> inline int Return<AIStation::StationType>(HSQUIRRELVM vm, AIStation::StationType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptStation::ErrorMessages GetParam(ForceType<ScriptStation::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptStation::ErrorMessages)tmp; }
+	template <> inline int Return<ScriptStation::ErrorMessages>(HSQUIRRELVM vm, ScriptStation::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptStation::StationType GetParam(ForceType<ScriptStation::StationType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptStation::StationType)tmp; }
+	template <> inline int Return<ScriptStation::StationType>(HSQUIRRELVM vm, ScriptStation::StationType res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIStation to be used as Squirrel parameter */
-	template <> inline AIStation *GetParam(ForceType<AIStation *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIStation *)instance; }
-	template <> inline AIStation &GetParam(ForceType<AIStation &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStation *)instance; }
-	template <> inline const AIStation *GetParam(ForceType<const AIStation *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIStation *)instance; }
-	template <> inline const AIStation &GetParam(ForceType<const AIStation &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStation *)instance; }
-	template <> inline int Return<AIStation *>(HSQUIRRELVM vm, AIStation *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Station", res, NULL, DefSQDestructorCallback<AIStation>, true); return 1; }
+	/* Allow ScriptStation to be used as Squirrel parameter */
+	template <> inline ScriptStation *GetParam(ForceType<ScriptStation *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptStation *)instance; }
+	template <> inline ScriptStation &GetParam(ForceType<ScriptStation &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStation *)instance; }
+	template <> inline const ScriptStation *GetParam(ForceType<const ScriptStation *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptStation *)instance; }
+	template <> inline const ScriptStation &GetParam(ForceType<const ScriptStation &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStation *)instance; }
+	template <> inline int Return<ScriptStation *>(HSQUIRRELVM vm, ScriptStation *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Station", res, NULL, DefSQDestructorCallback<ScriptStation>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIStation, ST_AI>() { return "AIStation"; }
+template <> const char *GetClassName<ScriptStation, ST_AI>() { return "AIStation"; }
 
 void SQAIStation_Register(Squirrel *engine)
 {
-	DefSQClass<AIStation, ST_AI> SQAIStation("AIStation");
+	DefSQClass<ScriptStation, ST_AI> SQAIStation("AIStation");
 	SQAIStation.PreRegister(engine, "AIBaseStation");
-	SQAIStation.AddConstructor<void (AIStation::*)(), 1>(engine, "x");
+	SQAIStation.AddConstructor<void (ScriptStation::*)(), 1>(engine, "x");
 
-	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_BASE,                         "ERR_STATION_BASE");
-	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION");
-	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_MANY_STATIONS,            "ERR_STATION_TOO_MANY_STATIONS");
-	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,    "ERR_STATION_TOO_MANY_STATIONS_IN_TOWN");
-	SQAIStation.DefSQConst(engine, AIStation::STATION_TRAIN,                            "STATION_TRAIN");
-	SQAIStation.DefSQConst(engine, AIStation::STATION_TRUCK_STOP,                       "STATION_TRUCK_STOP");
-	SQAIStation.DefSQConst(engine, AIStation::STATION_BUS_STOP,                         "STATION_BUS_STOP");
-	SQAIStation.DefSQConst(engine, AIStation::STATION_AIRPORT,                          "STATION_AIRPORT");
-	SQAIStation.DefSQConst(engine, AIStation::STATION_DOCK,                             "STATION_DOCK");
-	SQAIStation.DefSQConst(engine, AIStation::STATION_ANY,                              "STATION_ANY");
+	SQAIStation.DefSQConst(engine, ScriptStation::ERR_STATION_BASE,                         "ERR_STATION_BASE");
+	SQAIStation.DefSQConst(engine, ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION");
+	SQAIStation.DefSQConst(engine, ScriptStation::ERR_STATION_TOO_MANY_STATIONS,            "ERR_STATION_TOO_MANY_STATIONS");
+	SQAIStation.DefSQConst(engine, ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,    "ERR_STATION_TOO_MANY_STATIONS_IN_TOWN");
+	SQAIStation.DefSQConst(engine, ScriptStation::STATION_TRAIN,                            "STATION_TRAIN");
+	SQAIStation.DefSQConst(engine, ScriptStation::STATION_TRUCK_STOP,                       "STATION_TRUCK_STOP");
+	SQAIStation.DefSQConst(engine, ScriptStation::STATION_BUS_STOP,                         "STATION_BUS_STOP");
+	SQAIStation.DefSQConst(engine, ScriptStation::STATION_AIRPORT,                          "STATION_AIRPORT");
+	SQAIStation.DefSQConst(engine, ScriptStation::STATION_DOCK,                             "STATION_DOCK");
+	SQAIStation.DefSQConst(engine, ScriptStation::STATION_ANY,                              "STATION_ANY");
 
-	AIError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT,    AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION);
-	AIError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION,    AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION);
-	AIError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK,       AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION);
-	AIError::RegisterErrorMap(STR_ERROR_TOO_MANY_STATIONS_LOADING,       AIStation::ERR_STATION_TOO_MANY_STATIONS);
-	AIError::RegisterErrorMap(STR_ERROR_TOO_MANY_TRUCK_STOPS,            AIStation::ERR_STATION_TOO_MANY_STATIONS);
-	AIError::RegisterErrorMap(STR_ERROR_TOO_MANY_BUS_STOPS,              AIStation::ERR_STATION_TOO_MANY_STATIONS);
-	AIError::RegisterErrorMap(STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT, AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN);
+	ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT,    ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION);
+	ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION,    ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION);
+	ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK,       ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION);
+	ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_STATIONS_LOADING,       ScriptStation::ERR_STATION_TOO_MANY_STATIONS);
+	ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_TRUCK_STOPS,            ScriptStation::ERR_STATION_TOO_MANY_STATIONS);
+	ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_BUS_STOPS,              ScriptStation::ERR_STATION_TOO_MANY_STATIONS);
+	ScriptError::RegisterErrorMap(STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT, ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN);
 
-	AIError::RegisterErrorMapString(AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION");
-	AIError::RegisterErrorMapString(AIStation::ERR_STATION_TOO_MANY_STATIONS,            "ERR_STATION_TOO_MANY_STATIONS");
-	AIError::RegisterErrorMapString(AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,    "ERR_STATION_TOO_MANY_STATIONS_IN_TOWN");
+	ScriptError::RegisterErrorMapString(ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION");
+	ScriptError::RegisterErrorMapString(ScriptStation::ERR_STATION_TOO_MANY_STATIONS,            "ERR_STATION_TOO_MANY_STATIONS");
+	ScriptError::RegisterErrorMapString(ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,    "ERR_STATION_TOO_MANY_STATIONS_IN_TOWN");
 
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::IsValidStation,             "IsValidStation",             2, ".i");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetStationID,               "GetStationID",               2, ".i");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCargoWaiting,            "GetCargoWaiting",            3, ".ii");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCargoRating,             "GetCargoRating",             3, ".ii");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCoverageRadius,          "GetCoverageRadius",          2, ".i");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, ".ii");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetDistanceSquareToTile,    "GetDistanceSquareToTile",    3, ".ii");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::IsWithinTownInfluence,      "IsWithinTownInfluence",      3, ".ii");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::HasStationType,             "HasStationType",             3, ".ii");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::HasRoadType,                "HasRoadType",                3, ".ii");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetNearestTown,             "GetNearestTown",             2, ".i");
+	SQAIStation.DefSQStaticMethod(engine, &ScriptStation::IsValidStation,             "IsValidStation",             2, ".i");
+	SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetStationID,               "GetStationID",               2, ".i");
+	SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoWaiting,            "GetCargoWaiting",            3, ".ii");
+	SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoRating,             "GetCargoRating",             3, ".ii");
+	SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCoverageRadius,          "GetCoverageRadius",          2, ".i");
+	SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, ".ii");
+	SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetDistanceSquareToTile,    "GetDistanceSquareToTile",    3, ".ii");
+	SQAIStation.DefSQStaticMethod(engine, &ScriptStation::IsWithinTownInfluence,      "IsWithinTownInfluence",      3, ".ii");
+	SQAIStation.DefSQStaticMethod(engine, &ScriptStation::HasStationType,             "HasStationType",             3, ".ii");
+	SQAIStation.DefSQStaticMethod(engine, &ScriptStation::HasRoadType,                "HasRoadType",                3, ".ii");
+	SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetNearestTown,             "GetNearestTown",             2, ".i");
 
 	SQAIStation.PostRegister(engine);
 }
--- a/src/ai/api/ai_stationlist.hpp.sq
+++ b/src/ai/api/ai_stationlist.hpp.sq
@@ -12,41 +12,41 @@
 #include "../../script/api/script_stationlist.hpp"
 
 namespace SQConvert {
-	/* Allow AIStationList to be used as Squirrel parameter */
-	template <> inline AIStationList *GetParam(ForceType<AIStationList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIStationList *)instance; }
-	template <> inline AIStationList &GetParam(ForceType<AIStationList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStationList *)instance; }
-	template <> inline const AIStationList *GetParam(ForceType<const AIStationList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIStationList *)instance; }
-	template <> inline const AIStationList &GetParam(ForceType<const AIStationList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStationList *)instance; }
-	template <> inline int Return<AIStationList *>(HSQUIRRELVM vm, AIStationList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList", res, NULL, DefSQDestructorCallback<AIStationList>, true); return 1; }
+	/* Allow ScriptStationList to be used as Squirrel parameter */
+	template <> inline ScriptStationList *GetParam(ForceType<ScriptStationList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptStationList *)instance; }
+	template <> inline ScriptStationList &GetParam(ForceType<ScriptStationList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList *)instance; }
+	template <> inline const ScriptStationList *GetParam(ForceType<const ScriptStationList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptStationList *)instance; }
+	template <> inline const ScriptStationList &GetParam(ForceType<const ScriptStationList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList *)instance; }
+	template <> inline int Return<ScriptStationList *>(HSQUIRRELVM vm, ScriptStationList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList", res, NULL, DefSQDestructorCallback<ScriptStationList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIStationList, ST_AI>() { return "AIStationList"; }
+template <> const char *GetClassName<ScriptStationList, ST_AI>() { return "AIStationList"; }
 
 void SQAIStationList_Register(Squirrel *engine)
 {
-	DefSQClass<AIStationList, ST_AI> SQAIStationList("AIStationList");
+	DefSQClass<ScriptStationList, ST_AI> SQAIStationList("AIStationList");
 	SQAIStationList.PreRegister(engine, "AIList");
-	SQAIStationList.AddConstructor<void (AIStationList::*)(AIStation::StationType station_type), 2>(engine, "xi");
+	SQAIStationList.AddConstructor<void (ScriptStationList::*)(ScriptStation::StationType station_type), 2>(engine, "xi");
 
 	SQAIStationList.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIStationList_Vehicle to be used as Squirrel parameter */
-	template <> inline AIStationList_Vehicle *GetParam(ForceType<AIStationList_Vehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIStationList_Vehicle *)instance; }
-	template <> inline AIStationList_Vehicle &GetParam(ForceType<AIStationList_Vehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStationList_Vehicle *)instance; }
-	template <> inline const AIStationList_Vehicle *GetParam(ForceType<const AIStationList_Vehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIStationList_Vehicle *)instance; }
-	template <> inline const AIStationList_Vehicle &GetParam(ForceType<const AIStationList_Vehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStationList_Vehicle *)instance; }
-	template <> inline int Return<AIStationList_Vehicle *>(HSQUIRRELVM vm, AIStationList_Vehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_Vehicle", res, NULL, DefSQDestructorCallback<AIStationList_Vehicle>, true); return 1; }
+	/* Allow ScriptStationList_Vehicle to be used as Squirrel parameter */
+	template <> inline ScriptStationList_Vehicle *GetParam(ForceType<ScriptStationList_Vehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptStationList_Vehicle *)instance; }
+	template <> inline ScriptStationList_Vehicle &GetParam(ForceType<ScriptStationList_Vehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_Vehicle *)instance; }
+	template <> inline const ScriptStationList_Vehicle *GetParam(ForceType<const ScriptStationList_Vehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptStationList_Vehicle *)instance; }
+	template <> inline const ScriptStationList_Vehicle &GetParam(ForceType<const ScriptStationList_Vehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_Vehicle *)instance; }
+	template <> inline int Return<ScriptStationList_Vehicle *>(HSQUIRRELVM vm, ScriptStationList_Vehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_Vehicle", res, NULL, DefSQDestructorCallback<ScriptStationList_Vehicle>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIStationList_Vehicle, ST_AI>() { return "AIStationList_Vehicle"; }
+template <> const char *GetClassName<ScriptStationList_Vehicle, ST_AI>() { return "AIStationList_Vehicle"; }
 
 void SQAIStationList_Vehicle_Register(Squirrel *engine)
 {
-	DefSQClass<AIStationList_Vehicle, ST_AI> SQAIStationList_Vehicle("AIStationList_Vehicle");
+	DefSQClass<ScriptStationList_Vehicle, ST_AI> SQAIStationList_Vehicle("AIStationList_Vehicle");
 	SQAIStationList_Vehicle.PreRegister(engine, "AIList");
-	SQAIStationList_Vehicle.AddConstructor<void (AIStationList_Vehicle::*)(VehicleID vehicle_id), 2>(engine, "xi");
+	SQAIStationList_Vehicle.AddConstructor<void (ScriptStationList_Vehicle::*)(VehicleID vehicle_id), 2>(engine, "xi");
 
 	SQAIStationList_Vehicle.PostRegister(engine);
 }
--- a/src/ai/api/ai_subsidy.hpp.sq
+++ b/src/ai/api/ai_subsidy.hpp.sq
@@ -13,38 +13,38 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AISubsidy::SubsidyParticipantType GetParam(ForceType<AISubsidy::SubsidyParticipantType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AISubsidy::SubsidyParticipantType)tmp; }
-	template <> inline int Return<AISubsidy::SubsidyParticipantType>(HSQUIRRELVM vm, AISubsidy::SubsidyParticipantType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptSubsidy::SubsidyParticipantType GetParam(ForceType<ScriptSubsidy::SubsidyParticipantType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptSubsidy::SubsidyParticipantType)tmp; }
+	template <> inline int Return<ScriptSubsidy::SubsidyParticipantType>(HSQUIRRELVM vm, ScriptSubsidy::SubsidyParticipantType res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AISubsidy to be used as Squirrel parameter */
-	template <> inline AISubsidy *GetParam(ForceType<AISubsidy *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AISubsidy *)instance; }
-	template <> inline AISubsidy &GetParam(ForceType<AISubsidy &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISubsidy *)instance; }
-	template <> inline const AISubsidy *GetParam(ForceType<const AISubsidy *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AISubsidy *)instance; }
-	template <> inline const AISubsidy &GetParam(ForceType<const AISubsidy &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISubsidy *)instance; }
-	template <> inline int Return<AISubsidy *>(HSQUIRRELVM vm, AISubsidy *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Subsidy", res, NULL, DefSQDestructorCallback<AISubsidy>, true); return 1; }
+	/* Allow ScriptSubsidy to be used as Squirrel parameter */
+	template <> inline ScriptSubsidy *GetParam(ForceType<ScriptSubsidy *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptSubsidy *)instance; }
+	template <> inline ScriptSubsidy &GetParam(ForceType<ScriptSubsidy &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptSubsidy *)instance; }
+	template <> inline const ScriptSubsidy *GetParam(ForceType<const ScriptSubsidy *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptSubsidy *)instance; }
+	template <> inline const ScriptSubsidy &GetParam(ForceType<const ScriptSubsidy &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptSubsidy *)instance; }
+	template <> inline int Return<ScriptSubsidy *>(HSQUIRRELVM vm, ScriptSubsidy *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Subsidy", res, NULL, DefSQDestructorCallback<ScriptSubsidy>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AISubsidy, ST_AI>() { return "AISubsidy"; }
+template <> const char *GetClassName<ScriptSubsidy, ST_AI>() { return "AISubsidy"; }
 
 void SQAISubsidy_Register(Squirrel *engine)
 {
-	DefSQClass<AISubsidy, ST_AI> SQAISubsidy("AISubsidy");
+	DefSQClass<ScriptSubsidy, ST_AI> SQAISubsidy("AISubsidy");
 	SQAISubsidy.PreRegister(engine);
-	SQAISubsidy.AddConstructor<void (AISubsidy::*)(), 1>(engine, "x");
+	SQAISubsidy.AddConstructor<void (ScriptSubsidy::*)(), 1>(engine, "x");
 
-	SQAISubsidy.DefSQConst(engine, AISubsidy::SPT_INDUSTRY, "SPT_INDUSTRY");
-	SQAISubsidy.DefSQConst(engine, AISubsidy::SPT_TOWN,     "SPT_TOWN");
-	SQAISubsidy.DefSQConst(engine, AISubsidy::SPT_INVALID,  "SPT_INVALID");
+	SQAISubsidy.DefSQConst(engine, ScriptSubsidy::SPT_INDUSTRY, "SPT_INDUSTRY");
+	SQAISubsidy.DefSQConst(engine, ScriptSubsidy::SPT_TOWN,     "SPT_TOWN");
+	SQAISubsidy.DefSQConst(engine, ScriptSubsidy::SPT_INVALID,  "SPT_INVALID");
 
-	SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::IsValidSubsidy,      "IsValidSubsidy",      2, ".i");
-	SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::IsAwarded,           "IsAwarded",           2, ".i");
-	SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetAwardedTo,        "GetAwardedTo",        2, ".i");
-	SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetExpireDate,       "GetExpireDate",       2, ".i");
-	SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetCargoType,        "GetCargoType",        2, ".i");
-	SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetSourceType,       "GetSourceType",       2, ".i");
-	SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetSourceIndex,      "GetSourceIndex",      2, ".i");
-	SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetDestinationType,  "GetDestinationType",  2, ".i");
-	SQAISubsidy.DefSQStaticMethod(engine, &AISubsidy::GetDestinationIndex, "GetDestinationIndex", 2, ".i");
+	SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::IsValidSubsidy,      "IsValidSubsidy",      2, ".i");
+	SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::IsAwarded,           "IsAwarded",           2, ".i");
+	SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetAwardedTo,        "GetAwardedTo",        2, ".i");
+	SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetExpireDate,       "GetExpireDate",       2, ".i");
+	SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetCargoType,        "GetCargoType",        2, ".i");
+	SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetSourceType,       "GetSourceType",       2, ".i");
+	SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetSourceIndex,      "GetSourceIndex",      2, ".i");
+	SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetDestinationType,  "GetDestinationType",  2, ".i");
+	SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetDestinationIndex, "GetDestinationIndex", 2, ".i");
 
 	SQAISubsidy.PostRegister(engine);
 }
--- a/src/ai/api/ai_subsidylist.hpp.sq
+++ b/src/ai/api/ai_subsidylist.hpp.sq
@@ -12,21 +12,21 @@
 #include "../../script/api/script_subsidylist.hpp"
 
 namespace SQConvert {
-	/* Allow AISubsidyList to be used as Squirrel parameter */
-	template <> inline AISubsidyList *GetParam(ForceType<AISubsidyList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AISubsidyList *)instance; }
-	template <> inline AISubsidyList &GetParam(ForceType<AISubsidyList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISubsidyList *)instance; }
-	template <> inline const AISubsidyList *GetParam(ForceType<const AISubsidyList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AISubsidyList *)instance; }
-	template <> inline const AISubsidyList &GetParam(ForceType<const AISubsidyList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISubsidyList *)instance; }
-	template <> inline int Return<AISubsidyList *>(HSQUIRRELVM vm, AISubsidyList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "SubsidyList", res, NULL, DefSQDestructorCallback<AISubsidyList>, true); return 1; }
+	/* Allow ScriptSubsidyList to be used as Squirrel parameter */
+	template <> inline ScriptSubsidyList *GetParam(ForceType<ScriptSubsidyList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptSubsidyList *)instance; }
+	template <> inline ScriptSubsidyList &GetParam(ForceType<ScriptSubsidyList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptSubsidyList *)instance; }
+	template <> inline const ScriptSubsidyList *GetParam(ForceType<const ScriptSubsidyList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptSubsidyList *)instance; }
+	template <> inline const ScriptSubsidyList &GetParam(ForceType<const ScriptSubsidyList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptSubsidyList *)instance; }
+	template <> inline int Return<ScriptSubsidyList *>(HSQUIRRELVM vm, ScriptSubsidyList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "SubsidyList", res, NULL, DefSQDestructorCallback<ScriptSubsidyList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AISubsidyList, ST_AI>() { return "AISubsidyList"; }
+template <> const char *GetClassName<ScriptSubsidyList, ST_AI>() { return "AISubsidyList"; }
 
 void SQAISubsidyList_Register(Squirrel *engine)
 {
-	DefSQClass<AISubsidyList, ST_AI> SQAISubsidyList("AISubsidyList");
+	DefSQClass<ScriptSubsidyList, ST_AI> SQAISubsidyList("AISubsidyList");
 	SQAISubsidyList.PreRegister(engine, "AIList");
-	SQAISubsidyList.AddConstructor<void (AISubsidyList::*)(), 1>(engine, "x");
+	SQAISubsidyList.AddConstructor<void (ScriptSubsidyList::*)(), 1>(engine, "x");
 
 	SQAISubsidyList.PostRegister(engine);
 }
--- a/src/ai/api/ai_testmode.hpp.sq
+++ b/src/ai/api/ai_testmode.hpp.sq
@@ -12,21 +12,21 @@
 #include "../../script/api/script_testmode.hpp"
 
 namespace SQConvert {
-	/* Allow AITestMode to be used as Squirrel parameter */
-	template <> inline AITestMode *GetParam(ForceType<AITestMode *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITestMode *)instance; }
-	template <> inline AITestMode &GetParam(ForceType<AITestMode &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITestMode *)instance; }
-	template <> inline const AITestMode *GetParam(ForceType<const AITestMode *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITestMode *)instance; }
-	template <> inline const AITestMode &GetParam(ForceType<const AITestMode &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITestMode *)instance; }
-	template <> inline int Return<AITestMode *>(HSQUIRRELVM vm, AITestMode *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TestMode", res, NULL, DefSQDestructorCallback<AITestMode>, true); return 1; }
+	/* Allow ScriptTestMode to be used as Squirrel parameter */
+	template <> inline ScriptTestMode *GetParam(ForceType<ScriptTestMode *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTestMode *)instance; }
+	template <> inline ScriptTestMode &GetParam(ForceType<ScriptTestMode &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTestMode *)instance; }
+	template <> inline const ScriptTestMode *GetParam(ForceType<const ScriptTestMode *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTestMode *)instance; }
+	template <> inline const ScriptTestMode &GetParam(ForceType<const ScriptTestMode &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTestMode *)instance; }
+	template <> inline int Return<ScriptTestMode *>(HSQUIRRELVM vm, ScriptTestMode *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TestMode", res, NULL, DefSQDestructorCallback<ScriptTestMode>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AITestMode, ST_AI>() { return "AITestMode"; }
+template <> const char *GetClassName<ScriptTestMode, ST_AI>() { return "AITestMode"; }
 
 void SQAITestMode_Register(Squirrel *engine)
 {
-	DefSQClass<AITestMode, ST_AI> SQAITestMode("AITestMode");
+	DefSQClass<ScriptTestMode, ST_AI> SQAITestMode("AITestMode");
 	SQAITestMode.PreRegister(engine);
-	SQAITestMode.AddConstructor<void (AITestMode::*)(), 1>(engine, "x");
+	SQAITestMode.AddConstructor<void (ScriptTestMode::*)(), 1>(engine, "x");
 
 	SQAITestMode.PostRegister(engine);
 }
--- a/src/ai/api/ai_tile.hpp.sq
+++ b/src/ai/api/ai_tile.hpp.sq
@@ -13,123 +13,123 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AITile::ErrorMessages GetParam(ForceType<AITile::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITile::ErrorMessages)tmp; }
-	template <> inline int Return<AITile::ErrorMessages>(HSQUIRRELVM vm, AITile::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AITile::Corner GetParam(ForceType<AITile::Corner>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITile::Corner)tmp; }
-	template <> inline int Return<AITile::Corner>(HSQUIRRELVM vm, AITile::Corner res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AITile::Slope GetParam(ForceType<AITile::Slope>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITile::Slope)tmp; }
-	template <> inline int Return<AITile::Slope>(HSQUIRRELVM vm, AITile::Slope res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AITile::TransportType GetParam(ForceType<AITile::TransportType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITile::TransportType)tmp; }
-	template <> inline int Return<AITile::TransportType>(HSQUIRRELVM vm, AITile::TransportType res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AITile::BuildType GetParam(ForceType<AITile::BuildType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITile::BuildType)tmp; }
-	template <> inline int Return<AITile::BuildType>(HSQUIRRELVM vm, AITile::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptTile::ErrorMessages GetParam(ForceType<ScriptTile::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::ErrorMessages)tmp; }
+	template <> inline int Return<ScriptTile::ErrorMessages>(HSQUIRRELVM vm, ScriptTile::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptTile::Corner GetParam(ForceType<ScriptTile::Corner>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::Corner)tmp; }
+	template <> inline int Return<ScriptTile::Corner>(HSQUIRRELVM vm, ScriptTile::Corner res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptTile::Slope GetParam(ForceType<ScriptTile::Slope>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::Slope)tmp; }
+	template <> inline int Return<ScriptTile::Slope>(HSQUIRRELVM vm, ScriptTile::Slope res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptTile::TransportType GetParam(ForceType<ScriptTile::TransportType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::TransportType)tmp; }
+	template <> inline int Return<ScriptTile::TransportType>(HSQUIRRELVM vm, ScriptTile::TransportType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptTile::BuildType GetParam(ForceType<ScriptTile::BuildType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::BuildType)tmp; }
+	template <> inline int Return<ScriptTile::BuildType>(HSQUIRRELVM vm, ScriptTile::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AITile to be used as Squirrel parameter */
-	template <> inline AITile *GetParam(ForceType<AITile *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITile *)instance; }
-	template <> inline AITile &GetParam(ForceType<AITile &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITile *)instance; }
-	template <> inline const AITile *GetParam(ForceType<const AITile *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITile *)instance; }
-	template <> inline const AITile &GetParam(ForceType<const AITile &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITile *)instance; }
-	template <> inline int Return<AITile *>(HSQUIRRELVM vm, AITile *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Tile", res, NULL, DefSQDestructorCallback<AITile>, true); return 1; }
+	/* Allow ScriptTile to be used as Squirrel parameter */
+	template <> inline ScriptTile *GetParam(ForceType<ScriptTile *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTile *)instance; }
+	template <> inline ScriptTile &GetParam(ForceType<ScriptTile &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTile *)instance; }
+	template <> inline const ScriptTile *GetParam(ForceType<const ScriptTile *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTile *)instance; }
+	template <> inline const ScriptTile &GetParam(ForceType<const ScriptTile &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTile *)instance; }
+	template <> inline int Return<ScriptTile *>(HSQUIRRELVM vm, ScriptTile *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Tile", res, NULL, DefSQDestructorCallback<ScriptTile>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AITile, ST_AI>() { return "AITile"; }
+template <> const char *GetClassName<ScriptTile, ST_AI>() { return "AITile"; }
 
 void SQAITile_Register(Squirrel *engine)
 {
-	DefSQClass<AITile, ST_AI> SQAITile("AITile");
+	DefSQClass<ScriptTile, ST_AI> SQAITile("AITile");
 	SQAITile.PreRegister(engine);
-	SQAITile.AddConstructor<void (AITile::*)(), 1>(engine, "x");
+	SQAITile.AddConstructor<void (ScriptTile::*)(), 1>(engine, "x");
 
-	SQAITile.DefSQConst(engine, AITile::ERR_TILE_BASE,               "ERR_TILE_BASE");
-	SQAITile.DefSQConst(engine, AITile::ERR_TILE_TOO_HIGH,           "ERR_TILE_TOO_HIGH");
-	SQAITile.DefSQConst(engine, AITile::ERR_TILE_TOO_LOW,            "ERR_TILE_TOO_LOW");
-	SQAITile.DefSQConst(engine, AITile::ERR_AREA_ALREADY_FLAT,       "ERR_AREA_ALREADY_FLAT");
-	SQAITile.DefSQConst(engine, AITile::ERR_EXCAVATION_WOULD_DAMAGE, "ERR_EXCAVATION_WOULD_DAMAGE");
-	SQAITile.DefSQConst(engine, AITile::CORNER_W,                    "CORNER_W");
-	SQAITile.DefSQConst(engine, AITile::CORNER_S,                    "CORNER_S");
-	SQAITile.DefSQConst(engine, AITile::CORNER_E,                    "CORNER_E");
-	SQAITile.DefSQConst(engine, AITile::CORNER_N,                    "CORNER_N");
-	SQAITile.DefSQConst(engine, AITile::CORNER_INVALID,              "CORNER_INVALID");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_FLAT,                  "SLOPE_FLAT");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_W,                     "SLOPE_W");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_S,                     "SLOPE_S");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_E,                     "SLOPE_E");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_N,                     "SLOPE_N");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP,                 "SLOPE_STEEP");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_NW,                    "SLOPE_NW");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_SW,                    "SLOPE_SW");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_SE,                    "SLOPE_SE");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_NE,                    "SLOPE_NE");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_EW,                    "SLOPE_EW");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_NS,                    "SLOPE_NS");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_ELEVATED,              "SLOPE_ELEVATED");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_NWS,                   "SLOPE_NWS");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_WSE,                   "SLOPE_WSE");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_SEN,                   "SLOPE_SEN");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_ENW,                   "SLOPE_ENW");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP_W,               "SLOPE_STEEP_W");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP_S,               "SLOPE_STEEP_S");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP_E,               "SLOPE_STEEP_E");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP_N,               "SLOPE_STEEP_N");
-	SQAITile.DefSQConst(engine, AITile::SLOPE_INVALID,               "SLOPE_INVALID");
-	SQAITile.DefSQConst(engine, AITile::TRANSPORT_RAIL,              "TRANSPORT_RAIL");
-	SQAITile.DefSQConst(engine, AITile::TRANSPORT_ROAD,              "TRANSPORT_ROAD");
-	SQAITile.DefSQConst(engine, AITile::TRANSPORT_WATER,             "TRANSPORT_WATER");
-	SQAITile.DefSQConst(engine, AITile::TRANSPORT_AIR,               "TRANSPORT_AIR");
-	SQAITile.DefSQConst(engine, AITile::TRANSPORT_INVALID,           "TRANSPORT_INVALID");
-	SQAITile.DefSQConst(engine, AITile::BT_FOUNDATION,               "BT_FOUNDATION");
-	SQAITile.DefSQConst(engine, AITile::BT_TERRAFORM,                "BT_TERRAFORM");
-	SQAITile.DefSQConst(engine, AITile::BT_BUILD_TREES,              "BT_BUILD_TREES");
-	SQAITile.DefSQConst(engine, AITile::BT_CLEAR_GRASS,              "BT_CLEAR_GRASS");
-	SQAITile.DefSQConst(engine, AITile::BT_CLEAR_ROUGH,              "BT_CLEAR_ROUGH");
-	SQAITile.DefSQConst(engine, AITile::BT_CLEAR_ROCKY,              "BT_CLEAR_ROCKY");
-	SQAITile.DefSQConst(engine, AITile::BT_CLEAR_FIELDS,             "BT_CLEAR_FIELDS");
-	SQAITile.DefSQConst(engine, AITile::BT_CLEAR_HOUSE,              "BT_CLEAR_HOUSE");
+	SQAITile.DefSQConst(engine, ScriptTile::ERR_TILE_BASE,               "ERR_TILE_BASE");
+	SQAITile.DefSQConst(engine, ScriptTile::ERR_TILE_TOO_HIGH,           "ERR_TILE_TOO_HIGH");
+	SQAITile.DefSQConst(engine, ScriptTile::ERR_TILE_TOO_LOW,            "ERR_TILE_TOO_LOW");
+	SQAITile.DefSQConst(engine, ScriptTile::ERR_AREA_ALREADY_FLAT,       "ERR_AREA_ALREADY_FLAT");
+	SQAITile.DefSQConst(engine, ScriptTile::ERR_EXCAVATION_WOULD_DAMAGE, "ERR_EXCAVATION_WOULD_DAMAGE");
+	SQAITile.DefSQConst(engine, ScriptTile::CORNER_W,                    "CORNER_W");
+	SQAITile.DefSQConst(engine, ScriptTile::CORNER_S,                    "CORNER_S");
+	SQAITile.DefSQConst(engine, ScriptTile::CORNER_E,                    "CORNER_E");
+	SQAITile.DefSQConst(engine, ScriptTile::CORNER_N,                    "CORNER_N");
+	SQAITile.DefSQConst(engine, ScriptTile::CORNER_INVALID,              "CORNER_INVALID");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_FLAT,                  "SLOPE_FLAT");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_W,                     "SLOPE_W");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_S,                     "SLOPE_S");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_E,                     "SLOPE_E");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_N,                     "SLOPE_N");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_STEEP,                 "SLOPE_STEEP");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_NW,                    "SLOPE_NW");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_SW,                    "SLOPE_SW");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_SE,                    "SLOPE_SE");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_NE,                    "SLOPE_NE");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_EW,                    "SLOPE_EW");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_NS,                    "SLOPE_NS");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_ELEVATED,              "SLOPE_ELEVATED");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_NWS,                   "SLOPE_NWS");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_WSE,                   "SLOPE_WSE");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_SEN,                   "SLOPE_SEN");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_ENW,                   "SLOPE_ENW");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_STEEP_W,               "SLOPE_STEEP_W");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_STEEP_S,               "SLOPE_STEEP_S");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_STEEP_E,               "SLOPE_STEEP_E");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_STEEP_N,               "SLOPE_STEEP_N");
+	SQAITile.DefSQConst(engine, ScriptTile::SLOPE_INVALID,               "SLOPE_INVALID");
+	SQAITile.DefSQConst(engine, ScriptTile::TRANSPORT_RAIL,              "TRANSPORT_RAIL");
+	SQAITile.DefSQConst(engine, ScriptTile::TRANSPORT_ROAD,              "TRANSPORT_ROAD");
+	SQAITile.DefSQConst(engine, ScriptTile::TRANSPORT_WATER,             "TRANSPORT_WATER");
+	SQAITile.DefSQConst(engine, ScriptTile::TRANSPORT_AIR,               "TRANSPORT_AIR");
+	SQAITile.DefSQConst(engine, ScriptTile::TRANSPORT_INVALID,           "TRANSPORT_INVALID");
+	SQAITile.DefSQConst(engine, ScriptTile::BT_FOUNDATION,               "BT_FOUNDATION");
+	SQAITile.DefSQConst(engine, ScriptTile::BT_TERRAFORM,                "BT_TERRAFORM");
+	SQAITile.DefSQConst(engine, ScriptTile::BT_BUILD_TREES,              "BT_BUILD_TREES");
+	SQAITile.DefSQConst(engine, ScriptTile::BT_CLEAR_GRASS,              "BT_CLEAR_GRASS");
+	SQAITile.DefSQConst(engine, ScriptTile::BT_CLEAR_ROUGH,              "BT_CLEAR_ROUGH");
+	SQAITile.DefSQConst(engine, ScriptTile::BT_CLEAR_ROCKY,              "BT_CLEAR_ROCKY");
+	SQAITile.DefSQConst(engine, ScriptTile::BT_CLEAR_FIELDS,             "BT_CLEAR_FIELDS");
+	SQAITile.DefSQConst(engine, ScriptTile::BT_CLEAR_HOUSE,              "BT_CLEAR_HOUSE");
 
-	AIError::RegisterErrorMap(STR_ERROR_ALREADY_AT_SEA_LEVEL,    AITile::ERR_TILE_TOO_HIGH);
-	AIError::RegisterErrorMap(STR_ERROR_ALREADY_AT_SEA_LEVEL,    AITile::ERR_TILE_TOO_LOW);
-	AIError::RegisterErrorMap(STR_ERROR_ALREADY_LEVELLED,        AITile::ERR_AREA_ALREADY_FLAT);
-	AIError::RegisterErrorMap(STR_ERROR_EXCAVATION_WOULD_DAMAGE, AITile::ERR_EXCAVATION_WOULD_DAMAGE);
+	ScriptError::RegisterErrorMap(STR_ERROR_ALREADY_AT_SEA_LEVEL,    ScriptTile::ERR_TILE_TOO_HIGH);
+	ScriptError::RegisterErrorMap(STR_ERROR_ALREADY_AT_SEA_LEVEL,    ScriptTile::ERR_TILE_TOO_LOW);
+	ScriptError::RegisterErrorMap(STR_ERROR_ALREADY_LEVELLED,        ScriptTile::ERR_AREA_ALREADY_FLAT);
+	ScriptError::RegisterErrorMap(STR_ERROR_EXCAVATION_WOULD_DAMAGE, ScriptTile::ERR_EXCAVATION_WOULD_DAMAGE);
 
-	AIError::RegisterErrorMapString(AITile::ERR_TILE_TOO_HIGH,           "ERR_TILE_TOO_HIGH");
-	AIError::RegisterErrorMapString(AITile::ERR_TILE_TOO_LOW,            "ERR_TILE_TOO_LOW");
-	AIError::RegisterErrorMapString(AITile::ERR_AREA_ALREADY_FLAT,       "ERR_AREA_ALREADY_FLAT");
-	AIError::RegisterErrorMapString(AITile::ERR_EXCAVATION_WOULD_DAMAGE, "ERR_EXCAVATION_WOULD_DAMAGE");
+	ScriptError::RegisterErrorMapString(ScriptTile::ERR_TILE_TOO_HIGH,           "ERR_TILE_TOO_HIGH");
+	ScriptError::RegisterErrorMapString(ScriptTile::ERR_TILE_TOO_LOW,            "ERR_TILE_TOO_LOW");
+	ScriptError::RegisterErrorMapString(ScriptTile::ERR_AREA_ALREADY_FLAT,       "ERR_AREA_ALREADY_FLAT");
+	ScriptError::RegisterErrorMapString(ScriptTile::ERR_EXCAVATION_WOULD_DAMAGE, "ERR_EXCAVATION_WOULD_DAMAGE");
 
-	SQAITile.DefSQStaticMethod(engine, &AITile::IsBuildable,                "IsBuildable",                2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::IsBuildableRectangle,       "IsBuildableRectangle",       4, ".iii");
-	SQAITile.DefSQStaticMethod(engine, &AITile::IsWaterTile,                "IsWaterTile",                2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::IsCoastTile,                "IsCoastTile",                2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::IsStationTile,              "IsStationTile",              2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::IsSteepSlope,               "IsSteepSlope",               2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::IsHalftileSlope,            "IsHalftileSlope",            2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::HasTreeOnTile,              "HasTreeOnTile",              2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::IsFarmTile,                 "IsFarmTile",                 2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::IsRockTile,                 "IsRockTile",                 2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::IsRoughTile,                "IsRoughTile",                2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::IsSnowTile,                 "IsSnowTile",                 2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::IsDesertTile,               "IsDesertTile",               2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::GetSlope,                   "GetSlope",                   2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::GetComplementSlope,         "GetComplementSlope",         2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::GetMinHeight,               "GetMinHeight",               2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::GetMaxHeight,               "GetMaxHeight",               2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::GetCornerHeight,            "GetCornerHeight",            3, ".ii");
-	SQAITile.DefSQStaticMethod(engine, &AITile::GetOwner,                   "GetOwner",                   2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::HasTransportType,           "HasTransportType",           3, ".ii");
-	SQAITile.DefSQStaticMethod(engine, &AITile::GetCargoAcceptance,         "GetCargoAcceptance",         6, ".iiiii");
-	SQAITile.DefSQStaticMethod(engine, &AITile::GetCargoProduction,         "GetCargoProduction",         6, ".iiiii");
-	SQAITile.DefSQStaticMethod(engine, &AITile::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, ".ii");
-	SQAITile.DefSQStaticMethod(engine, &AITile::GetDistanceSquareToTile,    "GetDistanceSquareToTile",    3, ".ii");
-	SQAITile.DefSQStaticMethod(engine, &AITile::RaiseTile,                  "RaiseTile",                  3, ".ii");
-	SQAITile.DefSQStaticMethod(engine, &AITile::LowerTile,                  "LowerTile",                  3, ".ii");
-	SQAITile.DefSQStaticMethod(engine, &AITile::LevelTiles,                 "LevelTiles",                 3, ".ii");
-	SQAITile.DefSQStaticMethod(engine, &AITile::DemolishTile,               "DemolishTile",               2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::PlantTree,                  "PlantTree",                  2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::PlantTreeRectangle,         "PlantTreeRectangle",         4, ".iii");
-	SQAITile.DefSQStaticMethod(engine, &AITile::IsWithinTownInfluence,      "IsWithinTownInfluence",      3, ".ii");
-	SQAITile.DefSQStaticMethod(engine, &AITile::GetTownAuthority,           "GetTownAuthority",           2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::GetClosestTown,             "GetClosestTown",             2, ".i");
-	SQAITile.DefSQStaticMethod(engine, &AITile::GetBuildCost,               "GetBuildCost",               2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::IsBuildable,                "IsBuildable",                2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::IsBuildableRectangle,       "IsBuildableRectangle",       4, ".iii");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::IsWaterTile,                "IsWaterTile",                2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::IsCoastTile,                "IsCoastTile",                2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::IsStationTile,              "IsStationTile",              2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::IsSteepSlope,               "IsSteepSlope",               2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::IsHalftileSlope,            "IsHalftileSlope",            2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::HasTreeOnTile,              "HasTreeOnTile",              2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::IsFarmTile,                 "IsFarmTile",                 2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::IsRockTile,                 "IsRockTile",                 2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::IsRoughTile,                "IsRoughTile",                2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::IsSnowTile,                 "IsSnowTile",                 2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::IsDesertTile,               "IsDesertTile",               2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::GetSlope,                   "GetSlope",                   2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::GetComplementSlope,         "GetComplementSlope",         2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::GetMinHeight,               "GetMinHeight",               2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::GetMaxHeight,               "GetMaxHeight",               2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::GetCornerHeight,            "GetCornerHeight",            3, ".ii");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::GetOwner,                   "GetOwner",                   2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::HasTransportType,           "HasTransportType",           3, ".ii");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::GetCargoAcceptance,         "GetCargoAcceptance",         6, ".iiiii");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::GetCargoProduction,         "GetCargoProduction",         6, ".iiiii");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, ".ii");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::GetDistanceSquareToTile,    "GetDistanceSquareToTile",    3, ".ii");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::RaiseTile,                  "RaiseTile",                  3, ".ii");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::LowerTile,                  "LowerTile",                  3, ".ii");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::LevelTiles,                 "LevelTiles",                 3, ".ii");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::DemolishTile,               "DemolishTile",               2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::PlantTree,                  "PlantTree",                  2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::PlantTreeRectangle,         "PlantTreeRectangle",         4, ".iii");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::IsWithinTownInfluence,      "IsWithinTownInfluence",      3, ".ii");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::GetTownAuthority,           "GetTownAuthority",           2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::GetClosestTown,             "GetClosestTown",             2, ".i");
+	SQAITile.DefSQStaticMethod(engine, &ScriptTile::GetBuildCost,               "GetBuildCost",               2, ".i");
 
 	SQAITile.PostRegister(engine);
 }
--- a/src/ai/api/ai_tilelist.hpp.sq
+++ b/src/ai/api/ai_tilelist.hpp.sq
@@ -12,86 +12,86 @@
 #include "../../script/api/script_tilelist.hpp"
 
 namespace SQConvert {
-	/* Allow AITileList to be used as Squirrel parameter */
-	template <> inline AITileList *GetParam(ForceType<AITileList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITileList *)instance; }
-	template <> inline AITileList &GetParam(ForceType<AITileList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList *)instance; }
-	template <> inline const AITileList *GetParam(ForceType<const AITileList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITileList *)instance; }
-	template <> inline const AITileList &GetParam(ForceType<const AITileList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList *)instance; }
-	template <> inline int Return<AITileList *>(HSQUIRRELVM vm, AITileList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TileList", res, NULL, DefSQDestructorCallback<AITileList>, true); return 1; }
+	/* Allow ScriptTileList to be used as Squirrel parameter */
+	template <> inline ScriptTileList *GetParam(ForceType<ScriptTileList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTileList *)instance; }
+	template <> inline ScriptTileList &GetParam(ForceType<ScriptTileList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTileList *)instance; }
+	template <> inline const ScriptTileList *GetParam(ForceType<const ScriptTileList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTileList *)instance; }
+	template <> inline const ScriptTileList &GetParam(ForceType<const ScriptTileList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTileList *)instance; }
+	template <> inline int Return<ScriptTileList *>(HSQUIRRELVM vm, ScriptTileList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TileList", res, NULL, DefSQDestructorCallback<ScriptTileList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AITileList, ST_AI>() { return "AITileList"; }
+template <> const char *GetClassName<ScriptTileList, ST_AI>() { return "AITileList"; }
 
 void SQAITileList_Register(Squirrel *engine)
 {
-	DefSQClass<AITileList, ST_AI> SQAITileList("AITileList");
+	DefSQClass<ScriptTileList, ST_AI> SQAITileList("AITileList");
 	SQAITileList.PreRegister(engine, "AIList");
-	SQAITileList.AddConstructor<void (AITileList::*)(), 1>(engine, "x");
+	SQAITileList.AddConstructor<void (ScriptTileList::*)(), 1>(engine, "x");
 
-	SQAITileList.DefSQMethod(engine, &AITileList::AddRectangle,    "AddRectangle",    3, "xii");
-	SQAITileList.DefSQMethod(engine, &AITileList::AddTile,         "AddTile",         2, "xi");
-	SQAITileList.DefSQMethod(engine, &AITileList::RemoveRectangle, "RemoveRectangle", 3, "xii");
-	SQAITileList.DefSQMethod(engine, &AITileList::RemoveTile,      "RemoveTile",      2, "xi");
+	SQAITileList.DefSQMethod(engine, &ScriptTileList::AddRectangle,    "AddRectangle",    3, "xii");
+	SQAITileList.DefSQMethod(engine, &ScriptTileList::AddTile,         "AddTile",         2, "xi");
+	SQAITileList.DefSQMethod(engine, &ScriptTileList::RemoveRectangle, "RemoveRectangle", 3, "xii");
+	SQAITileList.DefSQMethod(engine, &ScriptTileList::RemoveTile,      "RemoveTile",      2, "xi");
 
 	SQAITileList.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AITileList_IndustryAccepting to be used as Squirrel parameter */
-	template <> inline AITileList_IndustryAccepting *GetParam(ForceType<AITileList_IndustryAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITileList_IndustryAccepting *)instance; }
-	template <> inline AITileList_IndustryAccepting &GetParam(ForceType<AITileList_IndustryAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList_IndustryAccepting *)instance; }
-	template <> inline const AITileList_IndustryAccepting *GetParam(ForceType<const AITileList_IndustryAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITileList_IndustryAccepting *)instance; }
-	template <> inline const AITileList_IndustryAccepting &GetParam(ForceType<const AITileList_IndustryAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList_IndustryAccepting *)instance; }
-	template <> inline int Return<AITileList_IndustryAccepting *>(HSQUIRRELVM vm, AITileList_IndustryAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TileList_IndustryAccepting", res, NULL, DefSQDestructorCallback<AITileList_IndustryAccepting>, true); return 1; }
+	/* Allow ScriptTileList_IndustryAccepting to be used as Squirrel parameter */
+	template <> inline ScriptTileList_IndustryAccepting *GetParam(ForceType<ScriptTileList_IndustryAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTileList_IndustryAccepting *)instance; }
+	template <> inline ScriptTileList_IndustryAccepting &GetParam(ForceType<ScriptTileList_IndustryAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTileList_IndustryAccepting *)instance; }
+	template <> inline const ScriptTileList_IndustryAccepting *GetParam(ForceType<const ScriptTileList_IndustryAccepting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTileList_IndustryAccepting *)instance; }
+	template <> inline const ScriptTileList_IndustryAccepting &GetParam(ForceType<const ScriptTileList_IndustryAccepting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTileList_IndustryAccepting *)instance; }
+	template <> inline int Return<ScriptTileList_IndustryAccepting *>(HSQUIRRELVM vm, ScriptTileList_IndustryAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TileList_IndustryAccepting", res, NULL, DefSQDestructorCallback<ScriptTileList_IndustryAccepting>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AITileList_IndustryAccepting, ST_AI>() { return "AITileList_IndustryAccepting"; }
+template <> const char *GetClassName<ScriptTileList_IndustryAccepting, ST_AI>() { return "AITileList_IndustryAccepting"; }
 
 void SQAITileList_IndustryAccepting_Register(Squirrel *engine)
 {
-	DefSQClass<AITileList_IndustryAccepting, ST_AI> SQAITileList_IndustryAccepting("AITileList_IndustryAccepting");
+	DefSQClass<ScriptTileList_IndustryAccepting, ST_AI> SQAITileList_IndustryAccepting("AITileList_IndustryAccepting");
 	SQAITileList_IndustryAccepting.PreRegister(engine, "AITileList");
-	SQAITileList_IndustryAccepting.AddConstructor<void (AITileList_IndustryAccepting::*)(IndustryID industry_id, int radius), 3>(engine, "xii");
+	SQAITileList_IndustryAccepting.AddConstructor<void (ScriptTileList_IndustryAccepting::*)(IndustryID industry_id, int radius), 3>(engine, "xii");
 
 	SQAITileList_IndustryAccepting.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AITileList_IndustryProducing to be used as Squirrel parameter */
-	template <> inline AITileList_IndustryProducing *GetParam(ForceType<AITileList_IndustryProducing *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITileList_IndustryProducing *)instance; }
-	template <> inline AITileList_IndustryProducing &GetParam(ForceType<AITileList_IndustryProducing &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList_IndustryProducing *)instance; }
-	template <> inline const AITileList_IndustryProducing *GetParam(ForceType<const AITileList_IndustryProducing *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITileList_IndustryProducing *)instance; }
-	template <> inline const AITileList_IndustryProducing &GetParam(ForceType<const AITileList_IndustryProducing &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList_IndustryProducing *)instance; }
-	template <> inline int Return<AITileList_IndustryProducing *>(HSQUIRRELVM vm, AITileList_IndustryProducing *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TileList_IndustryProducing", res, NULL, DefSQDestructorCallback<AITileList_IndustryProducing>, true); return 1; }
+	/* Allow ScriptTileList_IndustryProducing to be used as Squirrel parameter */
+	template <> inline ScriptTileList_IndustryProducing *GetParam(ForceType<ScriptTileList_IndustryProducing *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTileList_IndustryProducing *)instance; }
+	template <> inline ScriptTileList_IndustryProducing &GetParam(ForceType<ScriptTileList_IndustryProducing &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTileList_IndustryProducing *)instance; }
+	template <> inline const ScriptTileList_IndustryProducing *GetParam(ForceType<const ScriptTileList_IndustryProducing *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTileList_IndustryProducing *)instance; }
+	template <> inline const ScriptTileList_IndustryProducing &GetParam(ForceType<const ScriptTileList_IndustryProducing &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTileList_IndustryProducing *)instance; }
+	template <> inline int Return<ScriptTileList_IndustryProducing *>(HSQUIRRELVM vm, ScriptTileList_IndustryProducing *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TileList_IndustryProducing", res, NULL, DefSQDestructorCallback<ScriptTileList_IndustryProducing>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AITileList_IndustryProducing, ST_AI>() { return "AITileList_IndustryProducing"; }
+template <> const char *GetClassName<ScriptTileList_IndustryProducing, ST_AI>() { return "AITileList_IndustryProducing"; }
 
 void SQAITileList_IndustryProducing_Register(Squirrel *engine)
 {
-	DefSQClass<AITileList_IndustryProducing, ST_AI> SQAITileList_IndustryProducing("AITileList_IndustryProducing");
+	DefSQClass<ScriptTileList_IndustryProducing, ST_AI> SQAITileList_IndustryProducing("AITileList_IndustryProducing");
 	SQAITileList_IndustryProducing.PreRegister(engine, "AITileList");
-	SQAITileList_IndustryProducing.AddConstructor<void (AITileList_IndustryProducing::*)(IndustryID industry_id, int radius), 3>(engine, "xii");
+	SQAITileList_IndustryProducing.AddConstructor<void (ScriptTileList_IndustryProducing::*)(IndustryID industry_id, int radius), 3>(engine, "xii");
 
 	SQAITileList_IndustryProducing.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AITileList_StationType to be used as Squirrel parameter */
-	template <> inline AITileList_StationType *GetParam(ForceType<AITileList_StationType *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITileList_StationType *)instance; }
-	template <> inline AITileList_StationType &GetParam(ForceType<AITileList_StationType &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList_StationType *)instance; }
-	template <> inline const AITileList_StationType *GetParam(ForceType<const AITileList_StationType *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITileList_StationType *)instance; }
-	template <> inline const AITileList_StationType &GetParam(ForceType<const AITileList_StationType &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileList_StationType *)instance; }
-	template <> inline int Return<AITileList_StationType *>(HSQUIRRELVM vm, AITileList_StationType *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TileList_StationType", res, NULL, DefSQDestructorCallback<AITileList_StationType>, true); return 1; }
+	/* Allow ScriptTileList_StationType to be used as Squirrel parameter */
+	template <> inline ScriptTileList_StationType *GetParam(ForceType<ScriptTileList_StationType *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTileList_StationType *)instance; }
+	template <> inline ScriptTileList_StationType &GetParam(ForceType<ScriptTileList_StationType &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTileList_StationType *)instance; }
+	template <> inline const ScriptTileList_StationType *GetParam(ForceType<const ScriptTileList_StationType *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTileList_StationType *)instance; }
+	template <> inline const ScriptTileList_StationType &GetParam(ForceType<const ScriptTileList_StationType &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTileList_StationType *)instance; }
+	template <> inline int Return<ScriptTileList_StationType *>(HSQUIRRELVM vm, ScriptTileList_StationType *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TileList_StationType", res, NULL, DefSQDestructorCallback<ScriptTileList_StationType>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AITileList_StationType, ST_AI>() { return "AITileList_StationType"; }
+template <> const char *GetClassName<ScriptTileList_StationType, ST_AI>() { return "AITileList_StationType"; }
 
 void SQAITileList_StationType_Register(Squirrel *engine)
 {
-	DefSQClass<AITileList_StationType, ST_AI> SQAITileList_StationType("AITileList_StationType");
+	DefSQClass<ScriptTileList_StationType, ST_AI> SQAITileList_StationType("AITileList_StationType");
 	SQAITileList_StationType.PreRegister(engine, "AITileList");
-	SQAITileList_StationType.AddConstructor<void (AITileList_StationType::*)(StationID station_id, AIStation::StationType station_type), 3>(engine, "xii");
+	SQAITileList_StationType.AddConstructor<void (ScriptTileList_StationType::*)(StationID station_id, ScriptStation::StationType station_type), 3>(engine, "xii");
 
 	SQAITileList_StationType.PostRegister(engine);
 }
--- a/src/ai/api/ai_town.hpp.sq
+++ b/src/ai/api/ai_town.hpp.sq
@@ -13,78 +13,78 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AITown::TownAction GetParam(ForceType<AITown::TownAction>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITown::TownAction)tmp; }
-	template <> inline int Return<AITown::TownAction>(HSQUIRRELVM vm, AITown::TownAction res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AITown::TownRating GetParam(ForceType<AITown::TownRating>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITown::TownRating)tmp; }
-	template <> inline int Return<AITown::TownRating>(HSQUIRRELVM vm, AITown::TownRating res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AITown::RoadLayout GetParam(ForceType<AITown::RoadLayout>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITown::RoadLayout)tmp; }
-	template <> inline int Return<AITown::RoadLayout>(HSQUIRRELVM vm, AITown::RoadLayout res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptTown::TownAction GetParam(ForceType<ScriptTown::TownAction>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTown::TownAction)tmp; }
+	template <> inline int Return<ScriptTown::TownAction>(HSQUIRRELVM vm, ScriptTown::TownAction res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptTown::TownRating GetParam(ForceType<ScriptTown::TownRating>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTown::TownRating)tmp; }
+	template <> inline int Return<ScriptTown::TownRating>(HSQUIRRELVM vm, ScriptTown::TownRating res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptTown::RoadLayout GetParam(ForceType<ScriptTown::RoadLayout>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTown::RoadLayout)tmp; }
+	template <> inline int Return<ScriptTown::RoadLayout>(HSQUIRRELVM vm, ScriptTown::RoadLayout res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AITown to be used as Squirrel parameter */
-	template <> inline AITown *GetParam(ForceType<AITown *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITown *)instance; }
-	template <> inline AITown &GetParam(ForceType<AITown &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITown *)instance; }
-	template <> inline const AITown *GetParam(ForceType<const AITown *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITown *)instance; }
-	template <> inline const AITown &GetParam(ForceType<const AITown &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITown *)instance; }
-	template <> inline int Return<AITown *>(HSQUIRRELVM vm, AITown *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Town", res, NULL, DefSQDestructorCallback<AITown>, true); return 1; }
+	/* Allow ScriptTown to be used as Squirrel parameter */
+	template <> inline ScriptTown *GetParam(ForceType<ScriptTown *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTown *)instance; }
+	template <> inline ScriptTown &GetParam(ForceType<ScriptTown &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTown *)instance; }
+	template <> inline const ScriptTown *GetParam(ForceType<const ScriptTown *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTown *)instance; }
+	template <> inline const ScriptTown &GetParam(ForceType<const ScriptTown &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTown *)instance; }
+	template <> inline int Return<ScriptTown *>(HSQUIRRELVM vm, ScriptTown *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Town", res, NULL, DefSQDestructorCallback<ScriptTown>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AITown, ST_AI>() { return "AITown"; }
+template <> const char *GetClassName<ScriptTown, ST_AI>() { return "AITown"; }
 
 void SQAITown_Register(Squirrel *engine)
 {
-	DefSQClass<AITown, ST_AI> SQAITown("AITown");
+	DefSQClass<ScriptTown, ST_AI> SQAITown("AITown");
 	SQAITown.PreRegister(engine);
-	SQAITown.AddConstructor<void (AITown::*)(), 1>(engine, "x");
+	SQAITown.AddConstructor<void (ScriptTown::*)(), 1>(engine, "x");
 
-	SQAITown.DefSQConst(engine, AITown::TOWN_ACTION_ADVERTISE_SMALL,  "TOWN_ACTION_ADVERTISE_SMALL");
-	SQAITown.DefSQConst(engine, AITown::TOWN_ACTION_ADVERTISE_MEDIUM, "TOWN_ACTION_ADVERTISE_MEDIUM");
-	SQAITown.DefSQConst(engine, AITown::TOWN_ACTION_ADVERTISE_LARGE,  "TOWN_ACTION_ADVERTISE_LARGE");
-	SQAITown.DefSQConst(engine, AITown::TOWN_ACTION_ROAD_REBUILD,     "TOWN_ACTION_ROAD_REBUILD");
-	SQAITown.DefSQConst(engine, AITown::TOWN_ACTION_BUILD_STATUE,     "TOWN_ACTION_BUILD_STATUE");
-	SQAITown.DefSQConst(engine, AITown::TOWN_ACTION_FUND_BUILDINGS,   "TOWN_ACTION_FUND_BUILDINGS");
-	SQAITown.DefSQConst(engine, AITown::TOWN_ACTION_BUY_RIGHTS,       "TOWN_ACTION_BUY_RIGHTS");
-	SQAITown.DefSQConst(engine, AITown::TOWN_ACTION_BRIBE,            "TOWN_ACTION_BRIBE");
-	SQAITown.DefSQConst(engine, AITown::TOWN_RATING_NONE,             "TOWN_RATING_NONE");
-	SQAITown.DefSQConst(engine, AITown::TOWN_RATING_APPALLING,        "TOWN_RATING_APPALLING");
-	SQAITown.DefSQConst(engine, AITown::TOWN_RATING_VERY_POOR,        "TOWN_RATING_VERY_POOR");
-	SQAITown.DefSQConst(engine, AITown::TOWN_RATING_POOR,             "TOWN_RATING_POOR");
-	SQAITown.DefSQConst(engine, AITown::TOWN_RATING_MEDIOCRE,         "TOWN_RATING_MEDIOCRE");
-	SQAITown.DefSQConst(engine, AITown::TOWN_RATING_GOOD,             "TOWN_RATING_GOOD");
-	SQAITown.DefSQConst(engine, AITown::TOWN_RATING_VERY_GOOD,        "TOWN_RATING_VERY_GOOD");
-	SQAITown.DefSQConst(engine, AITown::TOWN_RATING_EXCELLENT,        "TOWN_RATING_EXCELLENT");
-	SQAITown.DefSQConst(engine, AITown::TOWN_RATING_OUTSTANDING,      "TOWN_RATING_OUTSTANDING");
-	SQAITown.DefSQConst(engine, AITown::TOWN_RATING_INVALID,          "TOWN_RATING_INVALID");
-	SQAITown.DefSQConst(engine, AITown::ROAD_LAYOUT_ORIGINAL,         "ROAD_LAYOUT_ORIGINAL");
-	SQAITown.DefSQConst(engine, AITown::ROAD_LAYOUT_BETTER_ROADS,     "ROAD_LAYOUT_BETTER_ROADS");
-	SQAITown.DefSQConst(engine, AITown::ROAD_LAYOUT_2x2,              "ROAD_LAYOUT_2x2");
-	SQAITown.DefSQConst(engine, AITown::ROAD_LAYOUT_3x3,              "ROAD_LAYOUT_3x3");
-	SQAITown.DefSQConst(engine, AITown::ROAD_LAYOUT_INVALID,          "ROAD_LAYOUT_INVALID");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_ACTION_ADVERTISE_SMALL,  "TOWN_ACTION_ADVERTISE_SMALL");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_ACTION_ADVERTISE_MEDIUM, "TOWN_ACTION_ADVERTISE_MEDIUM");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_ACTION_ADVERTISE_LARGE,  "TOWN_ACTION_ADVERTISE_LARGE");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_ACTION_ROAD_REBUILD,     "TOWN_ACTION_ROAD_REBUILD");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_ACTION_BUILD_STATUE,     "TOWN_ACTION_BUILD_STATUE");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_ACTION_FUND_BUILDINGS,   "TOWN_ACTION_FUND_BUILDINGS");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_ACTION_BUY_RIGHTS,       "TOWN_ACTION_BUY_RIGHTS");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_ACTION_BRIBE,            "TOWN_ACTION_BRIBE");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_RATING_NONE,             "TOWN_RATING_NONE");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_RATING_APPALLING,        "TOWN_RATING_APPALLING");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_RATING_VERY_POOR,        "TOWN_RATING_VERY_POOR");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_RATING_POOR,             "TOWN_RATING_POOR");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_RATING_MEDIOCRE,         "TOWN_RATING_MEDIOCRE");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_RATING_GOOD,             "TOWN_RATING_GOOD");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_RATING_VERY_GOOD,        "TOWN_RATING_VERY_GOOD");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_RATING_EXCELLENT,        "TOWN_RATING_EXCELLENT");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_RATING_OUTSTANDING,      "TOWN_RATING_OUTSTANDING");
+	SQAITown.DefSQConst(engine, ScriptTown::TOWN_RATING_INVALID,          "TOWN_RATING_INVALID");
+	SQAITown.DefSQConst(engine, ScriptTown::ROAD_LAYOUT_ORIGINAL,         "ROAD_LAYOUT_ORIGINAL");
+	SQAITown.DefSQConst(engine, ScriptTown::ROAD_LAYOUT_BETTER_ROADS,     "ROAD_LAYOUT_BETTER_ROADS");
+	SQAITown.DefSQConst(engine, ScriptTown::ROAD_LAYOUT_2x2,              "ROAD_LAYOUT_2x2");
+	SQAITown.DefSQConst(engine, ScriptTown::ROAD_LAYOUT_3x3,              "ROAD_LAYOUT_3x3");
+	SQAITown.DefSQConst(engine, ScriptTown::ROAD_LAYOUT_INVALID,          "ROAD_LAYOUT_INVALID");
 
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetTownCount,                      "GetTownCount",                      1, ".");
-	SQAITown.DefSQStaticMethod(engine, &AITown::IsValidTown,                       "IsValidTown",                       2, ".i");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetName,                           "GetName",                           2, ".i");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetPopulation,                     "GetPopulation",                     2, ".i");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetHouseCount,                     "GetHouseCount",                     2, ".i");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetLocation,                       "GetLocation",                       2, ".i");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetLastMonthProduction,            "GetLastMonthProduction",            3, ".ii");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetLastMonthSupplied,              "GetLastMonthSupplied",              3, ".ii");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetLastMonthTransportedPercentage, "GetLastMonthTransportedPercentage", 3, ".ii");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetLastMonthReceived,              "GetLastMonthReceived",              3, ".ii");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetCargoGoal,                      "GetCargoGoal",                      3, ".ii");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetGrowthRate,                     "GetGrowthRate",                     2, ".i");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetDistanceManhattanToTile,        "GetDistanceManhattanToTile",        3, ".ii");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetDistanceSquareToTile,           "GetDistanceSquareToTile",           3, ".ii");
-	SQAITown.DefSQStaticMethod(engine, &AITown::IsWithinTownInfluence,             "IsWithinTownInfluence",             3, ".ii");
-	SQAITown.DefSQStaticMethod(engine, &AITown::HasStatue,                         "HasStatue",                         2, ".i");
-	SQAITown.DefSQStaticMethod(engine, &AITown::IsCity,                            "IsCity",                            2, ".i");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetRoadReworkDuration,             "GetRoadReworkDuration",             2, ".i");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetExclusiveRightsCompany,         "GetExclusiveRightsCompany",         2, ".i");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetExclusiveRightsDuration,        "GetExclusiveRightsDuration",        2, ".i");
-	SQAITown.DefSQStaticMethod(engine, &AITown::IsActionAvailable,                 "IsActionAvailable",                 3, ".ii");
-	SQAITown.DefSQStaticMethod(engine, &AITown::PerformTownAction,                 "PerformTownAction",                 3, ".ii");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetRating,                         "GetRating",                         3, ".ii");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetAllowedNoise,                   "GetAllowedNoise",                   2, ".i");
-	SQAITown.DefSQStaticMethod(engine, &AITown::GetRoadLayout,                     "GetRoadLayout",                     2, ".i");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetTownCount,                      "GetTownCount",                      1, ".");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::IsValidTown,                       "IsValidTown",                       2, ".i");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetName,                           "GetName",                           2, ".i");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetPopulation,                     "GetPopulation",                     2, ".i");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetHouseCount,                     "GetHouseCount",                     2, ".i");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetLocation,                       "GetLocation",                       2, ".i");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetLastMonthProduction,            "GetLastMonthProduction",            3, ".ii");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetLastMonthSupplied,              "GetLastMonthSupplied",              3, ".ii");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetLastMonthTransportedPercentage, "GetLastMonthTransportedPercentage", 3, ".ii");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetLastMonthReceived,              "GetLastMonthReceived",              3, ".ii");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetCargoGoal,                      "GetCargoGoal",                      3, ".ii");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetGrowthRate,                     "GetGrowthRate",                     2, ".i");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetDistanceManhattanToTile,        "GetDistanceManhattanToTile",        3, ".ii");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetDistanceSquareToTile,           "GetDistanceSquareToTile",           3, ".ii");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::IsWithinTownInfluence,             "IsWithinTownInfluence",             3, ".ii");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::HasStatue,                         "HasStatue",                         2, ".i");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::IsCity,                            "IsCity",                            2, ".i");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetRoadReworkDuration,             "GetRoadReworkDuration",             2, ".i");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetExclusiveRightsCompany,         "GetExclusiveRightsCompany",         2, ".i");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetExclusiveRightsDuration,        "GetExclusiveRightsDuration",        2, ".i");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::IsActionAvailable,                 "IsActionAvailable",                 3, ".ii");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::PerformTownAction,                 "PerformTownAction",                 3, ".ii");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetRating,                         "GetRating",                         3, ".ii");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetAllowedNoise,                   "GetAllowedNoise",                   2, ".i");
+	SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetRoadLayout,                     "GetRoadLayout",                     2, ".i");
 
 	SQAITown.PostRegister(engine);
 }
--- a/src/ai/api/ai_townlist.hpp.sq
+++ b/src/ai/api/ai_townlist.hpp.sq
@@ -12,41 +12,41 @@
 #include "../../script/api/script_townlist.hpp"
 
 namespace SQConvert {
-	/* Allow AITownList to be used as Squirrel parameter */
-	template <> inline AITownList *GetParam(ForceType<AITownList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITownList *)instance; }
-	template <> inline AITownList &GetParam(ForceType<AITownList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITownList *)instance; }
-	template <> inline const AITownList *GetParam(ForceType<const AITownList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITownList *)instance; }
-	template <> inline const AITownList &GetParam(ForceType<const AITownList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITownList *)instance; }
-	template <> inline int Return<AITownList *>(HSQUIRRELVM vm, AITownList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TownList", res, NULL, DefSQDestructorCallback<AITownList>, true); return 1; }
+	/* Allow ScriptTownList to be used as Squirrel parameter */
+	template <> inline ScriptTownList *GetParam(ForceType<ScriptTownList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTownList *)instance; }
+	template <> inline ScriptTownList &GetParam(ForceType<ScriptTownList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTownList *)instance; }
+	template <> inline const ScriptTownList *GetParam(ForceType<const ScriptTownList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTownList *)instance; }
+	template <> inline const ScriptTownList &GetParam(ForceType<const ScriptTownList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTownList *)instance; }
+	template <> inline int Return<ScriptTownList *>(HSQUIRRELVM vm, ScriptTownList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TownList", res, NULL, DefSQDestructorCallback<ScriptTownList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AITownList, ST_AI>() { return "AITownList"; }
+template <> const char *GetClassName<ScriptTownList, ST_AI>() { return "AITownList"; }
 
 void SQAITownList_Register(Squirrel *engine)
 {
-	DefSQClass<AITownList, ST_AI> SQAITownList("AITownList");
+	DefSQClass<ScriptTownList, ST_AI> SQAITownList("AITownList");
 	SQAITownList.PreRegister(engine, "AIList");
-	SQAITownList.AddConstructor<void (AITownList::*)(), 1>(engine, "x");
+	SQAITownList.AddConstructor<void (ScriptTownList::*)(), 1>(engine, "x");
 
 	SQAITownList.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AITownEffectList to be used as Squirrel parameter */
-	template <> inline AITownEffectList *GetParam(ForceType<AITownEffectList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITownEffectList *)instance; }
-	template <> inline AITownEffectList &GetParam(ForceType<AITownEffectList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITownEffectList *)instance; }
-	template <> inline const AITownEffectList *GetParam(ForceType<const AITownEffectList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITownEffectList *)instance; }
-	template <> inline const AITownEffectList &GetParam(ForceType<const AITownEffectList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITownEffectList *)instance; }
-	template <> inline int Return<AITownEffectList *>(HSQUIRRELVM vm, AITownEffectList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TownEffectList", res, NULL, DefSQDestructorCallback<AITownEffectList>, true); return 1; }
+	/* Allow ScriptTownEffectList to be used as Squirrel parameter */
+	template <> inline ScriptTownEffectList *GetParam(ForceType<ScriptTownEffectList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTownEffectList *)instance; }
+	template <> inline ScriptTownEffectList &GetParam(ForceType<ScriptTownEffectList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTownEffectList *)instance; }
+	template <> inline const ScriptTownEffectList *GetParam(ForceType<const ScriptTownEffectList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTownEffectList *)instance; }
+	template <> inline const ScriptTownEffectList &GetParam(ForceType<const ScriptTownEffectList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTownEffectList *)instance; }
+	template <> inline int Return<ScriptTownEffectList *>(HSQUIRRELVM vm, ScriptTownEffectList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TownEffectList", res, NULL, DefSQDestructorCallback<ScriptTownEffectList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AITownEffectList, ST_AI>() { return "AITownEffectList"; }
+template <> const char *GetClassName<ScriptTownEffectList, ST_AI>() { return "AITownEffectList"; }
 
 void SQAITownEffectList_Register(Squirrel *engine)
 {
-	DefSQClass<AITownEffectList, ST_AI> SQAITownEffectList("AITownEffectList");
+	DefSQClass<ScriptTownEffectList, ST_AI> SQAITownEffectList("AITownEffectList");
 	SQAITownEffectList.PreRegister(engine, "AIList");
-	SQAITownEffectList.AddConstructor<void (AITownEffectList::*)(), 1>(engine, "x");
+	SQAITownEffectList.AddConstructor<void (ScriptTownEffectList::*)(), 1>(engine, "x");
 
 	SQAITownEffectList.PostRegister(engine);
 }
--- a/src/ai/api/ai_tunnel.hpp.sq
+++ b/src/ai/api/ai_tunnel.hpp.sq
@@ -13,45 +13,45 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AITunnel::ErrorMessages GetParam(ForceType<AITunnel::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITunnel::ErrorMessages)tmp; }
-	template <> inline int Return<AITunnel::ErrorMessages>(HSQUIRRELVM vm, AITunnel::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptTunnel::ErrorMessages GetParam(ForceType<ScriptTunnel::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTunnel::ErrorMessages)tmp; }
+	template <> inline int Return<ScriptTunnel::ErrorMessages>(HSQUIRRELVM vm, ScriptTunnel::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AITunnel to be used as Squirrel parameter */
-	template <> inline AITunnel *GetParam(ForceType<AITunnel *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITunnel *)instance; }
-	template <> inline AITunnel &GetParam(ForceType<AITunnel &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITunnel *)instance; }
-	template <> inline const AITunnel *GetParam(ForceType<const AITunnel *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITunnel *)instance; }
-	template <> inline const AITunnel &GetParam(ForceType<const AITunnel &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITunnel *)instance; }
-	template <> inline int Return<AITunnel *>(HSQUIRRELVM vm, AITunnel *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Tunnel", res, NULL, DefSQDestructorCallback<AITunnel>, true); return 1; }
+	/* Allow ScriptTunnel to be used as Squirrel parameter */
+	template <> inline ScriptTunnel *GetParam(ForceType<ScriptTunnel *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTunnel *)instance; }
+	template <> inline ScriptTunnel &GetParam(ForceType<ScriptTunnel &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTunnel *)instance; }
+	template <> inline const ScriptTunnel *GetParam(ForceType<const ScriptTunnel *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptTunnel *)instance; }
+	template <> inline const ScriptTunnel &GetParam(ForceType<const ScriptTunnel &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTunnel *)instance; }
+	template <> inline int Return<ScriptTunnel *>(HSQUIRRELVM vm, ScriptTunnel *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Tunnel", res, NULL, DefSQDestructorCallback<ScriptTunnel>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AITunnel, ST_AI>() { return "AITunnel"; }
+template <> const char *GetClassName<ScriptTunnel, ST_AI>() { return "AITunnel"; }
 
 void SQAITunnel_Register(Squirrel *engine)
 {
-	DefSQClass<AITunnel, ST_AI> SQAITunnel("AITunnel");
+	DefSQClass<ScriptTunnel, ST_AI> SQAITunnel("AITunnel");
 	SQAITunnel.PreRegister(engine);
-	SQAITunnel.AddConstructor<void (AITunnel::*)(), 1>(engine, "x");
+	SQAITunnel.AddConstructor<void (ScriptTunnel::*)(), 1>(engine, "x");
 
-	SQAITunnel.DefSQConst(engine, AITunnel::ERR_TUNNEL_BASE,                      "ERR_TUNNEL_BASE");
-	SQAITunnel.DefSQConst(engine, AITunnel::ERR_TUNNEL_CANNOT_BUILD_ON_WATER,     "ERR_TUNNEL_CANNOT_BUILD_ON_WATER");
-	SQAITunnel.DefSQConst(engine, AITunnel::ERR_TUNNEL_START_SITE_UNSUITABLE,     "ERR_TUNNEL_START_SITE_UNSUITABLE");
-	SQAITunnel.DefSQConst(engine, AITunnel::ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY, "ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY");
-	SQAITunnel.DefSQConst(engine, AITunnel::ERR_TUNNEL_END_SITE_UNSUITABLE,       "ERR_TUNNEL_END_SITE_UNSUITABLE");
+	SQAITunnel.DefSQConst(engine, ScriptTunnel::ERR_TUNNEL_BASE,                      "ERR_TUNNEL_BASE");
+	SQAITunnel.DefSQConst(engine, ScriptTunnel::ERR_TUNNEL_CANNOT_BUILD_ON_WATER,     "ERR_TUNNEL_CANNOT_BUILD_ON_WATER");
+	SQAITunnel.DefSQConst(engine, ScriptTunnel::ERR_TUNNEL_START_SITE_UNSUITABLE,     "ERR_TUNNEL_START_SITE_UNSUITABLE");
+	SQAITunnel.DefSQConst(engine, ScriptTunnel::ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY, "ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY");
+	SQAITunnel.DefSQConst(engine, ScriptTunnel::ERR_TUNNEL_END_SITE_UNSUITABLE,       "ERR_TUNNEL_END_SITE_UNSUITABLE");
 
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_BUILD_ON_WATER,       AITunnel::ERR_TUNNEL_CANNOT_BUILD_ON_WATER);
-	AIError::RegisterErrorMap(STR_ERROR_SITE_UNSUITABLE_FOR_TUNNEL, AITunnel::ERR_TUNNEL_START_SITE_UNSUITABLE);
-	AIError::RegisterErrorMap(STR_ERROR_ANOTHER_TUNNEL_IN_THE_WAY,  AITunnel::ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY);
-	AIError::RegisterErrorMap(STR_ERROR_UNABLE_TO_EXCAVATE_LAND,    AITunnel::ERR_TUNNEL_END_SITE_UNSUITABLE);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_BUILD_ON_WATER,       ScriptTunnel::ERR_TUNNEL_CANNOT_BUILD_ON_WATER);
+	ScriptError::RegisterErrorMap(STR_ERROR_SITE_UNSUITABLE_FOR_TUNNEL, ScriptTunnel::ERR_TUNNEL_START_SITE_UNSUITABLE);
+	ScriptError::RegisterErrorMap(STR_ERROR_ANOTHER_TUNNEL_IN_THE_WAY,  ScriptTunnel::ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY);
+	ScriptError::RegisterErrorMap(STR_ERROR_UNABLE_TO_EXCAVATE_LAND,    ScriptTunnel::ERR_TUNNEL_END_SITE_UNSUITABLE);
 
-	AIError::RegisterErrorMapString(AITunnel::ERR_TUNNEL_CANNOT_BUILD_ON_WATER,     "ERR_TUNNEL_CANNOT_BUILD_ON_WATER");
-	AIError::RegisterErrorMapString(AITunnel::ERR_TUNNEL_START_SITE_UNSUITABLE,     "ERR_TUNNEL_START_SITE_UNSUITABLE");
-	AIError::RegisterErrorMapString(AITunnel::ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY, "ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY");
-	AIError::RegisterErrorMapString(AITunnel::ERR_TUNNEL_END_SITE_UNSUITABLE,       "ERR_TUNNEL_END_SITE_UNSUITABLE");
+	ScriptError::RegisterErrorMapString(ScriptTunnel::ERR_TUNNEL_CANNOT_BUILD_ON_WATER,     "ERR_TUNNEL_CANNOT_BUILD_ON_WATER");
+	ScriptError::RegisterErrorMapString(ScriptTunnel::ERR_TUNNEL_START_SITE_UNSUITABLE,     "ERR_TUNNEL_START_SITE_UNSUITABLE");
+	ScriptError::RegisterErrorMapString(ScriptTunnel::ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY, "ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY");
+	ScriptError::RegisterErrorMapString(ScriptTunnel::ERR_TUNNEL_END_SITE_UNSUITABLE,       "ERR_TUNNEL_END_SITE_UNSUITABLE");
 
-	SQAITunnel.DefSQStaticMethod(engine, &AITunnel::IsTunnelTile,      "IsTunnelTile",      2, ".i");
-	SQAITunnel.DefSQStaticMethod(engine, &AITunnel::GetOtherTunnelEnd, "GetOtherTunnelEnd", 2, ".i");
-	SQAITunnel.DefSQStaticMethod(engine, &AITunnel::BuildTunnel,       "BuildTunnel",       3, ".ii");
-	SQAITunnel.DefSQStaticMethod(engine, &AITunnel::RemoveTunnel,      "RemoveTunnel",      2, ".i");
+	SQAITunnel.DefSQStaticMethod(engine, &ScriptTunnel::IsTunnelTile,      "IsTunnelTile",      2, ".i");
+	SQAITunnel.DefSQStaticMethod(engine, &ScriptTunnel::GetOtherTunnelEnd, "GetOtherTunnelEnd", 2, ".i");
+	SQAITunnel.DefSQStaticMethod(engine, &ScriptTunnel::BuildTunnel,       "BuildTunnel",       3, ".ii");
+	SQAITunnel.DefSQStaticMethod(engine, &ScriptTunnel::RemoveTunnel,      "RemoveTunnel",      2, ".i");
 
 	SQAITunnel.PostRegister(engine);
 }
--- a/src/ai/api/ai_vehicle.hpp.sq
+++ b/src/ai/api/ai_vehicle.hpp.sq
@@ -13,149 +13,149 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIVehicle::ErrorMessages GetParam(ForceType<AIVehicle::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIVehicle::ErrorMessages)tmp; }
-	template <> inline int Return<AIVehicle::ErrorMessages>(HSQUIRRELVM vm, AIVehicle::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIVehicle::VehicleType GetParam(ForceType<AIVehicle::VehicleType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIVehicle::VehicleType)tmp; }
-	template <> inline int Return<AIVehicle::VehicleType>(HSQUIRRELVM vm, AIVehicle::VehicleType res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIVehicle::VehicleState GetParam(ForceType<AIVehicle::VehicleState>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIVehicle::VehicleState)tmp; }
-	template <> inline int Return<AIVehicle::VehicleState>(HSQUIRRELVM vm, AIVehicle::VehicleState res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptVehicle::ErrorMessages GetParam(ForceType<ScriptVehicle::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptVehicle::ErrorMessages)tmp; }
+	template <> inline int Return<ScriptVehicle::ErrorMessages>(HSQUIRRELVM vm, ScriptVehicle::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptVehicle::VehicleType GetParam(ForceType<ScriptVehicle::VehicleType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptVehicle::VehicleType)tmp; }
+	template <> inline int Return<ScriptVehicle::VehicleType>(HSQUIRRELVM vm, ScriptVehicle::VehicleType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptVehicle::VehicleState GetParam(ForceType<ScriptVehicle::VehicleState>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptVehicle::VehicleState)tmp; }
+	template <> inline int Return<ScriptVehicle::VehicleState>(HSQUIRRELVM vm, ScriptVehicle::VehicleState res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIVehicle to be used as Squirrel parameter */
-	template <> inline AIVehicle *GetParam(ForceType<AIVehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicle *)instance; }
-	template <> inline AIVehicle &GetParam(ForceType<AIVehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicle *)instance; }
-	template <> inline const AIVehicle *GetParam(ForceType<const AIVehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicle *)instance; }
-	template <> inline const AIVehicle &GetParam(ForceType<const AIVehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicle *)instance; }
-	template <> inline int Return<AIVehicle *>(HSQUIRRELVM vm, AIVehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Vehicle", res, NULL, DefSQDestructorCallback<AIVehicle>, true); return 1; }
+	/* Allow ScriptVehicle to be used as Squirrel parameter */
+	template <> inline ScriptVehicle *GetParam(ForceType<ScriptVehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicle *)instance; }
+	template <> inline ScriptVehicle &GetParam(ForceType<ScriptVehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicle *)instance; }
+	template <> inline const ScriptVehicle *GetParam(ForceType<const ScriptVehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicle *)instance; }
+	template <> inline const ScriptVehicle &GetParam(ForceType<const ScriptVehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicle *)instance; }
+	template <> inline int Return<ScriptVehicle *>(HSQUIRRELVM vm, ScriptVehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Vehicle", res, NULL, DefSQDestructorCallback<ScriptVehicle>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIVehicle, ST_AI>() { return "AIVehicle"; }
+template <> const char *GetClassName<ScriptVehicle, ST_AI>() { return "AIVehicle"; }
 
 void SQAIVehicle_Register(Squirrel *engine)
 {
-	DefSQClass<AIVehicle, ST_AI> SQAIVehicle("AIVehicle");
+	DefSQClass<ScriptVehicle, ST_AI> SQAIVehicle("AIVehicle");
 	SQAIVehicle.PreRegister(engine);
-	SQAIVehicle.AddConstructor<void (AIVehicle::*)(), 1>(engine, "x");
+	SQAIVehicle.AddConstructor<void (ScriptVehicle::*)(), 1>(engine, "x");
 
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_BASE,                 "ERR_VEHICLE_BASE");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_TOO_MANY,             "ERR_VEHICLE_TOO_MANY");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_NOT_AVAILABLE,        "ERR_VEHICLE_NOT_AVAILABLE");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_BUILD_DISABLED,       "ERR_VEHICLE_BUILD_DISABLED");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_WRONG_DEPOT,          "ERR_VEHICLE_WRONG_DEPOT");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT, "ERR_VEHICLE_CANNOT_SEND_TO_DEPOT");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_CANNOT_START_STOP,    "ERR_VEHICLE_CANNOT_START_STOP");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_CANNOT_TURN,          "ERR_VEHICLE_CANNOT_TURN");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_CANNOT_REFIT,         "ERR_VEHICLE_CANNOT_REFIT");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_IS_DESTROYED,         "ERR_VEHICLE_IS_DESTROYED");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT,         "ERR_VEHICLE_NOT_IN_DEPOT");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_IN_FLIGHT,            "ERR_VEHICLE_IN_FLIGHT");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_NO_POWER,             "ERR_VEHICLE_NO_POWER");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_TOO_LONG,             "ERR_VEHICLE_TOO_LONG");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VT_RAIL,                          "VT_RAIL");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VT_ROAD,                          "VT_ROAD");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VT_WATER,                         "VT_WATER");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VT_AIR,                           "VT_AIR");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VT_INVALID,                       "VT_INVALID");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_RUNNING,                       "VS_RUNNING");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_STOPPED,                       "VS_STOPPED");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_IN_DEPOT,                      "VS_IN_DEPOT");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_AT_STATION,                    "VS_AT_STATION");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_BROKEN,                        "VS_BROKEN");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_CRASHED,                       "VS_CRASHED");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_INVALID,                       "VS_INVALID");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_BASE,                 "ERR_VEHICLE_BASE");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_TOO_MANY,             "ERR_VEHICLE_TOO_MANY");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_NOT_AVAILABLE,        "ERR_VEHICLE_NOT_AVAILABLE");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED,       "ERR_VEHICLE_BUILD_DISABLED");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_WRONG_DEPOT,          "ERR_VEHICLE_WRONG_DEPOT");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT, "ERR_VEHICLE_CANNOT_SEND_TO_DEPOT");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP,    "ERR_VEHICLE_CANNOT_START_STOP");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_CANNOT_TURN,          "ERR_VEHICLE_CANNOT_TURN");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT,         "ERR_VEHICLE_CANNOT_REFIT");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_IS_DESTROYED,         "ERR_VEHICLE_IS_DESTROYED");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT,         "ERR_VEHICLE_NOT_IN_DEPOT");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_IN_FLIGHT,            "ERR_VEHICLE_IN_FLIGHT");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_NO_POWER,             "ERR_VEHICLE_NO_POWER");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_TOO_LONG,             "ERR_VEHICLE_TOO_LONG");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::VT_RAIL,                          "VT_RAIL");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::VT_ROAD,                          "VT_ROAD");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::VT_WATER,                         "VT_WATER");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::VT_AIR,                           "VT_AIR");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::VT_INVALID,                       "VT_INVALID");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::VS_RUNNING,                       "VS_RUNNING");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::VS_STOPPED,                       "VS_STOPPED");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::VS_IN_DEPOT,                      "VS_IN_DEPOT");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::VS_AT_STATION,                    "VS_AT_STATION");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::VS_BROKEN,                        "VS_BROKEN");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::VS_CRASHED,                       "VS_CRASHED");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::VS_INVALID,                       "VS_INVALID");
 
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VEHICLE_INVALID, "VEHICLE_INVALID");
+	SQAIVehicle.DefSQConst(engine, ScriptVehicle::VEHICLE_INVALID, "VEHICLE_INVALID");
 
-	AIError::RegisterErrorMap(STR_ERROR_TOO_MANY_VEHICLES_IN_GAME,                           AIVehicle::ERR_VEHICLE_TOO_MANY);
-	AIError::RegisterErrorMap(STR_ERROR_AIRCRAFT_NOT_AVAILABLE,                              AIVehicle::ERR_VEHICLE_NOT_AVAILABLE);
-	AIError::RegisterErrorMap(STR_ERROR_ROAD_VEHICLE_NOT_AVAILABLE,                          AIVehicle::ERR_VEHICLE_NOT_AVAILABLE);
-	AIError::RegisterErrorMap(STR_ERROR_SHIP_NOT_AVAILABLE,                                  AIVehicle::ERR_VEHICLE_NOT_AVAILABLE);
-	AIError::RegisterErrorMap(STR_ERROR_RAIL_VEHICLE_NOT_AVAILABLE,                          AIVehicle::ERR_VEHICLE_NOT_AVAILABLE);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_TRAIN,                                     AIVehicle::ERR_VEHICLE_BUILD_DISABLED);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_ROAD_VEHICLE,                              AIVehicle::ERR_VEHICLE_BUILD_DISABLED);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_SHIP,                                      AIVehicle::ERR_VEHICLE_BUILD_DISABLED);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_AIRCRAFT,                                  AIVehicle::ERR_VEHICLE_BUILD_DISABLED);
-	AIError::RegisterErrorMap(STR_ERROR_DEPOT_WRONG_DEPOT_TYPE,                              AIVehicle::ERR_VEHICLE_WRONG_DEPOT);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_TRAIN_TO_DEPOT,                           AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_ROAD_VEHICLE_TO_DEPOT,                    AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_SHIP_TO_DEPOT,                            AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_AIRCRAFT_TO_HANGAR,                       AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_TRAIN,                              AIVehicle::ERR_VEHICLE_CANNOT_START_STOP);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_ROAD_VEHICLE,                       AIVehicle::ERR_VEHICLE_CANNOT_START_STOP);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_SHIP,                               AIVehicle::ERR_VEHICLE_CANNOT_START_STOP);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_AIRCRAFT,                           AIVehicle::ERR_VEHICLE_CANNOT_START_STOP);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_MAKE_ROAD_VEHICLE_TURN,                        AIVehicle::ERR_VEHICLE_CANNOT_TURN);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REVERSE_DIRECTION_TRAIN,                       AIVehicle::ERR_VEHICLE_CANNOT_TURN);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE,                AIVehicle::ERR_VEHICLE_CANNOT_TURN);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE_MULTIPLE_UNITS, AIVehicle::ERR_VEHICLE_CANNOT_TURN);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_TRAIN,                                   AIVehicle::ERR_VEHICLE_CANNOT_REFIT);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_ROAD_VEHICLE,                            AIVehicle::ERR_VEHICLE_CANNOT_REFIT);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_SHIP,                                    AIVehicle::ERR_VEHICLE_CANNOT_REFIT);
-	AIError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_AIRCRAFT,                                AIVehicle::ERR_VEHICLE_CANNOT_REFIT);
-	AIError::RegisterErrorMap(STR_ERROR_VEHICLE_IS_DESTROYED,                                AIVehicle::ERR_VEHICLE_IS_DESTROYED);
-	AIError::RegisterErrorMap(STR_ERROR_AIRCRAFT_MUST_BE_STOPPED_INSIDE_HANGAR,              AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
-	AIError::RegisterErrorMap(STR_ERROR_ROAD_VEHICLE_MUST_BE_STOPPED_INSIDE_DEPOT,           AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
-	AIError::RegisterErrorMap(STR_ERROR_TRAIN_MUST_BE_STOPPED_INSIDE_DEPOT,                  AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
-	AIError::RegisterErrorMap(STR_ERROR_SHIP_MUST_BE_STOPPED_INSIDE_DEPOT,                   AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
-	AIError::RegisterErrorMap(STR_ERROR_AIRCRAFT_IS_IN_FLIGHT,                               AIVehicle::ERR_VEHICLE_IN_FLIGHT);
-	AIError::RegisterErrorMap(STR_ERROR_TRAIN_START_NO_POWER,                                AIVehicle::ERR_VEHICLE_NO_POWER);
-	AIError::RegisterErrorMap(STR_ERROR_TRAIN_TOO_LONG,                                      AIVehicle::ERR_VEHICLE_TOO_LONG);
+	ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_VEHICLES_IN_GAME,                           ScriptVehicle::ERR_VEHICLE_TOO_MANY);
+	ScriptError::RegisterErrorMap(STR_ERROR_AIRCRAFT_NOT_AVAILABLE,                              ScriptVehicle::ERR_VEHICLE_NOT_AVAILABLE);
+	ScriptError::RegisterErrorMap(STR_ERROR_ROAD_VEHICLE_NOT_AVAILABLE,                          ScriptVehicle::ERR_VEHICLE_NOT_AVAILABLE);
+	ScriptError::RegisterErrorMap(STR_ERROR_SHIP_NOT_AVAILABLE,                                  ScriptVehicle::ERR_VEHICLE_NOT_AVAILABLE);
+	ScriptError::RegisterErrorMap(STR_ERROR_RAIL_VEHICLE_NOT_AVAILABLE,                          ScriptVehicle::ERR_VEHICLE_NOT_AVAILABLE);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_TRAIN,                                     ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_ROAD_VEHICLE,                              ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_SHIP,                                      ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_AIRCRAFT,                                  ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED);
+	ScriptError::RegisterErrorMap(STR_ERROR_DEPOT_WRONG_DEPOT_TYPE,                              ScriptVehicle::ERR_VEHICLE_WRONG_DEPOT);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_TRAIN_TO_DEPOT,                           ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_ROAD_VEHICLE_TO_DEPOT,                    ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_SHIP_TO_DEPOT,                            ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_AIRCRAFT_TO_HANGAR,                       ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_TRAIN,                              ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_ROAD_VEHICLE,                       ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_SHIP,                               ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_AIRCRAFT,                           ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_MAKE_ROAD_VEHICLE_TURN,                        ScriptVehicle::ERR_VEHICLE_CANNOT_TURN);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REVERSE_DIRECTION_TRAIN,                       ScriptVehicle::ERR_VEHICLE_CANNOT_TURN);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE,                ScriptVehicle::ERR_VEHICLE_CANNOT_TURN);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE_MULTIPLE_UNITS, ScriptVehicle::ERR_VEHICLE_CANNOT_TURN);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_TRAIN,                                   ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_ROAD_VEHICLE,                            ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_SHIP,                                    ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT);
+	ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_AIRCRAFT,                                ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT);
+	ScriptError::RegisterErrorMap(STR_ERROR_VEHICLE_IS_DESTROYED,                                ScriptVehicle::ERR_VEHICLE_IS_DESTROYED);
+	ScriptError::RegisterErrorMap(STR_ERROR_AIRCRAFT_MUST_BE_STOPPED_INSIDE_HANGAR,              ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
+	ScriptError::RegisterErrorMap(STR_ERROR_ROAD_VEHICLE_MUST_BE_STOPPED_INSIDE_DEPOT,           ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
+	ScriptError::RegisterErrorMap(STR_ERROR_TRAIN_MUST_BE_STOPPED_INSIDE_DEPOT,                  ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
+	ScriptError::RegisterErrorMap(STR_ERROR_SHIP_MUST_BE_STOPPED_INSIDE_DEPOT,                   ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
+	ScriptError::RegisterErrorMap(STR_ERROR_AIRCRAFT_IS_IN_FLIGHT,                               ScriptVehicle::ERR_VEHICLE_IN_FLIGHT);
+	ScriptError::RegisterErrorMap(STR_ERROR_TRAIN_START_NO_POWER,                                ScriptVehicle::ERR_VEHICLE_NO_POWER);
+	ScriptError::RegisterErrorMap(STR_ERROR_TRAIN_TOO_LONG,                                      ScriptVehicle::ERR_VEHICLE_TOO_LONG);
 
-	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_TOO_MANY,             "ERR_VEHICLE_TOO_MANY");
-	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_NOT_AVAILABLE,        "ERR_VEHICLE_NOT_AVAILABLE");
-	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_BUILD_DISABLED,       "ERR_VEHICLE_BUILD_DISABLED");
-	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_WRONG_DEPOT,          "ERR_VEHICLE_WRONG_DEPOT");
-	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT, "ERR_VEHICLE_CANNOT_SEND_TO_DEPOT");
-	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_CANNOT_START_STOP,    "ERR_VEHICLE_CANNOT_START_STOP");
-	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_CANNOT_TURN,          "ERR_VEHICLE_CANNOT_TURN");
-	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_CANNOT_REFIT,         "ERR_VEHICLE_CANNOT_REFIT");
-	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_IS_DESTROYED,         "ERR_VEHICLE_IS_DESTROYED");
-	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT,         "ERR_VEHICLE_NOT_IN_DEPOT");
-	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_IN_FLIGHT,            "ERR_VEHICLE_IN_FLIGHT");
-	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_NO_POWER,             "ERR_VEHICLE_NO_POWER");
-	AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_TOO_LONG,             "ERR_VEHICLE_TOO_LONG");
+	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_TOO_MANY,             "ERR_VEHICLE_TOO_MANY");
+	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_NOT_AVAILABLE,        "ERR_VEHICLE_NOT_AVAILABLE");
+	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED,       "ERR_VEHICLE_BUILD_DISABLED");
+	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_WRONG_DEPOT,          "ERR_VEHICLE_WRONG_DEPOT");
+	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT, "ERR_VEHICLE_CANNOT_SEND_TO_DEPOT");
+	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP,    "ERR_VEHICLE_CANNOT_START_STOP");
+	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_CANNOT_TURN,          "ERR_VEHICLE_CANNOT_TURN");
+	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT,         "ERR_VEHICLE_CANNOT_REFIT");
+	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_IS_DESTROYED,         "ERR_VEHICLE_IS_DESTROYED");
+	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT,         "ERR_VEHICLE_NOT_IN_DEPOT");
+	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_IN_FLIGHT,            "ERR_VEHICLE_IN_FLIGHT");
+	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_NO_POWER,             "ERR_VEHICLE_NO_POWER");
+	ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_TOO_LONG,             "ERR_VEHICLE_TOO_LONG");
 
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsValidVehicle,                 "IsValidVehicle",                 2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetNumWagons,                   "GetNumWagons",                   2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SetName,                        "SetName",                        3, ".i.");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetName,                        "GetName",                        2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetLocation,                    "GetLocation",                    2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetEngineType,                  "GetEngineType",                  2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetWagonEngineType,             "GetWagonEngineType",             3, ".ii");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetUnitNumber,                  "GetUnitNumber",                  2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetAge,                         "GetAge",                         2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetWagonAge,                    "GetWagonAge",                    3, ".ii");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetMaxAge,                      "GetMaxAge",                      2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetAgeLeft,                     "GetAgeLeft",                     2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCurrentSpeed,                "GetCurrentSpeed",                2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetState,                       "GetState",                       2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetRunningCost,                 "GetRunningCost",                 2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetProfitThisYear,              "GetProfitThisYear",              2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetProfitLastYear,              "GetProfitLastYear",              2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCurrentValue,                "GetCurrentValue",                2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetVehicleType,                 "GetVehicleType",                 2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetRoadType,                    "GetRoadType",                    2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsInDepot,                      "IsInDepot",                      2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsStoppedInDepot,               "IsStoppedInDepot",               2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::BuildVehicle,                   "BuildVehicle",                   3, ".ii");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::CloneVehicle,                   "CloneVehicle",                   4, ".iib");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::MoveWagon,                      "MoveWagon",                      5, ".iiii");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::MoveWagonChain,                 "MoveWagonChain",                 5, ".iiii");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetRefitCapacity,               "GetRefitCapacity",               3, ".ii");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::RefitVehicle,                   "RefitVehicle",                   3, ".ii");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellVehicle,                    "SellVehicle",                    2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellWagon,                      "SellWagon",                      3, ".ii");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellWagonChain,                 "SellWagonChain",                 3, ".ii");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SendVehicleToDepot,             "SendVehicleToDepot",             2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SendVehicleToDepotForServicing, "SendVehicleToDepotForServicing", 2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::StartStopVehicle,               "StartStopVehicle",               2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::ReverseVehicle,                 "ReverseVehicle",                 2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCapacity,                    "GetCapacity",                    3, ".ii");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetLength,                      "GetLength",                      2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCargoLoad,                   "GetCargoLoad",                   3, ".ii");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetGroupID,                     "GetGroupID",                     2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsArticulated,                  "IsArticulated",                  2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::HasSharedOrders,                "HasSharedOrders",                2, ".i");
-	SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetReliability,                 "GetReliability",                 2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::IsValidVehicle,                 "IsValidVehicle",                 2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetNumWagons,                   "GetNumWagons",                   2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::SetName,                        "SetName",                        3, ".i.");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetName,                        "GetName",                        2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetLocation,                    "GetLocation",                    2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetEngineType,                  "GetEngineType",                  2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetWagonEngineType,             "GetWagonEngineType",             3, ".ii");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetUnitNumber,                  "GetUnitNumber",                  2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetAge,                         "GetAge",                         2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetWagonAge,                    "GetWagonAge",                    3, ".ii");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetMaxAge,                      "GetMaxAge",                      2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetAgeLeft,                     "GetAgeLeft",                     2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetCurrentSpeed,                "GetCurrentSpeed",                2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetState,                       "GetState",                       2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetRunningCost,                 "GetRunningCost",                 2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetProfitThisYear,              "GetProfitThisYear",              2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetProfitLastYear,              "GetProfitLastYear",              2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetCurrentValue,                "GetCurrentValue",                2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetVehicleType,                 "GetVehicleType",                 2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetRoadType,                    "GetRoadType",                    2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::IsInDepot,                      "IsInDepot",                      2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::IsStoppedInDepot,               "IsStoppedInDepot",               2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::BuildVehicle,                   "BuildVehicle",                   3, ".ii");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::CloneVehicle,                   "CloneVehicle",                   4, ".iib");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::MoveWagon,                      "MoveWagon",                      5, ".iiii");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::MoveWagonChain,                 "MoveWagonChain",                 5, ".iiii");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetRefitCapacity,               "GetRefitCapacity",               3, ".ii");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::RefitVehicle,                   "RefitVehicle",                   3, ".ii");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::SellVehicle,                    "SellVehicle",                    2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::SellWagon,                      "SellWagon",                      3, ".ii");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::SellWagonChain,                 "SellWagonChain",                 3, ".ii");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::SendVehicleToDepot,             "SendVehicleToDepot",             2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::SendVehicleToDepotForServicing, "SendVehicleToDepotForServicing", 2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::StartStopVehicle,               "StartStopVehicle",               2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::ReverseVehicle,                 "ReverseVehicle",                 2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetCapacity,                    "GetCapacity",                    3, ".ii");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetLength,                      "GetLength",                      2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetCargoLoad,                   "GetCargoLoad",                   3, ".ii");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetGroupID,                     "GetGroupID",                     2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::IsArticulated,                  "IsArticulated",                  2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::HasSharedOrders,                "HasSharedOrders",                2, ".i");
+	SQAIVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetReliability,                 "GetReliability",                 2, ".i");
 
 	SQAIVehicle.PostRegister(engine);
 }
--- a/src/ai/api/ai_vehiclelist.hpp.sq
+++ b/src/ai/api/ai_vehiclelist.hpp.sq
@@ -12,121 +12,121 @@
 #include "../../script/api/script_vehiclelist.hpp"
 
 namespace SQConvert {
-	/* Allow AIVehicleList to be used as Squirrel parameter */
-	template <> inline AIVehicleList *GetParam(ForceType<AIVehicleList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicleList *)instance; }
-	template <> inline AIVehicleList &GetParam(ForceType<AIVehicleList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList *)instance; }
-	template <> inline const AIVehicleList *GetParam(ForceType<const AIVehicleList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicleList *)instance; }
-	template <> inline const AIVehicleList &GetParam(ForceType<const AIVehicleList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList *)instance; }
-	template <> inline int Return<AIVehicleList *>(HSQUIRRELVM vm, AIVehicleList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList", res, NULL, DefSQDestructorCallback<AIVehicleList>, true); return 1; }
+	/* Allow ScriptVehicleList to be used as Squirrel parameter */
+	template <> inline ScriptVehicleList *GetParam(ForceType<ScriptVehicleList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicleList *)instance; }
+	template <> inline ScriptVehicleList &GetParam(ForceType<ScriptVehicleList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicleList *)instance; }
+	template <> inline const ScriptVehicleList *GetParam(ForceType<const ScriptVehicleList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicleList *)instance; }
+	template <> inline const ScriptVehicleList &GetParam(ForceType<const ScriptVehicleList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicleList *)instance; }
+	template <> inline int Return<ScriptVehicleList *>(HSQUIRRELVM vm, ScriptVehicleList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList", res, NULL, DefSQDestructorCallback<ScriptVehicleList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIVehicleList, ST_AI>() { return "AIVehicleList"; }
+template <> const char *GetClassName<ScriptVehicleList, ST_AI>() { return "AIVehicleList"; }
 
 void SQAIVehicleList_Register(Squirrel *engine)
 {
-	DefSQClass<AIVehicleList, ST_AI> SQAIVehicleList("AIVehicleList");
+	DefSQClass<ScriptVehicleList, ST_AI> SQAIVehicleList("AIVehicleList");
 	SQAIVehicleList.PreRegister(engine, "AIList");
-	SQAIVehicleList.AddConstructor<void (AIVehicleList::*)(), 1>(engine, "x");
+	SQAIVehicleList.AddConstructor<void (ScriptVehicleList::*)(), 1>(engine, "x");
 
 	SQAIVehicleList.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIVehicleList_Station to be used as Squirrel parameter */
-	template <> inline AIVehicleList_Station *GetParam(ForceType<AIVehicleList_Station *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicleList_Station *)instance; }
-	template <> inline AIVehicleList_Station &GetParam(ForceType<AIVehicleList_Station &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList_Station *)instance; }
-	template <> inline const AIVehicleList_Station *GetParam(ForceType<const AIVehicleList_Station *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicleList_Station *)instance; }
-	template <> inline const AIVehicleList_Station &GetParam(ForceType<const AIVehicleList_Station &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList_Station *)instance; }
-	template <> inline int Return<AIVehicleList_Station *>(HSQUIRRELVM vm, AIVehicleList_Station *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_Station", res, NULL, DefSQDestructorCallback<AIVehicleList_Station>, true); return 1; }
+	/* Allow ScriptVehicleList_Station to be used as Squirrel parameter */
+	template <> inline ScriptVehicleList_Station *GetParam(ForceType<ScriptVehicleList_Station *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicleList_Station *)instance; }
+	template <> inline ScriptVehicleList_Station &GetParam(ForceType<ScriptVehicleList_Station &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicleList_Station *)instance; }
+	template <> inline const ScriptVehicleList_Station *GetParam(ForceType<const ScriptVehicleList_Station *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicleList_Station *)instance; }
+	template <> inline const ScriptVehicleList_Station &GetParam(ForceType<const ScriptVehicleList_Station &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicleList_Station *)instance; }
+	template <> inline int Return<ScriptVehicleList_Station *>(HSQUIRRELVM vm, ScriptVehicleList_Station *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_Station", res, NULL, DefSQDestructorCallback<ScriptVehicleList_Station>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIVehicleList_Station, ST_AI>() { return "AIVehicleList_Station"; }
+template <> const char *GetClassName<ScriptVehicleList_Station, ST_AI>() { return "AIVehicleList_Station"; }
 
 void SQAIVehicleList_Station_Register(Squirrel *engine)
 {
-	DefSQClass<AIVehicleList_Station, ST_AI> SQAIVehicleList_Station("AIVehicleList_Station");
+	DefSQClass<ScriptVehicleList_Station, ST_AI> SQAIVehicleList_Station("AIVehicleList_Station");
 	SQAIVehicleList_Station.PreRegister(engine, "AIList");
-	SQAIVehicleList_Station.AddConstructor<void (AIVehicleList_Station::*)(StationID station_id), 2>(engine, "xi");
+	SQAIVehicleList_Station.AddConstructor<void (ScriptVehicleList_Station::*)(StationID station_id), 2>(engine, "xi");
 
 	SQAIVehicleList_Station.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIVehicleList_Depot to be used as Squirrel parameter */
-	template <> inline AIVehicleList_Depot *GetParam(ForceType<AIVehicleList_Depot *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicleList_Depot *)instance; }
-	template <> inline AIVehicleList_Depot &GetParam(ForceType<AIVehicleList_Depot &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList_Depot *)instance; }
-	template <> inline const AIVehicleList_Depot *GetParam(ForceType<const AIVehicleList_Depot *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicleList_Depot *)instance; }
-	template <> inline const AIVehicleList_Depot &GetParam(ForceType<const AIVehicleList_Depot &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList_Depot *)instance; }
-	template <> inline int Return<AIVehicleList_Depot *>(HSQUIRRELVM vm, AIVehicleList_Depot *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_Depot", res, NULL, DefSQDestructorCallback<AIVehicleList_Depot>, true); return 1; }
+	/* Allow ScriptVehicleList_Depot to be used as Squirrel parameter */
+	template <> inline ScriptVehicleList_Depot *GetParam(ForceType<ScriptVehicleList_Depot *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicleList_Depot *)instance; }
+	template <> inline ScriptVehicleList_Depot &GetParam(ForceType<ScriptVehicleList_Depot &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicleList_Depot *)instance; }
+	template <> inline const ScriptVehicleList_Depot *GetParam(ForceType<const ScriptVehicleList_Depot *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicleList_Depot *)instance; }
+	template <> inline const ScriptVehicleList_Depot &GetParam(ForceType<const ScriptVehicleList_Depot &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicleList_Depot *)instance; }
+	template <> inline int Return<ScriptVehicleList_Depot *>(HSQUIRRELVM vm, ScriptVehicleList_Depot *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_Depot", res, NULL, DefSQDestructorCallback<ScriptVehicleList_Depot>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIVehicleList_Depot, ST_AI>() { return "AIVehicleList_Depot"; }
+template <> const char *GetClassName<ScriptVehicleList_Depot, ST_AI>() { return "AIVehicleList_Depot"; }
 
 void SQAIVehicleList_Depot_Register(Squirrel *engine)
 {
-	DefSQClass<AIVehicleList_Depot, ST_AI> SQAIVehicleList_Depot("AIVehicleList_Depot");
+	DefSQClass<ScriptVehicleList_Depot, ST_AI> SQAIVehicleList_Depot("AIVehicleList_Depot");
 	SQAIVehicleList_Depot.PreRegister(engine, "AIList");
-	SQAIVehicleList_Depot.AddConstructor<void (AIVehicleList_Depot::*)(TileIndex tile), 2>(engine, "xi");
+	SQAIVehicleList_Depot.AddConstructor<void (ScriptVehicleList_Depot::*)(TileIndex tile), 2>(engine, "xi");
 
 	SQAIVehicleList_Depot.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIVehicleList_SharedOrders to be used as Squirrel parameter */
-	template <> inline AIVehicleList_SharedOrders *GetParam(ForceType<AIVehicleList_SharedOrders *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicleList_SharedOrders *)instance; }
-	template <> inline AIVehicleList_SharedOrders &GetParam(ForceType<AIVehicleList_SharedOrders &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList_SharedOrders *)instance; }
-	template <> inline const AIVehicleList_SharedOrders *GetParam(ForceType<const AIVehicleList_SharedOrders *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicleList_SharedOrders *)instance; }
-	template <> inline const AIVehicleList_SharedOrders &GetParam(ForceType<const AIVehicleList_SharedOrders &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList_SharedOrders *)instance; }
-	template <> inline int Return<AIVehicleList_SharedOrders *>(HSQUIRRELVM vm, AIVehicleList_SharedOrders *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_SharedOrders", res, NULL, DefSQDestructorCallback<AIVehicleList_SharedOrders>, true); return 1; }
+	/* Allow ScriptVehicleList_SharedOrders to be used as Squirrel parameter */
+	template <> inline ScriptVehicleList_SharedOrders *GetParam(ForceType<ScriptVehicleList_SharedOrders *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicleList_SharedOrders *)instance; }
+	template <> inline ScriptVehicleList_SharedOrders &GetParam(ForceType<ScriptVehicleList_SharedOrders &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicleList_SharedOrders *)instance; }
+	template <> inline const ScriptVehicleList_SharedOrders *GetParam(ForceType<const ScriptVehicleList_SharedOrders *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicleList_SharedOrders *)instance; }
+	template <> inline const ScriptVehicleList_SharedOrders &GetParam(ForceType<const ScriptVehicleList_SharedOrders &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicleList_SharedOrders *)instance; }
+	template <> inline int Return<ScriptVehicleList_SharedOrders *>(HSQUIRRELVM vm, ScriptVehicleList_SharedOrders *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_SharedOrders", res, NULL, DefSQDestructorCallback<ScriptVehicleList_SharedOrders>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIVehicleList_SharedOrders, ST_AI>() { return "AIVehicleList_SharedOrders"; }
+template <> const char *GetClassName<ScriptVehicleList_SharedOrders, ST_AI>() { return "AIVehicleList_SharedOrders"; }
 
 void SQAIVehicleList_SharedOrders_Register(Squirrel *engine)
 {
-	DefSQClass<AIVehicleList_SharedOrders, ST_AI> SQAIVehicleList_SharedOrders("AIVehicleList_SharedOrders");
+	DefSQClass<ScriptVehicleList_SharedOrders, ST_AI> SQAIVehicleList_SharedOrders("AIVehicleList_SharedOrders");
 	SQAIVehicleList_SharedOrders.PreRegister(engine, "AIList");
-	SQAIVehicleList_SharedOrders.AddConstructor<void (AIVehicleList_SharedOrders::*)(VehicleID vehicle_id), 2>(engine, "xi");
+	SQAIVehicleList_SharedOrders.AddConstructor<void (ScriptVehicleList_SharedOrders::*)(VehicleID vehicle_id), 2>(engine, "xi");
 
 	SQAIVehicleList_SharedOrders.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIVehicleList_Group to be used as Squirrel parameter */
-	template <> inline AIVehicleList_Group *GetParam(ForceType<AIVehicleList_Group *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicleList_Group *)instance; }
-	template <> inline AIVehicleList_Group &GetParam(ForceType<AIVehicleList_Group &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList_Group *)instance; }
-	template <> inline const AIVehicleList_Group *GetParam(ForceType<const AIVehicleList_Group *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicleList_Group *)instance; }
-	template <> inline const AIVehicleList_Group &GetParam(ForceType<const AIVehicleList_Group &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList_Group *)instance; }
-	template <> inline int Return<AIVehicleList_Group *>(HSQUIRRELVM vm, AIVehicleList_Group *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_Group", res, NULL, DefSQDestructorCallback<AIVehicleList_Group>, true); return 1; }
+	/* Allow ScriptVehicleList_Group to be used as Squirrel parameter */
+	template <> inline ScriptVehicleList_Group *GetParam(ForceType<ScriptVehicleList_Group *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicleList_Group *)instance; }
+	template <> inline ScriptVehicleList_Group &GetParam(ForceType<ScriptVehicleList_Group &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicleList_Group *)instance; }
+	template <> inline const ScriptVehicleList_Group *GetParam(ForceType<const ScriptVehicleList_Group *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicleList_Group *)instance; }
+	template <> inline const ScriptVehicleList_Group &GetParam(ForceType<const ScriptVehicleList_Group &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicleList_Group *)instance; }
+	template <> inline int Return<ScriptVehicleList_Group *>(HSQUIRRELVM vm, ScriptVehicleList_Group *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_Group", res, NULL, DefSQDestructorCallback<ScriptVehicleList_Group>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIVehicleList_Group, ST_AI>() { return "AIVehicleList_Group"; }
+template <> const char *GetClassName<ScriptVehicleList_Group, ST_AI>() { return "AIVehicleList_Group"; }
 
 void SQAIVehicleList_Group_Register(Squirrel *engine)
 {
-	DefSQClass<AIVehicleList_Group, ST_AI> SQAIVehicleList_Group("AIVehicleList_Group");
+	DefSQClass<ScriptVehicleList_Group, ST_AI> SQAIVehicleList_Group("AIVehicleList_Group");
 	SQAIVehicleList_Group.PreRegister(engine, "AIList");
-	SQAIVehicleList_Group.AddConstructor<void (AIVehicleList_Group::*)(GroupID group_id), 2>(engine, "xi");
+	SQAIVehicleList_Group.AddConstructor<void (ScriptVehicleList_Group::*)(GroupID group_id), 2>(engine, "xi");
 
 	SQAIVehicleList_Group.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIVehicleList_DefaultGroup to be used as Squirrel parameter */
-	template <> inline AIVehicleList_DefaultGroup *GetParam(ForceType<AIVehicleList_DefaultGroup *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicleList_DefaultGroup *)instance; }
-	template <> inline AIVehicleList_DefaultGroup &GetParam(ForceType<AIVehicleList_DefaultGroup &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList_DefaultGroup *)instance; }
-	template <> inline const AIVehicleList_DefaultGroup *GetParam(ForceType<const AIVehicleList_DefaultGroup *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIVehicleList_DefaultGroup *)instance; }
-	template <> inline const AIVehicleList_DefaultGroup &GetParam(ForceType<const AIVehicleList_DefaultGroup &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIVehicleList_DefaultGroup *)instance; }
-	template <> inline int Return<AIVehicleList_DefaultGroup *>(HSQUIRRELVM vm, AIVehicleList_DefaultGroup *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_DefaultGroup", res, NULL, DefSQDestructorCallback<AIVehicleList_DefaultGroup>, true); return 1; }
+	/* Allow ScriptVehicleList_DefaultGroup to be used as Squirrel parameter */
+	template <> inline ScriptVehicleList_DefaultGroup *GetParam(ForceType<ScriptVehicleList_DefaultGroup *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicleList_DefaultGroup *)instance; }
+	template <> inline ScriptVehicleList_DefaultGroup &GetParam(ForceType<ScriptVehicleList_DefaultGroup &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicleList_DefaultGroup *)instance; }
+	template <> inline const ScriptVehicleList_DefaultGroup *GetParam(ForceType<const ScriptVehicleList_DefaultGroup *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptVehicleList_DefaultGroup *)instance; }
+	template <> inline const ScriptVehicleList_DefaultGroup &GetParam(ForceType<const ScriptVehicleList_DefaultGroup &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicleList_DefaultGroup *)instance; }
+	template <> inline int Return<ScriptVehicleList_DefaultGroup *>(HSQUIRRELVM vm, ScriptVehicleList_DefaultGroup *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_DefaultGroup", res, NULL, DefSQDestructorCallback<ScriptVehicleList_DefaultGroup>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIVehicleList_DefaultGroup, ST_AI>() { return "AIVehicleList_DefaultGroup"; }
+template <> const char *GetClassName<ScriptVehicleList_DefaultGroup, ST_AI>() { return "AIVehicleList_DefaultGroup"; }
 
 void SQAIVehicleList_DefaultGroup_Register(Squirrel *engine)
 {
-	DefSQClass<AIVehicleList_DefaultGroup, ST_AI> SQAIVehicleList_DefaultGroup("AIVehicleList_DefaultGroup");
+	DefSQClass<ScriptVehicleList_DefaultGroup, ST_AI> SQAIVehicleList_DefaultGroup("AIVehicleList_DefaultGroup");
 	SQAIVehicleList_DefaultGroup.PreRegister(engine, "AIList");
-	SQAIVehicleList_DefaultGroup.AddConstructor<void (AIVehicleList_DefaultGroup::*)(AIVehicle::VehicleType vehicle_type), 2>(engine, "xi");
+	SQAIVehicleList_DefaultGroup.AddConstructor<void (ScriptVehicleList_DefaultGroup::*)(ScriptVehicle::VehicleType vehicle_type), 2>(engine, "xi");
 
 	SQAIVehicleList_DefaultGroup.PostRegister(engine);
 }
--- a/src/ai/api/ai_waypoint.hpp.sq
+++ b/src/ai/api/ai_waypoint.hpp.sq
@@ -13,43 +13,43 @@
 
 namespace SQConvert {
 	/* Allow enums to be used as Squirrel parameters */
-	template <> inline AIWaypoint::WaypointType GetParam(ForceType<AIWaypoint::WaypointType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIWaypoint::WaypointType)tmp; }
-	template <> inline int Return<AIWaypoint::WaypointType>(HSQUIRRELVM vm, AIWaypoint::WaypointType res) { sq_pushinteger(vm, (int32)res); return 1; }
-	template <> inline AIWaypoint::ErrorMessages GetParam(ForceType<AIWaypoint::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIWaypoint::ErrorMessages)tmp; }
-	template <> inline int Return<AIWaypoint::ErrorMessages>(HSQUIRRELVM vm, AIWaypoint::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptWaypoint::WaypointType GetParam(ForceType<ScriptWaypoint::WaypointType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWaypoint::WaypointType)tmp; }
+	template <> inline int Return<ScriptWaypoint::WaypointType>(HSQUIRRELVM vm, ScriptWaypoint::WaypointType res) { sq_pushinteger(vm, (int32)res); return 1; }
+	template <> inline ScriptWaypoint::ErrorMessages GetParam(ForceType<ScriptWaypoint::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWaypoint::ErrorMessages)tmp; }
+	template <> inline int Return<ScriptWaypoint::ErrorMessages>(HSQUIRRELVM vm, ScriptWaypoint::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
 
-	/* Allow AIWaypoint to be used as Squirrel parameter */
-	template <> inline AIWaypoint *GetParam(ForceType<AIWaypoint *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIWaypoint *)instance; }
-	template <> inline AIWaypoint &GetParam(ForceType<AIWaypoint &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIWaypoint *)instance; }
-	template <> inline const AIWaypoint *GetParam(ForceType<const AIWaypoint *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIWaypoint *)instance; }
-	template <> inline const AIWaypoint &GetParam(ForceType<const AIWaypoint &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIWaypoint *)instance; }
-	template <> inline int Return<AIWaypoint *>(HSQUIRRELVM vm, AIWaypoint *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Waypoint", res, NULL, DefSQDestructorCallback<AIWaypoint>, true); return 1; }
+	/* Allow ScriptWaypoint to be used as Squirrel parameter */
+	template <> inline ScriptWaypoint *GetParam(ForceType<ScriptWaypoint *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptWaypoint *)instance; }
+	template <> inline ScriptWaypoint &GetParam(ForceType<ScriptWaypoint &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptWaypoint *)instance; }
+	template <> inline const ScriptWaypoint *GetParam(ForceType<const ScriptWaypoint *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptWaypoint *)instance; }
+	template <> inline const ScriptWaypoint &GetParam(ForceType<const ScriptWaypoint &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptWaypoint *)instance; }
+	template <> inline int Return<ScriptWaypoint *>(HSQUIRRELVM vm, ScriptWaypoint *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Waypoint", res, NULL, DefSQDestructorCallback<ScriptWaypoint>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIWaypoint, ST_AI>() { return "AIWaypoint"; }
+template <> const char *GetClassName<ScriptWaypoint, ST_AI>() { return "AIWaypoint"; }
 
 void SQAIWaypoint_Register(Squirrel *engine)
 {
-	DefSQClass<AIWaypoint, ST_AI> SQAIWaypoint("AIWaypoint");
+	DefSQClass<ScriptWaypoint, ST_AI> SQAIWaypoint("AIWaypoint");
 	SQAIWaypoint.PreRegister(engine, "AIBaseStation");
-	SQAIWaypoint.AddConstructor<void (AIWaypoint::*)(), 1>(engine, "x");
+	SQAIWaypoint.AddConstructor<void (ScriptWaypoint::*)(), 1>(engine, "x");
 
-	SQAIWaypoint.DefSQConst(engine, AIWaypoint::WAYPOINT_RAIL,                              "WAYPOINT_RAIL");
-	SQAIWaypoint.DefSQConst(engine, AIWaypoint::WAYPOINT_BUOY,                              "WAYPOINT_BUOY");
-	SQAIWaypoint.DefSQConst(engine, AIWaypoint::WAYPOINT_ANY,                               "WAYPOINT_ANY");
-	SQAIWaypoint.DefSQConst(engine, AIWaypoint::ERR_WAYPOINT_BASE,                          "ERR_WAYPOINT_BASE");
-	SQAIWaypoint.DefSQConst(engine, AIWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, "ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT");
-	SQAIWaypoint.DefSQConst(engine, AIWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS,    "ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS");
+	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_RAIL,                              "WAYPOINT_RAIL");
+	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_BUOY,                              "WAYPOINT_BUOY");
+	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_ANY,                               "WAYPOINT_ANY");
+	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_BASE,                          "ERR_WAYPOINT_BASE");
+	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, "ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT");
+	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS,    "ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS");
 
-	AIError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_WAYPOINT,           AIWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT);
-	AIError::RegisterErrorMap(STR_ERROR_WAYPOINT_ADJOINS_MORE_THAN_ONE_EXISTING, AIWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS);
+	ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_WAYPOINT,           ScriptWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT);
+	ScriptError::RegisterErrorMap(STR_ERROR_WAYPOINT_ADJOINS_MORE_THAN_ONE_EXISTING, ScriptWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS);
 
-	AIError::RegisterErrorMapString(AIWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, "ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT");
-	AIError::RegisterErrorMapString(AIWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS,    "ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS");
+	ScriptError::RegisterErrorMapString(ScriptWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, "ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT");
+	ScriptError::RegisterErrorMapString(ScriptWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS,    "ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS");
 
-	SQAIWaypoint.DefSQStaticMethod(engine, &AIWaypoint::IsValidWaypoint, "IsValidWaypoint", 2, ".i");
-	SQAIWaypoint.DefSQStaticMethod(engine, &AIWaypoint::GetWaypointID,   "GetWaypointID",   2, ".i");
-	SQAIWaypoint.DefSQStaticMethod(engine, &AIWaypoint::HasWaypointType, "HasWaypointType", 3, ".ii");
+	SQAIWaypoint.DefSQStaticMethod(engine, &ScriptWaypoint::IsValidWaypoint, "IsValidWaypoint", 2, ".i");
+	SQAIWaypoint.DefSQStaticMethod(engine, &ScriptWaypoint::GetWaypointID,   "GetWaypointID",   2, ".i");
+	SQAIWaypoint.DefSQStaticMethod(engine, &ScriptWaypoint::HasWaypointType, "HasWaypointType", 3, ".ii");
 
 	SQAIWaypoint.PostRegister(engine);
 }
--- a/src/ai/api/ai_waypointlist.hpp.sq
+++ b/src/ai/api/ai_waypointlist.hpp.sq
@@ -12,41 +12,41 @@
 #include "../../script/api/script_waypointlist.hpp"
 
 namespace SQConvert {
-	/* Allow AIWaypointList to be used as Squirrel parameter */
-	template <> inline AIWaypointList *GetParam(ForceType<AIWaypointList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIWaypointList *)instance; }
-	template <> inline AIWaypointList &GetParam(ForceType<AIWaypointList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIWaypointList *)instance; }
-	template <> inline const AIWaypointList *GetParam(ForceType<const AIWaypointList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIWaypointList *)instance; }
-	template <> inline const AIWaypointList &GetParam(ForceType<const AIWaypointList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIWaypointList *)instance; }
-	template <> inline int Return<AIWaypointList *>(HSQUIRRELVM vm, AIWaypointList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "WaypointList", res, NULL, DefSQDestructorCallback<AIWaypointList>, true); return 1; }
+	/* Allow ScriptWaypointList to be used as Squirrel parameter */
+	template <> inline ScriptWaypointList *GetParam(ForceType<ScriptWaypointList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptWaypointList *)instance; }
+	template <> inline ScriptWaypointList &GetParam(ForceType<ScriptWaypointList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptWaypointList *)instance; }
+	template <> inline const ScriptWaypointList *GetParam(ForceType<const ScriptWaypointList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptWaypointList *)instance; }
+	template <> inline const ScriptWaypointList &GetParam(ForceType<const ScriptWaypointList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptWaypointList *)instance; }
+	template <> inline int Return<ScriptWaypointList *>(HSQUIRRELVM vm, ScriptWaypointList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "WaypointList", res, NULL, DefSQDestructorCallback<ScriptWaypointList>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIWaypointList, ST_AI>() { return "AIWaypointList"; }
+template <> const char *GetClassName<ScriptWaypointList, ST_AI>() { return "AIWaypointList"; }
 
 void SQAIWaypointList_Register(Squirrel *engine)
 {
-	DefSQClass<AIWaypointList, ST_AI> SQAIWaypointList("AIWaypointList");
+	DefSQClass<ScriptWaypointList, ST_AI> SQAIWaypointList("AIWaypointList");
 	SQAIWaypointList.PreRegister(engine, "AIList");
-	SQAIWaypointList.AddConstructor<void (AIWaypointList::*)(AIWaypoint::WaypointType waypoint_type), 2>(engine, "xi");
+	SQAIWaypointList.AddConstructor<void (ScriptWaypointList::*)(ScriptWaypoint::WaypointType waypoint_type), 2>(engine, "xi");
 
 	SQAIWaypointList.PostRegister(engine);
 }
 
 namespace SQConvert {
-	/* Allow AIWaypointList_Vehicle to be used as Squirrel parameter */
-	template <> inline AIWaypointList_Vehicle *GetParam(ForceType<AIWaypointList_Vehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIWaypointList_Vehicle *)instance; }
-	template <> inline AIWaypointList_Vehicle &GetParam(ForceType<AIWaypointList_Vehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIWaypointList_Vehicle *)instance; }
-	template <> inline const AIWaypointList_Vehicle *GetParam(ForceType<const AIWaypointList_Vehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIWaypointList_Vehicle *)instance; }
-	template <> inline const AIWaypointList_Vehicle &GetParam(ForceType<const AIWaypointList_Vehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIWaypointList_Vehicle *)instance; }
-	template <> inline int Return<AIWaypointList_Vehicle *>(HSQUIRRELVM vm, AIWaypointList_Vehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "WaypointList_Vehicle", res, NULL, DefSQDestructorCallback<AIWaypointList_Vehicle>, true); return 1; }
+	/* Allow ScriptWaypointList_Vehicle to be used as Squirrel parameter */
+	template <> inline ScriptWaypointList_Vehicle *GetParam(ForceType<ScriptWaypointList_Vehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptWaypointList_Vehicle *)instance; }
+	template <> inline ScriptWaypointList_Vehicle &GetParam(ForceType<ScriptWaypointList_Vehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptWaypointList_Vehicle *)instance; }
+	template <> inline const ScriptWaypointList_Vehicle *GetParam(ForceType<const ScriptWaypointList_Vehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptWaypointList_Vehicle *)instance; }
+	template <> inline const ScriptWaypointList_Vehicle &GetParam(ForceType<const ScriptWaypointList_Vehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptWaypointList_Vehicle *)instance; }
+	template <> inline int Return<ScriptWaypointList_Vehicle *>(HSQUIRRELVM vm, ScriptWaypointList_Vehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "WaypointList_Vehicle", res, NULL, DefSQDestructorCallback<ScriptWaypointList_Vehicle>, true); return 1; }
 } // namespace SQConvert
 
-template <> const char *GetClassName<AIWaypointList_Vehicle, ST_AI>() { return "AIWaypointList_Vehicle"; }
+template <> const char *GetClassName<ScriptWaypointList_Vehicle, ST_AI>() { return "AIWaypointList_Vehicle"; }
 
 void SQAIWaypointList_Vehicle_Register(Squirrel *engine)
 {
-	DefSQClass<AIWaypointList_Vehicle, ST_AI> SQAIWaypointList_Vehicle("AIWaypointList_Vehicle");
+	DefSQClass<ScriptWaypointList_Vehicle, ST_AI> SQAIWaypointList_Vehicle("AIWaypointList_Vehicle");
 	SQAIWaypointList_Vehicle.PreRegister(engine, "AIList");
-	SQAIWaypointList_Vehicle.AddConstructor<void (AIWaypointList_Vehicle::*)(VehicleID vehicle_id), 2>(engine, "xi");
+	SQAIWaypointList_Vehicle.AddConstructor<void (ScriptWaypointList_Vehicle::*)(VehicleID vehicle_id), 2>(engine, "xi");
 
 	SQAIWaypointList_Vehicle.PostRegister(engine);
 }
--- a/src/ai/api/squirrel_export.awk
+++ b/src/ai/api/squirrel_export.awk
@@ -27,13 +27,13 @@
 function dump_class_templates(name)
 {
 	realname = name
-	gsub("^AI", "", realname)
+	gsub("^Script", "", realname)
 
 	print "	template <> inline "       name " *GetParam(ForceType<"       name " *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (" name " *)instance; }"
 	print "	template <> inline "       name " &GetParam(ForceType<"       name " &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(" name " *)instance; }"
 	print "	template <> inline const " name " *GetParam(ForceType<const " name " *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (" name " *)instance; }"
 	print "	template <> inline const " name " &GetParam(ForceType<const " name " &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(" name " *)instance; }"
-	if (name == "AIEvent") {
+	if (name == "ScriptEvent") {
 		print "	template <> inline int Return<" name " *>(HSQUIRRELVM vm, " name " *res) { if (res == NULL) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, \"" realname "\", res, NULL, DefSQDestructorCallback<" name ">, true); return 1; }"
 	} else {
 		print "	template <> inline int Return<" name " *>(HSQUIRRELVM vm, " name " *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, \"" realname "\", res, NULL, DefSQDestructorCallback<" name ">, true); return 1; }"
@@ -225,12 +225,12 @@
 	print "void SQ" api_cls "_Register(Squirrel *engine)"
 	print "{"
 	print "	DefSQClass<" cls ", ST_" toupper(api) "> SQ" api_cls "(\"" api_cls "\");"
-	if (super_cls == "AIObject" || super_cls == "AIAbstractList::Valuator") {
+	if (super_cls == "ScriptObject" || super_cls == "AIAbstractList::Valuator") {
 		print "	SQ" api_cls ".PreRegister(engine);"
 	} else {
 		print "	SQ" api_cls ".PreRegister(engine, \"" api_super_cls "\");"
 	}
-	if (virtual_class == "false" && super_cls != "AIEvent") {
+	if (virtual_class == "false" && super_cls != "ScriptEvent") {
 		print "	SQ" api_cls ".AddConstructor<void (" cls "::*)(" cls_param[0] "), " cls_param[1]">(engine, \"" cls_param[2] "\");"
 	}
 	print ""
@@ -263,7 +263,7 @@
 		if (mlen <= length(enum_string_to_error_mapping_string[i])) mlen = length(enum_string_to_error_mapping_string[i])
 	}
 	for (i = 1; i <= enum_string_to_error_size; i++) {
-		print "	AIError::RegisterErrorMap(" enum_string_to_error_mapping_string[i] ", " substr(spaces, 1, mlen - length(enum_string_to_error_mapping_string[i]))  cls "::" enum_string_to_error_mapping_error[i] ");"
+		print "	ScriptError::RegisterErrorMap(" enum_string_to_error_mapping_string[i] ", " substr(spaces, 1, mlen - length(enum_string_to_error_mapping_string[i]))  cls "::" enum_string_to_error_mapping_error[i] ");"
 
 		delete enum_string_to_error_mapping_string[i]
 	}
@@ -275,7 +275,7 @@
 		if (mlen <= length(enum_error_to_string_mapping[i])) mlen = length(enum_error_to_string_mapping[i])
 	}
 	for (i = 1; i <= enum_error_to_string_size; i++) {
-		print "	AIError::RegisterErrorMapString(" cls "::" enum_error_to_string_mapping[i] ", " substr(spaces, 1, mlen - length(enum_error_to_string_mapping[i])) "\"" enum_error_to_string_mapping[i] "\");"
+		print "	ScriptError::RegisterErrorMapString(" cls "::" enum_error_to_string_mapping[i] ", " substr(spaces, 1, mlen - length(enum_error_to_string_mapping[i])) "\"" enum_error_to_string_mapping[i] "\");"
 		delete enum_error_to_string_mapping[i]
 	}
 	if (enum_error_to_string_size != 0) print ""
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -1151,7 +1151,7 @@
 		newsitem = STR_NEWS_AIRCRAFT_CRASH;
 	}
 
-	AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile, st == NULL ? AIEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : AIEventVehicleCrashed::CRASH_PLANE_LANDING));
+	AI::NewEvent(v->owner, new ScriptEventVehicleCrashed(v->index, v->tile, st == NULL ? ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : ScriptEventVehicleCrashed::CRASH_PLANE_LANDING));
 
 	AddVehicleNewsItem(newsitem,
 		NS_ACCIDENT,
@@ -1216,7 +1216,7 @@
 			v->index,
 			st->index
 		);
-		AI::NewEvent(v->owner, new AIEventStationFirstVehicle(st->index, v->index));
+		AI::NewEvent(v->owner, new ScriptEventStationFirstVehicle(st->index, v->index));
 	}
 
 	v->BeginLoading();
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -375,7 +375,7 @@
 			SetDParam(3, t->index);
 			AddNewsItem(STR_MESSAGE_NEWS_FORMAT, NS_COMPANY_NEW, NR_TILE, c->last_build_coordinate, NR_NONE, UINT32_MAX, cni);
 		}
-		AI::BroadcastNewEvent(new AIEventCompanyNew(c->index), c->index);
+		AI::BroadcastNewEvent(new ScriptEventCompanyNew(c->index), c->index);
 		return;
 	}
 bad_town_name:;
@@ -676,7 +676,7 @@
 
 	c->bankrupt_timeout = TAKE_OVER_TIMEOUT;
 	if (best->is_ai) {
-		AI::NewEvent(best->index, new AIEventCompanyAskMerger(c->index, ClampToI32(c->bankrupt_value)));
+		AI::NewEvent(best->index, new ScriptEventCompanyAskMerger(c->index, ClampToI32(c->bankrupt_value)));
 	} else if (IsInteractiveCompany(best->index)) {
 		ShowBuyCompanyDialog(c->index);
 	}
@@ -907,7 +907,7 @@
 
 			CompanyID c_index = c->index;
 			delete c;
-			AI::BroadcastNewEvent(new AIEventCompanyBankrupt(c_index));
+			AI::BroadcastNewEvent(new ScriptEventCompanyBankrupt(c_index));
 			CompanyAdminRemove(c_index, (CompanyRemoveReason)reason);
 			break;
 		}
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -221,7 +221,7 @@
 				AddVehicleNewsItem(STR_NEWS_DISASTER_ZEPPELIN,
 					NS_ACCIDENT,
 					v->index); // Delete the news, when the zeppelin is gone
-				AI::NewEvent(GetTileOwner(v->tile), new AIEventDisasterZeppelinerCrashed(GetStationIndex(v->tile)));
+				AI::NewEvent(GetTileOwner(v->tile), new ScriptEventDisasterZeppelinerCrashed(GetStationIndex(v->tile)));
 			}
 		}
 
@@ -239,7 +239,7 @@
 		if (IsValidTile(v->tile) && IsAirportTile(v->tile)) {
 			Station *st = Station::GetByTile(v->tile);
 			CLRBITS(st->airport.flags, RUNWAY_IN_block);
-			AI::NewEvent(GetTileOwner(v->tile), new AIEventDisasterZeppelinerCleared(st->index));
+			AI::NewEvent(GetTileOwner(v->tile), new ScriptEventDisasterZeppelinerCleared(st->index));
 		}
 
 		SetDisasterVehiclePos(v, v->x_pos, v->y_pos, v->z_pos);
@@ -357,7 +357,7 @@
 					NS_ACCIDENT,
 					u->index); // delete the news, when the roadvehicle is gone
 
-				AI::NewEvent(u->owner, new AIEventVehicleCrashed(u->index, u->tile, AIEventVehicleCrashed::CRASH_RV_UFO));
+				AI::NewEvent(u->owner, new ScriptEventVehicleCrashed(u->index, u->tile, ScriptEventVehicleCrashed::CRASH_RV_UFO));
 			}
 		}
 
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -534,7 +534,7 @@
 			SetDParam(1, STR_NEWS_COMPANY_IN_TROUBLE_DESCRIPTION);
 			SetDParamStr(2, cni->company_name);
 			AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, NS_COMPANY_TROUBLE, cni);
-			AI::BroadcastNewEvent(new AIEventCompanyInTrouble(c->index));
+			AI::BroadcastNewEvent(new ScriptEventCompanyInTrouble(c->index));
 			break;
 		}
 
@@ -1599,7 +1599,7 @@
 	SetDParamStr(3, cni->other_company_name);
 	SetDParam(4, c->bankrupt_value);
 	AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, NS_COMPANY_MERGER, cni);
-	AI::BroadcastNewEvent(new AIEventCompanyMerger(ci, _current_company));
+	AI::BroadcastNewEvent(new ScriptEventCompanyMerger(ci, _current_company));
 
 	ChangeOwnershipOfCompanyItems(ci, _current_company);
 
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -793,7 +793,7 @@
 
 				e->flags |= ENGINE_OFFER_WINDOW_OPEN;
 				e->preview_wait = 20;
-				AI::NewEvent(best_company, new AIEventEnginePreview(i));
+				AI::NewEvent(best_company, new ScriptEventEnginePreview(i));
 				if (IsInteractiveCompany(best_company)) ShowEnginePreviewWindow(i);
 			}
 		}
@@ -874,7 +874,7 @@
 		FOR_ALL_COMPANIES(c) SetBit(c->avail_roadtypes, HasBit(e->info.misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
 	}
 
-	AI::BroadcastNewEvent(new AIEventEngineAvailable(index));
+	AI::BroadcastNewEvent(new ScriptEventEngineAvailable(index));
 
 	SetDParam(0, GetEngineCategoryName(index));
 	SetDParam(1, index);
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -481,7 +481,7 @@
 	}
 
 	if (flags & DC_EXEC) {
-		AI::BroadcastNewEvent(new AIEventIndustryClose(i->index));
+		AI::BroadcastNewEvent(new ScriptEventIndustryClose(i->index));
 		delete i;
 	}
 	return CommandCost(EXPENSES_CONSTRUCTION, indspec->GetRemovalCost());
@@ -1871,7 +1871,7 @@
 			SetDParam(1, ind->town->index);
 		}
 		AddIndustryNewsItem(indspec->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
-		AI::BroadcastNewEvent(new AIEventIndustryOpen(ind->index));
+		AI::BroadcastNewEvent(new ScriptEventIndustryOpen(ind->index));
 	}
 
 	return CommandCost(EXPENSES_OTHER, indspec->GetConstructionCost());
@@ -1984,7 +1984,7 @@
 		SetDParam(1, ind->town->index);
 	}
 	AddIndustryNewsItem(ind_spc->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
-	AI::BroadcastNewEvent(new AIEventIndustryOpen(ind->index));
+	AI::BroadcastNewEvent(new ScriptEventIndustryOpen(ind->index));
 }
 
 /**
@@ -2592,7 +2592,7 @@
 		/* Compute news category */
 		if (closeit) {
 			ns = NS_INDUSTRY_CLOSE;
-			AI::BroadcastNewEvent(new AIEventIndustryClose(i->index));
+			AI::BroadcastNewEvent(new ScriptEventIndustryClose(i->index));
 		} else {
 			switch (WhoCanServiceIndustry(i)) {
 				case 0: ns = NS_INDUSTRY_NOBODY;  break;
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -520,7 +520,7 @@
 {
 	uint pass = v->Crash();
 
-	AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile, AIEventVehicleCrashed::CRASH_RV_LEVEL_CROSSING));
+	AI::NewEvent(v->owner, new ScriptEventVehicleCrashed(v->index, v->tile, ScriptEventVehicleCrashed::CRASH_RV_LEVEL_CROSSING));
 
 	SetDParam(0, pass);
 	AddVehicleNewsItem(
@@ -668,7 +668,7 @@
 				v->index,
 				st->index
 			);
-			AI::NewEvent(v->owner, new AIEventStationFirstVehicle(st->index, v->index));
+			AI::NewEvent(v->owner, new ScriptEventStationFirstVehicle(st->index, v->index));
 		}
 	} else {
 		/* Check if station was ever visited before */
@@ -681,7 +681,7 @@
 				v->index,
 				st->index
 			);
-			AI::NewEvent(v->owner, new AIEventStationFirstVehicle(st->index, v->index));
+			AI::NewEvent(v->owner, new ScriptEventStationFirstVehicle(st->index, v->index));
 		}
 	}
 }
--- a/src/script/api/script_accounting.cpp
+++ b/src/script/api/script_accounting.cpp
@@ -7,28 +7,28 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_accounting.cpp Implementation of AIAccounting. */
+/** @file script_accounting.cpp Implementation of ScriptAccounting. */
 
 #include "../../stdafx.h"
 #include "script_accounting.hpp"
 
-Money AIAccounting::GetCosts()
+Money ScriptAccounting::GetCosts()
 {
 	return this->GetDoCommandCosts();
 }
 
-void AIAccounting::ResetCosts()
+void ScriptAccounting::ResetCosts()
 {
 	this->SetDoCommandCosts(0);
 }
 
-AIAccounting::AIAccounting()
+ScriptAccounting::ScriptAccounting()
 {
 	this->last_costs = this->GetDoCommandCosts();
 	this->SetDoCommandCosts(0);
 }
 
-AIAccounting::~AIAccounting()
+ScriptAccounting::~ScriptAccounting()
 {
 	this->SetDoCommandCosts(this->last_costs);
 }
--- a/src/script/api/script_accounting.hpp
+++ b/src/script/api/script_accounting.hpp
@@ -20,40 +20,40 @@
  * Example:
  * <pre>
  *   {
- *     local costs = AIAccounting();
+ *     local costs = ScriptAccounting();
  *     BuildRoad(from_here, to_here);
  *     BuildRoad(from_there, to_there);
  *     print("Costs for route is: " + costs.GetCosts());
  *   }
  * </pre>
  */
-class AIAccounting : public AIObject {
+class ScriptAccounting : public ScriptObject {
 public:
 	/**
 	 * Creating instance of this class starts counting the costs of commands
 	 *   from zero. Saves the current value of GetCosts so we can return to
 	 *   the old value when the instance gets deleted.
 	 */
-	AIAccounting();
+	ScriptAccounting();
 
 	/**
-	 * Restore the AIAccounting that was on top when we created this instance.
+	 * Restore the ScriptAccounting that was on top when we created this instance.
 	 *   So basically restore the value of GetCosts to what it was before we
 	 *   created this instance.
 	 */
-	~AIAccounting();
+	~ScriptAccounting();
 
 	/**
 	 * Get the current value of the costs.
 	 * @return The current costs.
-	 * @note when nesting AIAccounting instances all instances' GetCosts
+	 * @note when nesting ScriptAccounting instances all instances' GetCosts
 	 *   will always return the value of the 'top' instance.
 	 */
 	Money GetCosts();
 
 	/**
 	 * Reset the costs to zero.
-	 * @note when nesting AIAccounting instances all instances' ResetCosts
+	 * @note when nesting ScriptAccounting instances all instances' ResetCosts
 	 *   will always effect on the 'top' instance.
 	 */
 	void ResetCosts();
--- a/src/script/api/script_airport.cpp
+++ b/src/script/api/script_airport.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_airport.cpp Implementation of AIAirport. */
+/** @file script_airport.cpp Implementation of ScriptAirport. */
 
 #include "../../stdafx.h"
 #include "script_airport.hpp"
@@ -16,17 +16,17 @@
 #include "../../company_func.h"
 #include "../../town.h"
 
-/* static */ bool AIAirport::IsValidAirportType(AirportType type)
+/* static */ bool ScriptAirport::IsValidAirportType(AirportType type)
 {
 	return IsAirportInformationAvailable(type) && ::AirportSpec::Get(type)->IsAvailable();
 }
 
-/* static */ bool AIAirport::IsAirportInformationAvailable(AirportType type)
+/* static */ bool ScriptAirport::IsAirportInformationAvailable(AirportType type)
 {
 	return type >= 0 && type < (AirportType)NUM_AIRPORTS && AirportSpec::Get(type)->enabled;
 }
 
-/* static */ Money AIAirport::GetPrice(AirportType type)
+/* static */ Money ScriptAirport::GetPrice(AirportType type)
 {
 	if (!IsValidAirportType(type)) return -1;
 
@@ -34,61 +34,61 @@
 	return _price[PR_BUILD_STATION_AIRPORT] * as->size_x * as->size_y;
 }
 
-/* static */ bool AIAirport::IsHangarTile(TileIndex tile)
+/* static */ bool ScriptAirport::IsHangarTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_STATION) && ::IsHangar(tile);
 }
 
-/* static */ bool AIAirport::IsAirportTile(TileIndex tile)
+/* static */ bool ScriptAirport::IsAirportTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_STATION) && ::IsAirport(tile);
 }
 
-/* static */ int32 AIAirport::GetAirportWidth(AirportType type)
+/* static */ int32 ScriptAirport::GetAirportWidth(AirportType type)
 {
 	if (!IsAirportInformationAvailable(type)) return -1;
 
 	return ::AirportSpec::Get(type)->size_x;
 }
 
-/* static */ int32 AIAirport::GetAirportHeight(AirportType type)
+/* static */ int32 ScriptAirport::GetAirportHeight(AirportType type)
 {
 	if (!IsAirportInformationAvailable(type)) return -1;
 
 	return ::AirportSpec::Get(type)->size_y;
 }
 
-/* static */ int32 AIAirport::GetAirportCoverageRadius(AirportType type)
+/* static */ int32 ScriptAirport::GetAirportCoverageRadius(AirportType type)
 {
 	if (!IsAirportInformationAvailable(type)) return -1;
 
 	return _settings_game.station.modified_catchment ? ::AirportSpec::Get(type)->catchment : (uint)CA_UNMODIFIED;
 }
 
-/* static */ bool AIAirport::BuildAirport(TileIndex tile, AirportType type, StationID station_id)
+/* static */ bool ScriptAirport::BuildAirport(TileIndex tile, AirportType type, StationID station_id)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, IsValidAirportType(type));
-	EnforcePrecondition(false, station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id));
+	EnforcePrecondition(false, station_id == ScriptStation::STATION_NEW || station_id == ScriptStation::STATION_JOIN_ADJACENT || ScriptStation::IsValidStation(station_id));
 
-	uint p2 = station_id == AIStation::STATION_JOIN_ADJACENT ? 0 : 1;
-	p2 |= (AIStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16;
-	return AIObject::DoCommand(tile, type, p2, CMD_BUILD_AIRPORT);
+	uint p2 = station_id == ScriptStation::STATION_JOIN_ADJACENT ? 0 : 1;
+	p2 |= (ScriptStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16;
+	return ScriptObject::DoCommand(tile, type, p2, CMD_BUILD_AIRPORT);
 }
 
-/* static */ bool AIAirport::RemoveAirport(TileIndex tile)
+/* static */ bool ScriptAirport::RemoveAirport(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile))
 	EnforcePrecondition(false, IsAirportTile(tile) || IsHangarTile(tile));
 
-	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
+	return ScriptObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
 }
 
-/* static */ int32 AIAirport::GetNumHangars(TileIndex tile)
+/* static */ int32 ScriptAirport::GetNumHangars(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return -1;
 	if (!::IsTileType(tile, MP_STATION)) return -1;
@@ -100,7 +100,7 @@
 	return st->airport.GetNumHangars();
 }
 
-/* static */ TileIndex AIAirport::GetHangarOfAirport(TileIndex tile)
+/* static */ TileIndex ScriptAirport::GetHangarOfAirport(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return INVALID_TILE;
 	if (!::IsTileType(tile, MP_STATION)) return INVALID_TILE;
@@ -113,19 +113,19 @@
 	return st->airport.GetHangarTile(0);
 }
 
-/* static */ AIAirport::AirportType AIAirport::GetAirportType(TileIndex tile)
+/* static */ ScriptAirport::AirportType ScriptAirport::GetAirportType(TileIndex tile)
 {
-	if (!AITile::IsStationTile(tile)) return AT_INVALID;
+	if (!ScriptTile::IsStationTile(tile)) return AT_INVALID;
 
 	StationID station_id = ::GetStationIndex(tile);
 
-	if (!AIStation::HasStationType(station_id, AIStation::STATION_AIRPORT)) return AT_INVALID;
+	if (!ScriptStation::HasStationType(station_id, ScriptStation::STATION_AIRPORT)) return AT_INVALID;
 
 	return (AirportType)::Station::Get(station_id)->airport.type;
 }
 
 
-/* static */ int AIAirport::GetNoiseLevelIncrease(TileIndex tile, AirportType type)
+/* static */ int ScriptAirport::GetNoiseLevelIncrease(TileIndex tile, AirportType type)
 {
 	extern Town *AirportGetNearestTown(const AirportSpec *as, TileIndex airport_tile);
 	extern uint8 GetAirportNoiseLevelForTown(const AirportSpec *as, TileIndex town_tile, TileIndex tile);
@@ -142,7 +142,7 @@
 	return 1;
 }
 
-/* static */ TownID AIAirport::GetNearestTown(TileIndex tile, AirportType type)
+/* static */ TownID ScriptAirport::GetNearestTown(TileIndex tile, AirportType type)
 {
 	extern Town *AirportGetNearestTown(const AirportSpec *as, TileIndex airport_tile);
 
--- a/src/script/api/script_airport.hpp
+++ b/src/script/api/script_airport.hpp
@@ -17,7 +17,7 @@
 /**
  * Class that handles all airport related functions.
  */
-class AIAirport : public AIObject {
+class ScriptAirport : public ScriptObject {
 public:
 	/**
 	 * The types of airports available in the game.
@@ -80,7 +80,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a hangar.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has a hangar.
 	 */
 	static bool IsHangarTile(TileIndex tile);
@@ -88,7 +88,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with an airport.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has an airport.
 	 */
 	static bool IsAirportTile(TileIndex tile);
@@ -120,7 +120,7 @@
 	/**
 	 * Get the number of hangars of the airport.
 	 * @param tile Any tile of the airport.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return The number of hangars of the airport.
 	 */
 	static int32 GetNumHangars(TileIndex tile);
@@ -128,7 +128,7 @@
 	/**
 	 * Get the first hanger tile of the airport.
 	 * @param tile Any tile of the airport.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre GetNumHangars(tile) > 0.
 	 * @return The first hanger tile of the airport.
 	 * @note Possible there are more hangars, but you won't be able to find them
@@ -141,15 +141,15 @@
 	 * Builds a airport with tile at the topleft corner.
 	 * @param tile The topleft corner of the airport.
 	 * @param type The type of airport to build.
-	 * @param station_id The station to join, AIStation::STATION_NEW or AIStation::STATION_JOIN_ADJACENT.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @param station_id The station to join, ScriptStation::STATION_NEW or ScriptStation::STATION_JOIN_ADJACENT.
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre AirportAvailable(type).
-	 * @pre station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id).
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_FLAT_LAND_REQUIRED
-	 * @exception AIError::ERR_LOCAL_AUTHORITY_REFUSES
-	 * @exception AIStation::ERR_STATION_TOO_LARGE
-	 * @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
+	 * @pre station_id == ScriptStation::STATION_NEW || station_id == ScriptStation::STATION_JOIN_ADJACENT || ScriptStation::IsValidStation(station_id).
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_FLAT_LAND_REQUIRED
+	 * @exception ScriptError::ERR_LOCAL_AUTHORITY_REFUSES
+	 * @exception ScriptStation::ERR_STATION_TOO_LARGE
+	 * @exception ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
 	 * @return Whether the airport has been/can be build or not.
 	 */
 	static bool BuildAirport(TileIndex tile, AirportType type, StationID station_id);
@@ -157,8 +157,8 @@
 	/**
 	 * Removes an airport.
 	 * @param tile Any tile of the airport.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
 	 * @return Whether the airport has been/can be removed or not.
 	 */
 	static bool RemoveAirport(TileIndex tile);
@@ -166,8 +166,8 @@
 	/**
 	 * Get the AirportType of an existing airport.
 	 * @param tile Any tile of the airport.
-	 * @pre AITile::IsStationTile(tile).
-	 * @pre AIStation::HasStationType(AIStation.GetStationID(tile), AIStation::STATION_AIRPORT).
+	 * @pre ScriptTile::IsStationTile(tile).
+	 * @pre ScriptStation::HasStationType(ScriptStation.GetStationID(tile), ScriptStation::STATION_AIRPORT).
 	 * @return The AirportType of the airport.
 	 */
 	static AirportType GetAirportType(TileIndex tile);
--- a/src/script/api/script_base.cpp
+++ b/src/script/api/script_base.cpp
@@ -7,14 +7,14 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_base.cpp Implementation of AIBase. */
+/** @file script_base.cpp Implementation of ScriptBase. */
 
 #include "../../stdafx.h"
 #include "script_base.hpp"
 #include "../../network/network.h"
 #include "../../core/random_func.hpp"
 
-/* static */ uint32 AIBase::Rand()
+/* static */ uint32 ScriptBase::Rand()
 {
 	/* We pick RandomRange if we are in SP (so when saved, we do the same over and over)
 	 *   but we pick InteractiveRandomRange if we are a network_server or network-client. */
@@ -22,12 +22,12 @@
 	return ::Random();
 }
 
-/* static */ uint32 AIBase::RandItem(int unused_param)
+/* static */ uint32 ScriptBase::RandItem(int unused_param)
 {
-	return AIBase::Rand();
+	return ScriptBase::Rand();
 }
 
-/* static */ uint AIBase::RandRange(uint max)
+/* static */ uint ScriptBase::RandRange(uint max)
 {
 	/* We pick RandomRange if we are in SP (so when saved, we do the same over and over)
 	 *   but we pick InteractiveRandomRange if we are a network_server or network-client. */
@@ -35,17 +35,17 @@
 	return ::RandomRange(max);
 }
 
-/* static */ uint32 AIBase::RandRangeItem(int unused_param, uint max)
+/* static */ uint32 ScriptBase::RandRangeItem(int unused_param, uint max)
 {
-	return AIBase::RandRange(max);
+	return ScriptBase::RandRange(max);
 }
 
-/* static */ bool AIBase::Chance(uint out, uint max)
+/* static */ bool ScriptBase::Chance(uint out, uint max)
 {
 	return (uint16)Rand() <= (uint16)((65536 * out) / max);
 }
 
-/* static */ bool AIBase::ChanceItem(int unused_param, uint out, uint max)
+/* static */ bool ScriptBase::ChanceItem(int unused_param, uint out, uint max)
 {
-	return AIBase::Chance(out, max);
+	return ScriptBase::Chance(out, max);
 }
--- a/src/script/api/script_base.hpp
+++ b/src/script/api/script_base.hpp
@@ -23,7 +23,7 @@
  *        ran on the server only, not on all clients). This means that
  *        we use InteractiveRandom in MP. Rand() takes care of this for you.
  */
-class AIBase : public AIObject {
+class ScriptBase : public ScriptObject {
 public:
 	/**
 	 * Get a random value.
--- a/src/script/api/script_basestation.cpp
+++ b/src/script/api/script_basestation.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_basestation.cpp Implementation of AIBaseStation. */
+/** @file script_basestation.cpp Implementation of ScriptBaseStation. */
 
 #include "../../stdafx.h"
 #include "script_basestation.hpp"
@@ -17,13 +17,13 @@
 #include "../../company_func.h"
 #include "table/strings.h"
 
-/* static */ bool AIBaseStation::IsValidBaseStation(StationID station_id)
+/* static */ bool ScriptBaseStation::IsValidBaseStation(StationID station_id)
 {
 	const BaseStation *st = ::BaseStation::GetIfValid(station_id);
 	return st != NULL && (st->owner == _current_company || st->owner == OWNER_NONE);
 }
 
-/* static */ char *AIBaseStation::GetName(StationID station_id)
+/* static */ char *ScriptBaseStation::GetName(StationID station_id)
 {
 	if (!IsValidBaseStation(station_id)) return NULL;
 
@@ -35,23 +35,23 @@
 	return name;
 }
 
-/* static */ bool AIBaseStation::SetName(StationID station_id, const char *name)
+/* static */ bool ScriptBaseStation::SetName(StationID station_id, const char *name)
 {
 	EnforcePrecondition(false, IsValidBaseStation(station_id));
 	EnforcePrecondition(false, !::StrEmpty(name));
-	EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_STATION_NAME_CHARS, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
+	EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_STATION_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
 
-	return AIObject::DoCommand(0, station_id, 0, ::Station::IsValidID(station_id) ? CMD_RENAME_STATION : CMD_RENAME_WAYPOINT, name);
+	return ScriptObject::DoCommand(0, station_id, 0, ::Station::IsValidID(station_id) ? CMD_RENAME_STATION : CMD_RENAME_WAYPOINT, name);
 }
 
-/* static */ TileIndex AIBaseStation::GetLocation(StationID station_id)
+/* static */ TileIndex ScriptBaseStation::GetLocation(StationID station_id)
 {
 	if (!IsValidBaseStation(station_id)) return INVALID_TILE;
 
 	return ::BaseStation::Get(station_id)->xy;
 }
 
-/* static */ int32 AIBaseStation::GetConstructionDate(StationID station_id)
+/* static */ int32 ScriptBaseStation::GetConstructionDate(StationID station_id)
 {
 	if (!IsValidBaseStation(station_id)) return -1;
 
--- a/src/script/api/script_basestation.hpp
+++ b/src/script/api/script_basestation.hpp
@@ -17,7 +17,7 @@
 /**
  * Base class for stations and waypoints.
  */
-class AIBaseStation : public AIObject {
+class ScriptBaseStation : public ScriptObject {
 public:
 	/**
 	 * Special station IDs for building adjacent/new stations when
@@ -52,7 +52,7 @@
 	 * @pre IsValidBaseStation(station_id).
 	 * @pre 'name' must have at least one character.
 	 * @pre 'name' must have at most 30 characters.
-	 * @exception AIError::ERR_NAME_IS_NOT_UNIQUE
+	 * @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
 	 * @return True if the name was changed.
 	 */
 	static bool SetName(StationID station_id, const char *name);
@@ -63,7 +63,7 @@
 	 * @pre IsValidBaseStation(station_id).
 	 * @return The tile the basestation sign above it.
 	 * @note The tile is not necessarily a station tile (and if it is, it could also belong to another station).
-	 * @see AITileList_StationType.
+	 * @see ScriptTileList_StationType.
 	 */
 	static TileIndex GetLocation(StationID station_id);
 
--- a/src/script/api/script_bridge.cpp
+++ b/src/script/api/script_bridge.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_bridge.cpp Implementation of AIBridge. */
+/** @file script_bridge.cpp Implementation of ScriptBridge. */
 
 #include "../../stdafx.h"
 #include "script_bridge.hpp"
@@ -18,18 +18,18 @@
 #include "../../economy_func.h"
 #include "../../date_func.h"
 
-/* static */ bool AIBridge::IsValidBridge(BridgeID bridge_id)
+/* static */ bool ScriptBridge::IsValidBridge(BridgeID bridge_id)
 {
 	return bridge_id < MAX_BRIDGES && ::GetBridgeSpec(bridge_id)->avail_year <= _cur_year;
 }
 
-/* static */ bool AIBridge::IsBridgeTile(TileIndex tile)
+/* static */ bool ScriptBridge::IsBridgeTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 	return ::IsBridgeTile(tile);
 }
 
-/* static */ BridgeID AIBridge::GetBridgeID(TileIndex tile)
+/* static */ BridgeID ScriptBridge::GetBridgeID(TileIndex tile)
 {
 	if (!IsBridgeTile(tile)) return (BridgeID)-1;
 	return (BridgeID)::GetBridgeType(tile);
@@ -41,7 +41,7 @@
  */
 static void _DoCommandReturnBuildBridge2(class AIInstance *instance)
 {
-	if (!AIBridge::_BuildBridgeRoad2()) {
+	if (!ScriptBridge::_BuildBridgeRoad2()) {
 		AIInstance::DoCommandReturn(instance);
 		return;
 	}
@@ -57,7 +57,7 @@
  */
 static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
 {
-	if (!AIBridge::_BuildBridgeRoad1()) {
+	if (!ScriptBridge::_BuildBridgeRoad1()) {
 		AIInstance::DoCommandReturn(instance);
 		return;
 	}
@@ -67,71 +67,71 @@
 	NOT_REACHED();
 }
 
-/* static */ bool AIBridge::BuildBridge(AIVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end)
+/* static */ bool ScriptBridge::BuildBridge(ScriptVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end)
 {
 	EnforcePrecondition(false, start != end);
 	EnforcePrecondition(false, ::IsValidTile(start) && ::IsValidTile(end));
 	EnforcePrecondition(false, TileX(start) == TileX(end) || TileY(start) == TileY(end));
-	EnforcePrecondition(false, vehicle_type == AIVehicle::VT_ROAD || vehicle_type == AIVehicle::VT_RAIL || vehicle_type == AIVehicle::VT_WATER);
-	EnforcePrecondition(false, vehicle_type != AIVehicle::VT_RAIL || AIRail::IsRailTypeAvailable(AIRail::GetCurrentRailType()));
+	EnforcePrecondition(false, vehicle_type == ScriptVehicle::VT_ROAD || vehicle_type == ScriptVehicle::VT_RAIL || vehicle_type == ScriptVehicle::VT_WATER);
+	EnforcePrecondition(false, vehicle_type != ScriptVehicle::VT_RAIL || ScriptRail::IsRailTypeAvailable(ScriptRail::GetCurrentRailType()));
 
 	uint type = 0;
 	switch (vehicle_type) {
-		case AIVehicle::VT_ROAD:
+		case ScriptVehicle::VT_ROAD:
 			type |= (TRANSPORT_ROAD << 15);
-			type |= (::RoadTypeToRoadTypes((::RoadType)AIObject::GetRoadType()) << 8);
+			type |= (::RoadTypeToRoadTypes((::RoadType)ScriptObject::GetRoadType()) << 8);
 			break;
-		case AIVehicle::VT_RAIL:
+		case ScriptVehicle::VT_RAIL:
 			type |= (TRANSPORT_RAIL << 15);
-			type |= (AIRail::GetCurrentRailType() << 8);
+			type |= (ScriptRail::GetCurrentRailType() << 8);
 			break;
-		case AIVehicle::VT_WATER:
+		case ScriptVehicle::VT_WATER:
 			type |= (TRANSPORT_WATER << 15);
 			break;
 		default: NOT_REACHED();
 	}
 
 	/* For rail and water we do nothing special */
-	if (vehicle_type == AIVehicle::VT_RAIL || vehicle_type == AIVehicle::VT_WATER) {
-		return AIObject::DoCommand(end, start, type | bridge_id, CMD_BUILD_BRIDGE);
+	if (vehicle_type == ScriptVehicle::VT_RAIL || vehicle_type == ScriptVehicle::VT_WATER) {
+		return ScriptObject::DoCommand(end, start, type | bridge_id, CMD_BUILD_BRIDGE);
 	}
 
-	AIObject::SetCallbackVariable(0, start);
-	AIObject::SetCallbackVariable(1, end);
-	return AIObject::DoCommand(end, start, type | bridge_id, CMD_BUILD_BRIDGE, NULL, &::_DoCommandReturnBuildBridge1);
+	ScriptObject::SetCallbackVariable(0, start);
+	ScriptObject::SetCallbackVariable(1, end);
+	return ScriptObject::DoCommand(end, start, type | bridge_id, CMD_BUILD_BRIDGE, NULL, &::_DoCommandReturnBuildBridge1);
 }
 
-/* static */ bool AIBridge::_BuildBridgeRoad1()
+/* static */ bool ScriptBridge::_BuildBridgeRoad1()
 {
 	/* Build the piece of road on the 'start' side of the bridge */
-	TileIndex end = AIObject::GetCallbackVariable(0);
-	TileIndex start = AIObject::GetCallbackVariable(1);
+	TileIndex end = ScriptObject::GetCallbackVariable(0);
+	TileIndex start = ScriptObject::GetCallbackVariable(1);
 
 	DiagDirection dir_1 = ::DiagdirBetweenTiles(end, start);
 	DiagDirection dir_2 = ::ReverseDiagDir(dir_1);
 
-	return AIObject::DoCommand(start + ::TileOffsByDiagDir(dir_1), ::DiagDirToRoadBits(dir_2) | (AIObject::GetRoadType() << 4), 0, CMD_BUILD_ROAD, NULL, &::_DoCommandReturnBuildBridge2);
+	return ScriptObject::DoCommand(start + ::TileOffsByDiagDir(dir_1), ::DiagDirToRoadBits(dir_2) | (ScriptObject::GetRoadType() << 4), 0, CMD_BUILD_ROAD, NULL, &::_DoCommandReturnBuildBridge2);
 }
 
-/* static */ bool AIBridge::_BuildBridgeRoad2()
+/* static */ bool ScriptBridge::_BuildBridgeRoad2()
 {
 	/* Build the piece of road on the 'end' side of the bridge */
-	TileIndex end = AIObject::GetCallbackVariable(0);
-	TileIndex start = AIObject::GetCallbackVariable(1);
+	TileIndex end = ScriptObject::GetCallbackVariable(0);
+	TileIndex start = ScriptObject::GetCallbackVariable(1);
 
 	DiagDirection dir_1 = ::DiagdirBetweenTiles(end, start);
 	DiagDirection dir_2 = ::ReverseDiagDir(dir_1);
 
-	return AIObject::DoCommand(end + ::TileOffsByDiagDir(dir_2), ::DiagDirToRoadBits(dir_1) | (AIObject::GetRoadType() << 4), 0, CMD_BUILD_ROAD);
+	return ScriptObject::DoCommand(end + ::TileOffsByDiagDir(dir_2), ::DiagDirToRoadBits(dir_1) | (ScriptObject::GetRoadType() << 4), 0, CMD_BUILD_ROAD);
 }
 
-/* static */ bool AIBridge::RemoveBridge(TileIndex tile)
+/* static */ bool ScriptBridge::RemoveBridge(TileIndex tile)
 {
 	EnforcePrecondition(false, IsBridgeTile(tile));
-	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
+	return ScriptObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
 }
 
-/* static */ char *AIBridge::GetName(BridgeID bridge_id)
+/* static */ char *ScriptBridge::GetName(BridgeID bridge_id)
 {
 	if (!IsValidBridge(bridge_id)) return NULL;
 
@@ -142,35 +142,35 @@
 	return bridge_name;
 }
 
-/* static */ int32 AIBridge::GetMaxSpeed(BridgeID bridge_id)
+/* static */ int32 ScriptBridge::GetMaxSpeed(BridgeID bridge_id)
 {
 	if (!IsValidBridge(bridge_id)) return -1;
 
 	return ::GetBridgeSpec(bridge_id)->speed; // km-ish/h
 }
 
-/* static */ Money AIBridge::GetPrice(BridgeID bridge_id, uint length)
+/* static */ Money ScriptBridge::GetPrice(BridgeID bridge_id, uint length)
 {
 	if (!IsValidBridge(bridge_id)) return -1;
 
 	return ::CalcBridgeLenCostFactor(length) * _price[PR_BUILD_BRIDGE] * ::GetBridgeSpec(bridge_id)->price >> 8;
 }
 
-/* static */ int32 AIBridge::GetMaxLength(BridgeID bridge_id)
+/* static */ int32 ScriptBridge::GetMaxLength(BridgeID bridge_id)
 {
 	if (!IsValidBridge(bridge_id)) return -1;
 
 	return min(::GetBridgeSpec(bridge_id)->max_length, _settings_game.construction.max_bridge_length) + 2;
 }
 
-/* static */ int32 AIBridge::GetMinLength(BridgeID bridge_id)
+/* static */ int32 ScriptBridge::GetMinLength(BridgeID bridge_id)
 {
 	if (!IsValidBridge(bridge_id)) return -1;
 
 	return ::GetBridgeSpec(bridge_id)->min_length + 2;
 }
 
-/* static */ TileIndex AIBridge::GetOtherBridgeEnd(TileIndex tile)
+/* static */ TileIndex ScriptBridge::GetOtherBridgeEnd(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return INVALID_TILE;
 	if (!IsBridgeTile(tile)) return INVALID_TILE;
--- a/src/script/api/script_bridge.hpp
+++ b/src/script/api/script_bridge.hpp
@@ -17,14 +17,14 @@
 /**
  * Class that handles all bridge related functions.
  */
-class AIBridge : public AIObject {
+class ScriptBridge : public ScriptObject {
 public:
 	/**
 	 * All bridge related error messages.
 	 */
 	enum ErrorMessages {
 		/** Base for bridge related errors */
-		ERR_BRIDGE_BASE = AIError::ERR_CAT_BRIDGE << AIError::ERR_CAT_BIT_SIZE,
+		ERR_BRIDGE_BASE = ScriptError::ERR_CAT_BRIDGE << ScriptError::ERR_CAT_BIT_SIZE,
 
 		/**
 		 * The bridge you want to build is not available yet,
@@ -49,7 +49,7 @@
 	/**
 	 * Checks whether the given tile is actually a bridge start or end tile.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile is the beginning or end of a bridge.
 	 */
 	static bool IsBridgeTile(TileIndex tile);
@@ -127,31 +127,31 @@
 	 * @param bridge_id The bridge-type to build.
 	 * @param start Where to start the bridge.
 	 * @param end Where to end the bridge.
-	 * @pre AIMap::IsValidTile(start).
-	 * @pre AIMap::IsValidTile(end).
+	 * @pre ScriptMap::IsValidTile(start).
+	 * @pre ScriptMap::IsValidTile(end).
 	 * @pre 'start' and 'end' are in a straight line, i.e.
-	 *  AIMap::GetTileX(start) == AIMap::GetTileX(end) or
-	 *  AIMap::GetTileY(start) == AIMap::GetTileY(end).
-	 * @pre vehicle_type == AIVehicle::VT_ROAD || vehicle_type == AIVehicle::VT_WATER ||
-	 *   (vehicle_type == AIVehicle::VT_RAIL && AIRail::IsRailTypeAvailable(AIRail::GetCurrentRailType())).
-	 * @exception AIError::ERR_ALREADY_BUILT
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_LAND_SLOPED_WRONG
-	 * @exception AIError::ERR_VEHICLE_IN_THE_WAY
-	 * @exception AIBridge::ERR_BRIDGE_TYPE_UNAVAILABLE
-	 * @exception AIBridge::ERR_BRIDGE_CANNOT_END_IN_WATER
-	 * @exception AIBridge::ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT
+	 *  ScriptMap::GetTileX(start) == ScriptMap::GetTileX(end) or
+	 *  ScriptMap::GetTileY(start) == ScriptMap::GetTileY(end).
+	 * @pre vehicle_type == ScriptVehicle::VT_ROAD || vehicle_type == ScriptVehicle::VT_WATER ||
+	 *   (vehicle_type == ScriptVehicle::VT_RAIL && ScriptRail::IsRailTypeAvailable(ScriptRail::GetCurrentRailType())).
+	 * @exception ScriptError::ERR_ALREADY_BUILT
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_LAND_SLOPED_WRONG
+	 * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY
+	 * @exception ScriptBridge::ERR_BRIDGE_TYPE_UNAVAILABLE
+	 * @exception ScriptBridge::ERR_BRIDGE_CANNOT_END_IN_WATER
+	 * @exception ScriptBridge::ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT
 	 * @return Whether the bridge has been/can be build or not.
 	 * @note No matter if the road pieces were build or not, if building the
 	 *  bridge succeeded, this function returns true.
 	 */
-	static bool BuildBridge(AIVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end);
+	static bool BuildBridge(ScriptVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end);
 
 	/**
 	 * Removes a bridge, by executing it on either the start or end tile.
 	 * @param tile An end or start tile of the bridge.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
 	 * @return Whether the bridge has been/can be removed or not.
 	 */
 	static bool RemoveBridge(TileIndex tile);
@@ -159,7 +159,7 @@
 	/**
 	 * Get the tile that is on the other end of a bridge starting at tile.
 	 * @param tile The tile that is an end of a bridge.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre IsBridgeTile(tile).
 	 * @return The TileIndex that is the other end of the bridge.
 	 */
--- a/src/script/api/script_bridgelist.cpp
+++ b/src/script/api/script_bridgelist.cpp
@@ -7,25 +7,25 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_bridgelist.cpp Implementation of AIBridgeList and friends. */
+/** @file script_bridgelist.cpp Implementation of ScriptBridgeList and friends. */
 
 #include "../../stdafx.h"
 #include "script_bridgelist.hpp"
 #include "script_bridge.hpp"
 #include "../../bridge.h"
 
-AIBridgeList::AIBridgeList()
+ScriptBridgeList::ScriptBridgeList()
 {
 	for (byte j = 0; j < MAX_BRIDGES; j++) {
-		if (AIBridge::IsValidBridge(j)) this->AddItem(j);
+		if (ScriptBridge::IsValidBridge(j)) this->AddItem(j);
 	}
 }
 
-AIBridgeList_Length::AIBridgeList_Length(uint length)
+ScriptBridgeList_Length::ScriptBridgeList_Length(uint length)
 {
 	for (byte j = 0; j < MAX_BRIDGES; j++) {
-		if (AIBridge::IsValidBridge(j)) {
-			if (length >= (uint)AIBridge::GetMinLength(j) && length <= (uint)AIBridge::GetMaxLength(j)) this->AddItem(j);
+		if (ScriptBridge::IsValidBridge(j)) {
+			if (length >= (uint)ScriptBridge::GetMinLength(j) && length <= (uint)ScriptBridge::GetMaxLength(j)) this->AddItem(j);
 		}
 	}
 }
--- a/src/script/api/script_bridgelist.hpp
+++ b/src/script/api/script_bridgelist.hpp
@@ -16,23 +16,23 @@
 
 /**
  * Create a list of bridges.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIBridgeList : public AIList {
+class ScriptBridgeList : public ScriptList {
 public:
-	AIBridgeList();
+	ScriptBridgeList();
 };
 
 /**
  * Create a list of bridges that can be built on a specific length.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIBridgeList_Length : public AIList {
+class ScriptBridgeList_Length : public ScriptList {
 public:
 	/**
 	 * @param length The length of the bridge you want to build.
 	 */
-	AIBridgeList_Length(uint length);
+	ScriptBridgeList_Length(uint length);
 };
 
 #endif /* SCRIPT_BRIDGELIST_HPP */
--- a/src/script/api/script_cargo.cpp
+++ b/src/script/api/script_cargo.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_cargo.cpp Implementation of AICargo. */
+/** @file script_cargo.cpp Implementation of ScriptCargo. */
 
 #include "../../stdafx.h"
 #include "script_cargo.hpp"
@@ -15,17 +15,17 @@
 #include "../../economy_func.h"
 #include "../../core/bitmath_func.hpp"
 
-/* static */ bool AICargo::IsValidCargo(CargoID cargo_type)
+/* static */ bool ScriptCargo::IsValidCargo(CargoID cargo_type)
 {
 	return (cargo_type < NUM_CARGO && ::CargoSpec::Get(cargo_type)->IsValid());
 }
 
-/* static */ bool AICargo::IsValidTownEffect(TownEffect towneffect_type)
+/* static */ bool ScriptCargo::IsValidTownEffect(TownEffect towneffect_type)
 {
 	return (towneffect_type >= (TownEffect)TE_BEGIN && towneffect_type < (TownEffect)TE_END);
 }
 
-/* static */ char *AICargo::GetCargoLabel(CargoID cargo_type)
+/* static */ char *ScriptCargo::GetCargoLabel(CargoID cargo_type)
 {
 	if (!IsValidCargo(cargo_type)) return NULL;
 	const CargoSpec *cargo = ::CargoSpec::Get(cargo_type);
@@ -40,27 +40,27 @@
 	return cargo_label;
 }
 
-/* static */ bool AICargo::IsFreight(CargoID cargo_type)
+/* static */ bool ScriptCargo::IsFreight(CargoID cargo_type)
 {
 	if (!IsValidCargo(cargo_type)) return false;
 	const CargoSpec *cargo = ::CargoSpec::Get(cargo_type);
 	return cargo->is_freight;
 }
 
-/* static */ bool AICargo::HasCargoClass(CargoID cargo_type, CargoClass cargo_class)
+/* static */ bool ScriptCargo::HasCargoClass(CargoID cargo_type, CargoClass cargo_class)
 {
 	if (!IsValidCargo(cargo_type)) return false;
 	return ::IsCargoInClass(cargo_type, (::CargoClass)cargo_class);
 }
 
-/* static */ AICargo::TownEffect AICargo::GetTownEffect(CargoID cargo_type)
+/* static */ ScriptCargo::TownEffect ScriptCargo::GetTownEffect(CargoID cargo_type)
 {
 	if (!IsValidCargo(cargo_type)) return TE_NONE;
 
-	return (AICargo::TownEffect)::CargoSpec::Get(cargo_type)->town_effect;
+	return (ScriptCargo::TownEffect)::CargoSpec::Get(cargo_type)->town_effect;
 }
 
-/* static */ Money AICargo::GetCargoIncome(CargoID cargo_type, uint32 distance, uint32 days_in_transit)
+/* static */ Money ScriptCargo::GetCargoIncome(CargoID cargo_type, uint32 distance, uint32 days_in_transit)
 {
 	if (!IsValidCargo(cargo_type)) return -1;
 	return ::GetTransportedGoodsIncome(1, distance, Clamp(days_in_transit * 2 / 5, 0, 255), cargo_type);
--- a/src/script/api/script_cargo.hpp
+++ b/src/script/api/script_cargo.hpp
@@ -17,7 +17,7 @@
 /**
  * Class that handles all cargo related functions.
  */
-class AICargo : public AIObject {
+class ScriptCargo : public ScriptObject {
 public:
 	/**
 	 * The classes of cargo (from newgrf_cargo.h).
@@ -72,7 +72,7 @@
 	/**
 	 * Gets the string representation of the cargo label.
 	 * @param cargo_type The cargo to get the string representation of.
-	 * @pre AICargo::IsValidCargo(cargo_type).
+	 * @pre ScriptCargo::IsValidCargo(cargo_type).
 	 * @return The cargo label.
 	 * @note Never use this to check if it is a certain cargo. NewGRF can
 	 *  redefine all of the names.
@@ -84,7 +84,7 @@
 	 * This defines whether the "freight train weight multiplier" will apply to
 	 * trains transporting this cargo.
 	 * @param cargo_type The cargo to check on.
-	 * @pre AICargo::IsValidCargo(cargo_type).
+	 * @pre ScriptCargo::IsValidCargo(cargo_type).
 	 * @return True if and only if the cargo is freight.
 	 */
 	static bool IsFreight(CargoID cargo_type);
@@ -92,7 +92,7 @@
 	/**
 	 * Check if this cargo is in the requested cargo class.
 	 * @param cargo_type The cargo to check on.
-	 * @pre AICargo::IsValidCargo(cargo_type).
+	 * @pre ScriptCargo::IsValidCargo(cargo_type).
 	 * @param cargo_class The class to check for.
 	 * @return True if and only if the cargo is in the cargo class.
 	 */
@@ -101,7 +101,7 @@
 	/**
 	 * Get the effect this cargo has on a town.
 	 * @param cargo_type The cargo to check on.
-	 * @pre AICargo::IsValidCargo(cargo_type).
+	 * @pre ScriptCargo::IsValidCargo(cargo_type).
 	 * @return The effect this cargo has on a town, or TE_NONE if it has no effect.
 	 */
 	static TownEffect GetTownEffect(CargoID cargo_type);
@@ -110,7 +110,7 @@
 	 * Get the income for transporting a piece of cargo over the
 	 *   given distance within the specified time.
 	 * @param cargo_type The cargo to transport.
-	 * @pre AICargo::IsValidCargo(cargo_type).
+	 * @pre ScriptCargo::IsValidCargo(cargo_type).
 	 * @param distance The distance the cargo travels from begin to end.
 	 * @param days_in_transit Amount of (game) days the cargo is in transit. The max value of this variable is 637. Any value higher returns the same as 637 would.
 	 * @return The amount of money that would be earned by this trip.
--- a/src/script/api/script_cargolist.cpp
+++ b/src/script/api/script_cargolist.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_cargolist.cpp Implementation of AICargoList and friends. */
+/** @file script_cargolist.cpp Implementation of ScriptCargoList and friends. */
 
 #include "../../stdafx.h"
 #include "script_cargolist.hpp"
@@ -17,7 +17,7 @@
 #include "../../industry.h"
 #include "../../station_base.h"
 
-AICargoList::AICargoList()
+ScriptCargoList::ScriptCargoList()
 {
 	const CargoSpec *cs;
 	FOR_ALL_CARGOSPECS(cs) {
@@ -25,9 +25,9 @@
 	}
 }
 
-AICargoList_IndustryAccepting::AICargoList_IndustryAccepting(IndustryID industry_id)
+ScriptCargoList_IndustryAccepting::ScriptCargoList_IndustryAccepting(IndustryID industry_id)
 {
-	if (!AIIndustry::IsValidIndustry(industry_id)) return;
+	if (!ScriptIndustry::IsValidIndustry(industry_id)) return;
 
 	Industry *ind = ::Industry::Get(industry_id);
 	for (uint i = 0; i < lengthof(ind->accepts_cargo); i++) {
@@ -38,9 +38,9 @@
 	}
 }
 
-AICargoList_IndustryProducing::AICargoList_IndustryProducing(IndustryID industry_id)
+ScriptCargoList_IndustryProducing::ScriptCargoList_IndustryProducing(IndustryID industry_id)
 {
-	if (!AIIndustry::IsValidIndustry(industry_id)) return;
+	if (!ScriptIndustry::IsValidIndustry(industry_id)) return;
 
 	Industry *ind = ::Industry::Get(industry_id);
 	for (uint i = 0; i < lengthof(ind->produced_cargo); i++) {
@@ -51,9 +51,9 @@
 	}
 }
 
-AICargoList_StationAccepting::AICargoList_StationAccepting(StationID station_id)
+ScriptCargoList_StationAccepting::ScriptCargoList_StationAccepting(StationID station_id)
 {
-	if (!AIStation::IsValidStation(station_id)) return;
+	if (!ScriptStation::IsValidStation(station_id)) return;
 
 	Station *st = ::Station::Get(station_id);
 	for (CargoID i = 0; i < NUM_CARGO; i++) {
--- a/src/script/api/script_cargolist.hpp
+++ b/src/script/api/script_cargolist.hpp
@@ -16,49 +16,49 @@
 
 /**
  * Creates a list of cargos that can be produced in the current game.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AICargoList : public AIList {
+class ScriptCargoList : public ScriptList {
 public:
-	AICargoList();
+	ScriptCargoList();
 };
 
 /**
  * Creates a list of cargos that the given industry accepts.
  * @note This list also includes cargos that are temporarily not accepted
- *   by this industry, @see AIIndustry::IsCargoAccepted.
- * @ingroup AIList
+ *   by this industry, @see ScriptIndustry::IsCargoAccepted.
+ * @ingroup ScriptList
  */
-class AICargoList_IndustryAccepting : public AIList {
+class ScriptCargoList_IndustryAccepting : public ScriptList {
 public:
 	/**
 	 * @param industry_id The industry to get the list of cargos it accepts from.
 	 */
-	AICargoList_IndustryAccepting(IndustryID industry_id);
+	ScriptCargoList_IndustryAccepting(IndustryID industry_id);
 };
 
 /**
  * Creates a list of cargos that the given industry can produce.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AICargoList_IndustryProducing : public AIList {
+class ScriptCargoList_IndustryProducing : public ScriptList {
 public:
 	/**
 	 * @param industry_id The industry to get the list of cargos it produces from.
 	 */
-	AICargoList_IndustryProducing(IndustryID industry_id);
+	ScriptCargoList_IndustryProducing(IndustryID industry_id);
 };
 
 /**
  * Creates a list of cargos that the given station accepts.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AICargoList_StationAccepting : public AIList {
+class ScriptCargoList_StationAccepting : public ScriptList {
 public:
 	/**
 	 * @param station_id The station to get the list of cargos it accepts from.
 	 */
-	AICargoList_StationAccepting(StationID station_id);
+	ScriptCargoList_StationAccepting(StationID station_id);
 };
 
 #endif /* SCRIPT_CARGOLIST_HPP */
--- a/src/script/api/script_company.cpp
+++ b/src/script/api/script_company.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_company.cpp Implementation of AICompany. */
+/** @file script_company.cpp Implementation of ScriptCompany. */
 
 #include "../../stdafx.h"
 #include "script_company.hpp"
@@ -24,27 +24,27 @@
 #include "../../settings_func.h"
 #include "table/strings.h"
 
-/* static */ AICompany::CompanyID AICompany::ResolveCompanyID(AICompany::CompanyID company)
+/* static */ ScriptCompany::CompanyID ScriptCompany::ResolveCompanyID(ScriptCompany::CompanyID company)
 {
 	if (company == COMPANY_SELF) return (CompanyID)((byte)_current_company);
 
 	return ::Company::IsValidID((::CompanyID)company) ? company : COMPANY_INVALID;
 }
 
-/* static */ bool AICompany::IsMine(AICompany::CompanyID company)
+/* static */ bool ScriptCompany::IsMine(ScriptCompany::CompanyID company)
 {
 	return ResolveCompanyID(company) == ResolveCompanyID(COMPANY_SELF);
 }
 
-/* static */ bool AICompany::SetName(const char *name)
+/* static */ bool ScriptCompany::SetName(const char *name)
 {
 	EnforcePrecondition(false, !::StrEmpty(name));
-	EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_COMPANY_NAME_CHARS, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
+	EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_COMPANY_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
 
-	return AIObject::DoCommand(0, 0, 0, CMD_RENAME_COMPANY, name);
+	return ScriptObject::DoCommand(0, 0, 0, CMD_RENAME_COMPANY, name);
 }
 
-/* static */ char *AICompany::GetName(AICompany::CompanyID company)
+/* static */ char *ScriptCompany::GetName(ScriptCompany::CompanyID company)
 {
 	company = ResolveCompanyID(company);
 	if (company == COMPANY_INVALID) return NULL;
@@ -57,14 +57,14 @@
 	return company_name;
 }
 
-/* static */ bool AICompany::SetPresidentName(const char *name)
+/* static */ bool ScriptCompany::SetPresidentName(const char *name)
 {
 	EnforcePrecondition(false, !::StrEmpty(name));
 
-	return AIObject::DoCommand(0, 0, 0, CMD_RENAME_PRESIDENT, name);
+	return ScriptObject::DoCommand(0, 0, 0, CMD_RENAME_PRESIDENT, name);
 }
 
-/* static */ char *AICompany::GetPresidentName(AICompany::CompanyID company)
+/* static */ char *ScriptCompany::GetPresidentName(ScriptCompany::CompanyID company)
 {
 	company = ResolveCompanyID(company);
 
@@ -80,19 +80,19 @@
 	return president_name;
 }
 
-/* static */ bool AICompany::SetPresidentGender(Gender gender)
+/* static */ bool ScriptCompany::SetPresidentGender(Gender gender)
 {
 	EnforcePrecondition(false, gender == GENDER_MALE || gender == GENDER_FEMALE);
-	EnforcePrecondition(false, GetPresidentGender(AICompany::COMPANY_SELF) != gender);
+	EnforcePrecondition(false, GetPresidentGender(ScriptCompany::COMPANY_SELF) != gender);
 
 	CompanyManagerFace cmf;
 	GenderEthnicity ge = (GenderEthnicity)((gender == GENDER_FEMALE ? (1 << ::GENDER_FEMALE) : 0) | (::InteractiveRandom() & (1 << ETHNICITY_BLACK)));
 	RandomCompanyManagerFaceBits(cmf, ge, false);
 
-	return AIObject::DoCommand(0, 0, cmf, CMD_SET_COMPANY_MANAGER_FACE);
+	return ScriptObject::DoCommand(0, 0, cmf, CMD_SET_COMPANY_MANAGER_FACE);
 }
 
-/* static */ AICompany::Gender AICompany::GetPresidentGender(CompanyID company)
+/* static */ ScriptCompany::Gender ScriptCompany::GetPresidentGender(CompanyID company)
 {
 	company = ResolveCompanyID(company);
 	if (company == COMPANY_INVALID) return GENDER_INVALID;
@@ -101,7 +101,7 @@
 	return HasBit(ge, ::GENDER_FEMALE) ? GENDER_FEMALE : GENDER_MALE;
 }
 
-/* static */ Money AICompany::GetQuarterlyIncome(AICompany::CompanyID company, uint32 quarter)
+/* static */ Money ScriptCompany::GetQuarterlyIncome(ScriptCompany::CompanyID company, uint32 quarter)
 {
 	company = ResolveCompanyID(company);
 	if (company == COMPANY_INVALID) return -1;
@@ -113,7 +113,7 @@
 	return ::Company::Get((::CompanyID)company)->old_economy[quarter - 1].income;
 }
 
-/* static */ Money AICompany::GetQuarterlyExpenses(AICompany::CompanyID company, uint32 quarter)
+/* static */ Money ScriptCompany::GetQuarterlyExpenses(ScriptCompany::CompanyID company, uint32 quarter)
 {
 	company = ResolveCompanyID(company);
 	if (company == COMPANY_INVALID) return -1;
@@ -125,7 +125,7 @@
 	return ::Company::Get((::CompanyID)company)->old_economy[quarter - 1].expenses;
 }
 
-/* static */ int32 AICompany::GetQuarterlyCargoDelivered(AICompany::CompanyID company, uint32 quarter)
+/* static */ int32 ScriptCompany::GetQuarterlyCargoDelivered(ScriptCompany::CompanyID company, uint32 quarter)
 {
 	company = ResolveCompanyID(company);
 	if (company == COMPANY_INVALID) return -1;
@@ -137,7 +137,7 @@
 	return ::Company::Get((::CompanyID)company)->old_economy[quarter - 1].delivered_cargo;
 }
 
-/* static */ int32 AICompany::GetQuarterlyPerformanceRating(AICompany::CompanyID company, uint32 quarter)
+/* static */ int32 ScriptCompany::GetQuarterlyPerformanceRating(ScriptCompany::CompanyID company, uint32 quarter)
 {
 	company = ResolveCompanyID(company);
 	if (company == COMPANY_INVALID) return -1;
@@ -147,7 +147,7 @@
 	return ::Company::Get((::CompanyID)company)->old_economy[quarter - 1].performance_history;
 }
 
-/* static */ Money AICompany::GetQuarterlyCompanyValue(AICompany::CompanyID company, uint32 quarter)
+/* static */ Money ScriptCompany::GetQuarterlyCompanyValue(ScriptCompany::CompanyID company, uint32 quarter)
 {
 	company = ResolveCompanyID(company);
 	if (company == COMPANY_INVALID) return -1;
@@ -160,7 +160,7 @@
 }
 
 
-/* static */ Money AICompany::GetBankBalance(AICompany::CompanyID company)
+/* static */ Money ScriptCompany::GetBankBalance(ScriptCompany::CompanyID company)
 {
 	company = ResolveCompanyID(company);
 	if (company == COMPANY_INVALID) return -1;
@@ -168,22 +168,22 @@
 	return ::Company::Get((CompanyID)company)->money;
 }
 
-/* static */ Money AICompany::GetLoanAmount()
+/* static */ Money ScriptCompany::GetLoanAmount()
 {
 	return ::Company::Get(_current_company)->current_loan;
 }
 
-/* static */ Money AICompany::GetMaxLoanAmount()
+/* static */ Money ScriptCompany::GetMaxLoanAmount()
 {
 	return _economy.max_loan;
 }
 
-/* static */ Money AICompany::GetLoanInterval()
+/* static */ Money ScriptCompany::GetLoanInterval()
 {
 	return LOAN_INTERVAL;
 }
 
-/* static */ bool AICompany::SetLoanAmount(int32 loan)
+/* static */ bool ScriptCompany::SetLoanAmount(int32 loan)
 {
 	EnforcePrecondition(false, loan >= 0);
 	EnforcePrecondition(false, (loan % GetLoanInterval()) == 0);
@@ -192,12 +192,12 @@
 
 	if (loan == GetLoanAmount()) return true;
 
-	return AIObject::DoCommand(0,
+	return ScriptObject::DoCommand(0,
 			abs(loan - GetLoanAmount()), 2,
 			(loan > GetLoanAmount()) ? CMD_INCREASE_LOAN : CMD_DECREASE_LOAN);
 }
 
-/* static */ bool AICompany::SetMinimumLoanAmount(int32 loan)
+/* static */ bool ScriptCompany::SetMinimumLoanAmount(int32 loan)
 {
 	EnforcePrecondition(false, loan >= 0);
 
@@ -211,14 +211,14 @@
 	return GetLoanAmount() == loan;
 }
 
-/* static */ bool AICompany::BuildCompanyHQ(TileIndex tile)
+/* static */ bool ScriptCompany::BuildCompanyHQ(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 
-	return AIObject::DoCommand(tile, OBJECT_HQ, 0, CMD_BUILD_OBJECT);
+	return ScriptObject::DoCommand(tile, OBJECT_HQ, 0, CMD_BUILD_OBJECT);
 }
 
-/* static */ TileIndex AICompany::GetCompanyHQ(CompanyID company)
+/* static */ TileIndex ScriptCompany::GetCompanyHQ(CompanyID company)
 {
 	company = ResolveCompanyID(company);
 	if (company == COMPANY_INVALID) return INVALID_TILE;
@@ -227,12 +227,12 @@
 	return (loc == 0) ? INVALID_TILE : loc;
 }
 
-/* static */ bool AICompany::SetAutoRenewStatus(bool autorenew)
+/* static */ bool ScriptCompany::SetAutoRenewStatus(bool autorenew)
 {
-	return AIObject::DoCommand(0, ::GetCompanySettingIndex("company.engine_renew"), autorenew ? 1 : 0, CMD_CHANGE_COMPANY_SETTING);
+	return ScriptObject::DoCommand(0, ::GetCompanySettingIndex("company.engine_renew"), autorenew ? 1 : 0, CMD_CHANGE_COMPANY_SETTING);
 }
 
-/* static */ bool AICompany::GetAutoRenewStatus(CompanyID company)
+/* static */ bool ScriptCompany::GetAutoRenewStatus(CompanyID company)
 {
 	company = ResolveCompanyID(company);
 	if (company == COMPANY_INVALID) return false;
@@ -240,12 +240,12 @@
 	return ::Company::Get((CompanyID)company)->settings.engine_renew;
 }
 
-/* static */ bool AICompany::SetAutoRenewMonths(int16 months)
+/* static */ bool ScriptCompany::SetAutoRenewMonths(int16 months)
 {
-	return AIObject::DoCommand(0, ::GetCompanySettingIndex("company.engine_renew_months"), months, CMD_CHANGE_COMPANY_SETTING);
+	return ScriptObject::DoCommand(0, ::GetCompanySettingIndex("company.engine_renew_months"), months, CMD_CHANGE_COMPANY_SETTING);
 }
 
-/* static */ int16 AICompany::GetAutoRenewMonths(CompanyID company)
+/* static */ int16 ScriptCompany::GetAutoRenewMonths(CompanyID company)
 {
 	company = ResolveCompanyID(company);
 	if (company == COMPANY_INVALID) return 0;
@@ -253,12 +253,12 @@
 	return ::Company::Get((CompanyID)company)->settings.engine_renew_months;
 }
 
-/* static */ bool AICompany::SetAutoRenewMoney(uint32 money)
+/* static */ bool ScriptCompany::SetAutoRenewMoney(uint32 money)
 {
-	return AIObject::DoCommand(0, ::GetCompanySettingIndex("company.engine_renew_money"), money, CMD_CHANGE_COMPANY_SETTING);
+	return ScriptObject::DoCommand(0, ::GetCompanySettingIndex("company.engine_renew_money"), money, CMD_CHANGE_COMPANY_SETTING);
 }
 
-/* static */ uint32 AICompany::GetAutoRenewMoney(CompanyID company)
+/* static */ uint32 ScriptCompany::GetAutoRenewMoney(CompanyID company)
 {
 	company = ResolveCompanyID(company);
 	if (company == COMPANY_INVALID) return 0;
--- a/src/script/api/script_company.hpp
+++ b/src/script/api/script_company.hpp
@@ -17,7 +17,7 @@
 /**
  * Class that handles all company related functions.
  */
-class AICompany : public AIObject {
+class ScriptCompany : public ScriptObject {
 public:
 	/** The range of possible quarters to get company information of. */
 	enum Quarter {
@@ -62,7 +62,7 @@
 	 * @param name The new name of the company.
 	 * @pre 'name' must have at least one character.
 	 * @pre 'name' must have at most 30 characters.
-	 * @exception AIError::ERR_NAME_IS_NOT_UNIQUE
+	 * @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
 	 * @return True if the name was changed.
 	 */
 	static bool SetName(const char *name);
@@ -79,7 +79,7 @@
 	 * Set the name of your president.
 	 * @param name The new name of the president.
 	 * @pre 'name' must have at least one character.
-	 * @exception AIError::ERR_NAME_IS_NOT_UNIQUE
+	 * @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
 	 * @return True if the name was changed.
 	 */
 	static bool SetPresidentName(const char *name);
@@ -95,7 +95,7 @@
 	/**
 	 * Set the gender of the president of your company.
 	 * @param gender The new gender for your president.
-	 * @pre GetPresidentGender(AICompany.COMPANY_SELF) != gender.
+	 * @pre GetPresidentGender(ScriptCompany.COMPANY_SELF) != gender.
 	 * @return True if the gender was changed.
 	 * @note When successful a random face will be created.
 	 */
@@ -212,9 +212,9 @@
 	/**
 	 * Build your company's HQ on the given tile.
 	 * @param tile The tile to build your HQ on, this tile is the most nothern tile of your HQ.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_FLAT_LAND_REQUIRED
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_FLAT_LAND_REQUIRED
 	 * @return True if the HQ could be build.
 	 * @note An HQ can not be removed, only by water or rebuilding; If an HQ is
 	 *  build again, the old one is removed.
@@ -226,7 +226,7 @@
 	 * @param company The company the get the HQ of.
 	 * @pre ResolveCompanyID(company) != COMPANY_INVALID.
 	 * @return The tile of the company's HQ, this tile is the most nothern tile
-	 *  of that HQ, or AIMap::TILE_INVALID if there is no HQ yet.
+	 *  of that HQ, or ScriptMap::TILE_INVALID if there is no HQ yet.
 	 */
 	static TileIndex GetCompanyHQ(CompanyID company);
 
@@ -276,6 +276,6 @@
 	static uint32 GetAutoRenewMoney(CompanyID company);
 };
 
-DECLARE_POSTFIX_INCREMENT(AICompany::CompanyID)
+DECLARE_POSTFIX_INCREMENT(ScriptCompany::CompanyID)
 
 #endif /* SCRIPT_COMPANY_HPP */
--- a/src/script/api/script_controller.cpp
+++ b/src/script/api/script_controller.cpp
@@ -22,38 +22,38 @@
 #include "../../ai/ai.hpp"
 #include "script_log.hpp"
 
-/* static */ void AIController::SetCommandDelay(int ticks)
+/* static */ void ScriptController::SetCommandDelay(int ticks)
 {
 	if (ticks <= 0) return;
-	AIObject::SetDoCommandDelay(ticks);
+	ScriptObject::SetDoCommandDelay(ticks);
 }
 
-/* static */ void AIController::Sleep(int ticks)
+/* static */ void ScriptController::Sleep(int ticks)
 {
-	if (!AIObject::CanSuspend()) {
+	if (!ScriptObject::CanSuspend()) {
 		throw AI_FatalError("You are not allowed to call Sleep in your constructor, Save(), Load(), and any valuator.");
 	}
 
 	if (ticks <= 0) {
-		AILog::Warning("Sleep() value should be > 0. Assuming value 1.");
+		ScriptLog::Warning("Sleep() value should be > 0. Assuming value 1.");
 		ticks = 1;
 	}
 
 	throw AI_VMSuspend(ticks, NULL);
 }
 
-/* static */ void AIController::Print(bool error_msg, const char *message)
+/* static */ void ScriptController::Print(bool error_msg, const char *message)
 {
-	AILog::Log(error_msg ? AILog::LOG_SQ_ERROR : AILog::LOG_SQ_INFO, message);
+	ScriptLog::Log(error_msg ? ScriptLog::LOG_SQ_ERROR : ScriptLog::LOG_SQ_INFO, message);
 }
 
-AIController::AIController() :
+ScriptController::ScriptController() :
 	ticks(0),
 	loaded_library_count(0)
 {
 }
 
-AIController::~AIController()
+ScriptController::~ScriptController()
 {
 	for (LoadedLibraryList::iterator iter = this->loaded_library.begin(); iter != this->loaded_library.end(); iter++) {
 		free((*iter).second);
@@ -63,30 +63,30 @@
 	this->loaded_library.clear();
 }
 
-/* static */ uint AIController::GetTick()
+/* static */ uint ScriptController::GetTick()
 {
-	return AIObject::GetActiveInstance()->GetController()->ticks;
+	return ScriptObject::GetActiveInstance()->GetController()->ticks;
 }
 
-/* static */ int AIController::GetOpsTillSuspend()
+/* static */ int ScriptController::GetOpsTillSuspend()
 {
-	return AIObject::GetActiveInstance()->GetOpsTillSuspend();
+	return ScriptObject::GetActiveInstance()->GetOpsTillSuspend();
 }
 
-/* static */ int AIController::GetSetting(const char *name)
+/* static */ int ScriptController::GetSetting(const char *name)
 {
 	return AIConfig::GetConfig(_current_company)->GetSetting(name);
 }
 
-/* static */ uint AIController::GetVersion()
+/* static */ uint ScriptController::GetVersion()
 {
 	return _openttd_newgrf_version;
 }
 
-/* static */ HSQOBJECT AIController::Import(const char *library, const char *class_name, int version)
+/* static */ HSQOBJECT ScriptController::Import(const char *library, const char *class_name, int version)
 {
-	AIController *controller = AIObject::GetActiveInstance()->GetController();
-	Squirrel *engine = AIObject::GetActiveInstance()->engine;
+	ScriptController *controller = ScriptObject::GetActiveInstance()->GetController();
+	Squirrel *engine = ScriptObject::GetActiveInstance()->engine;
 	HSQUIRRELVM vm = engine->GetVM();
 
 	/* Internally we store libraries as 'library.version' */
--- a/src/script/api/script_controller.hpp
+++ b/src/script/api/script_controller.hpp
@@ -16,23 +16,24 @@
 #include <map>
 
 /**
- * The Controller, the class each AI should extend. It creates the AI, makes
- *  sure the logic kicks in correctly, and that GetTick() has a valid value.
+ * The Controller, the class each Script should extend. It creates the Script,
+ *  makes sure the logic kicks in correctly, and that GetTick() has a valid
+ *  value.
  */
-class AIController {
+class ScriptController {
 	friend class AIScanner;
 	friend class AIInstance;
 
 public:
 	/**
-	 * Initializer of the AIController.
+	 * Initializer of the ScriptController.
 	 */
-	AIController();
+	ScriptController();
 
 	/**
-	 * Destructor of the AIController.
+	 * Destructor of the ScriptController.
 	 */
-	~AIController();
+	~ScriptController();
 
 	/**
 	 * This function is called to start your AI. Your AI starts here. If you
@@ -105,7 +106,7 @@
 	 *  Squirrel calls this when 'print' is used, or when the script made an error.
 	 * @param error_msg If true, it is a Squirrel error message.
 	 * @param message The message Squirrel logged.
-	 * @note Use AILog.Info/Warning/Error instead of 'print'.
+	 * @note Use ScriptLog.Info/Warning/Error instead of 'print'.
 	 */
 	static void Print(bool error_msg, const char *message);
 
--- a/src/script/api/script_date.cpp
+++ b/src/script/api/script_date.cpp
@@ -7,18 +7,18 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_date.cpp Implementation of AIDate. */
+/** @file script_date.cpp Implementation of ScriptDate. */
 
 #include "../../stdafx.h"
 #include "script_date.hpp"
 #include "../../date_func.h"
 
-/* static */ int32 AIDate::GetCurrentDate()
+/* static */ int32 ScriptDate::GetCurrentDate()
 {
 	return ::_date;
 }
 
-/* static */ int32 AIDate::GetYear(int32 date)
+/* static */ int32 ScriptDate::GetYear(int32 date)
 {
 	if (date < 0) return -1;
 
@@ -27,7 +27,7 @@
 	return ymd.year;
 }
 
-/* static */ int32 AIDate::GetMonth(int32 date)
+/* static */ int32 ScriptDate::GetMonth(int32 date)
 {
 	if (date < 0) return -1;
 
@@ -36,7 +36,7 @@
 	return ymd.month + 1;
 }
 
-/* static */ int32 AIDate::GetDayOfMonth(int32 date)
+/* static */ int32 ScriptDate::GetDayOfMonth(int32 date)
 {
 	if (date < 0) return -1;
 
@@ -45,7 +45,7 @@
 	return ymd.day;
 }
 
-/* static */ int32 AIDate::GetDate(int32 year, int32 month, int32 day_of_month)
+/* static */ int32 ScriptDate::GetDate(int32 year, int32 month, int32 day_of_month)
 {
 	if (month < 1 || month > 12) return -1;
 	if (day_of_month < 1 || day_of_month > 31) return -1;
--- a/src/script/api/script_date.hpp
+++ b/src/script/api/script_date.hpp
@@ -24,7 +24,7 @@
  *       two different moments in time because they count the number
  *       of days since the year 0.
  */
-class AIDate : public AIObject {
+class ScriptDate : public ScriptObject {
 public:
 	/**
 	 * Get the current date.
--- a/src/script/api/script_depotlist.cpp
+++ b/src/script/api/script_depotlist.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_depotlist.cpp Implementation of AIDepotList and friends. */
+/** @file script_depotlist.cpp Implementation of ScriptDepotList and friends. */
 
 #include "../../stdafx.h"
 #include "script_depotlist.hpp"
@@ -15,17 +15,17 @@
 #include "../../depot_base.h"
 #include "../../station_base.h"
 
-AIDepotList::AIDepotList(AITile::TransportType transport_type)
+ScriptDepotList::ScriptDepotList(ScriptTile::TransportType transport_type)
 {
 	::TileType tile_type;
 	switch (transport_type) {
 		default: return;
 
-		case AITile::TRANSPORT_ROAD:  tile_type = ::MP_ROAD; break;
-		case AITile::TRANSPORT_RAIL:  tile_type = ::MP_RAILWAY; break;
-		case AITile::TRANSPORT_WATER: tile_type = ::MP_WATER; break;
+		case ScriptTile::TRANSPORT_ROAD:  tile_type = ::MP_ROAD; break;
+		case ScriptTile::TRANSPORT_RAIL:  tile_type = ::MP_RAILWAY; break;
+		case ScriptTile::TRANSPORT_WATER: tile_type = ::MP_WATER; break;
 
-		case AITile::TRANSPORT_AIR: {
+		case ScriptTile::TRANSPORT_AIR: {
 			/* Hangars are not seen as real depots by the depot code. */
 			const Station *st;
 			FOR_ALL_STATIONS(st) {
--- a/src/script/api/script_depotlist.hpp
+++ b/src/script/api/script_depotlist.hpp
@@ -17,14 +17,14 @@
 
 /**
  * Creates a list of the locations of the depots (and hangars) of which you are the owner.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIDepotList : public AIList {
+class ScriptDepotList : public ScriptList {
 public:
 	/**
 	 * @param transport_type The type of transport to make a list of depots for.
 	 */
-	AIDepotList(AITile::TransportType transport_type);
+	ScriptDepotList(ScriptTile::TransportType transport_type);
 };
 
 #endif /* SCRIPT_DEPOTLIST_HPP */
--- a/src/script/api/script_engine.cpp
+++ b/src/script/api/script_engine.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_engine.cpp Implementation of AIEngine. */
+/** @file script_engine.cpp Implementation of ScriptEngine. */
 
 #include "../../stdafx.h"
 #include "script_engine.hpp"
@@ -21,19 +21,19 @@
 #include "../../articulated_vehicles.h"
 #include "table/strings.h"
 
-/* static */ bool AIEngine::IsValidEngine(EngineID engine_id)
+/* static */ bool ScriptEngine::IsValidEngine(EngineID engine_id)
 {
 	const Engine *e = ::Engine::GetIfValid(engine_id);
 	return e != NULL && (::IsEngineBuildable(engine_id, e->type, _current_company) || ::Company::Get(_current_company)->group_all[e->type].num_engines[engine_id] > 0);
 }
 
-/* static */ bool AIEngine::IsBuildable(EngineID engine_id)
+/* static */ bool ScriptEngine::IsBuildable(EngineID engine_id)
 {
 	const Engine *e = ::Engine::GetIfValid(engine_id);
 	return e != NULL && ::IsEngineBuildable(engine_id, e->type, _current_company);
 }
 
-/* static */ char *AIEngine::GetName(EngineID engine_id)
+/* static */ char *ScriptEngine::GetName(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return NULL;
 
@@ -45,7 +45,7 @@
 	return engine_name;
 }
 
-/* static */ CargoID AIEngine::GetCargoType(EngineID engine_id)
+/* static */ CargoID ScriptEngine::GetCargoType(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return CT_INVALID;
 
@@ -63,25 +63,25 @@
 	return most_cargo;
 }
 
-/* static */ bool AIEngine::CanRefitCargo(EngineID engine_id, CargoID cargo_id)
+/* static */ bool ScriptEngine::CanRefitCargo(EngineID engine_id, CargoID cargo_id)
 {
 	if (!IsValidEngine(engine_id)) return false;
-	if (!AICargo::IsValidCargo(cargo_id)) return false;
+	if (!ScriptCargo::IsValidCargo(cargo_id)) return false;
 
 	return HasBit(::GetUnionOfArticulatedRefitMasks(engine_id, true), cargo_id);
 }
 
-/* static */ bool AIEngine::CanPullCargo(EngineID engine_id, CargoID cargo_id)
+/* static */ bool ScriptEngine::CanPullCargo(EngineID engine_id, CargoID cargo_id)
 {
 	if (!IsValidEngine(engine_id)) return false;
-	if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL) return false;
-	if (!AICargo::IsValidCargo(cargo_id)) return false;
+	if (GetVehicleType(engine_id) != ScriptVehicle::VT_RAIL) return false;
+	if (!ScriptCargo::IsValidCargo(cargo_id)) return false;
 
-	return (::RailVehInfo(engine_id)->ai_passenger_only != 1) || AICargo::HasCargoClass(cargo_id, AICargo::CC_PASSENGERS);
+	return (::RailVehInfo(engine_id)->ai_passenger_only != 1) || ScriptCargo::HasCargoClass(cargo_id, ScriptCargo::CC_PASSENGERS);
 }
 
 
-/* static */ int32 AIEngine::GetCapacity(EngineID engine_id)
+/* static */ int32 ScriptEngine::GetCapacity(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return -1;
 
@@ -105,15 +105,15 @@
 	}
 }
 
-/* static */ int32 AIEngine::GetReliability(EngineID engine_id)
+/* static */ int32 ScriptEngine::GetReliability(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return -1;
-	if (GetVehicleType(engine_id) == AIVehicle::VT_RAIL && IsWagon(engine_id)) return -1;
+	if (GetVehicleType(engine_id) == ScriptVehicle::VT_RAIL && IsWagon(engine_id)) return -1;
 
 	return ::ToPercent16(::Engine::Get(engine_id)->reliability);
 }
 
-/* static */ int32 AIEngine::GetMaxSpeed(EngineID engine_id)
+/* static */ int32 ScriptEngine::GetMaxSpeed(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return -1;
 
@@ -123,128 +123,128 @@
 	return max_speed;
 }
 
-/* static */ Money AIEngine::GetPrice(EngineID engine_id)
+/* static */ Money ScriptEngine::GetPrice(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return -1;
 
 	return ::Engine::Get(engine_id)->GetCost();
 }
 
-/* static */ int32 AIEngine::GetMaxAge(EngineID engine_id)
+/* static */ int32 ScriptEngine::GetMaxAge(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return -1;
-	if (GetVehicleType(engine_id) == AIVehicle::VT_RAIL && IsWagon(engine_id)) return -1;
+	if (GetVehicleType(engine_id) == ScriptVehicle::VT_RAIL && IsWagon(engine_id)) return -1;
 
 	return ::Engine::Get(engine_id)->GetLifeLengthInDays();
 }
 
-/* static */ Money AIEngine::GetRunningCost(EngineID engine_id)
+/* static */ Money ScriptEngine::GetRunningCost(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return -1;
 
 	return ::Engine::Get(engine_id)->GetRunningCost();
 }
 
-/* static */ int32 AIEngine::GetPower(EngineID engine_id)
+/* static */ int32 ScriptEngine::GetPower(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return -1;
-	if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL && GetVehicleType(engine_id) != AIVehicle::VT_ROAD) return -1;
+	if (GetVehicleType(engine_id) != ScriptVehicle::VT_RAIL && GetVehicleType(engine_id) != ScriptVehicle::VT_ROAD) return -1;
 	if (IsWagon(engine_id)) return -1;
 
 	return ::Engine::Get(engine_id)->GetPower();
 }
 
-/* static */ int32 AIEngine::GetWeight(EngineID engine_id)
+/* static */ int32 ScriptEngine::GetWeight(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return -1;
-	if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL && GetVehicleType(engine_id) != AIVehicle::VT_ROAD) return -1;
+	if (GetVehicleType(engine_id) != ScriptVehicle::VT_RAIL && GetVehicleType(engine_id) != ScriptVehicle::VT_ROAD) return -1;
 
 	return ::Engine::Get(engine_id)->GetDisplayWeight();
 }
 
-/* static */ int32 AIEngine::GetMaxTractiveEffort(EngineID engine_id)
+/* static */ int32 ScriptEngine::GetMaxTractiveEffort(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return -1;
-	if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL && GetVehicleType(engine_id) != AIVehicle::VT_ROAD) return -1;
+	if (GetVehicleType(engine_id) != ScriptVehicle::VT_RAIL && GetVehicleType(engine_id) != ScriptVehicle::VT_ROAD) return -1;
 	if (IsWagon(engine_id)) return -1;
 
 	return ::Engine::Get(engine_id)->GetDisplayMaxTractiveEffort();
 }
 
-/* static */ int32 AIEngine::GetDesignDate(EngineID engine_id)
+/* static */ int32 ScriptEngine::GetDesignDate(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return -1;
 
 	return ::Engine::Get(engine_id)->intro_date;
 }
 
-/* static */ AIVehicle::VehicleType AIEngine::GetVehicleType(EngineID engine_id)
+/* static */ ScriptVehicle::VehicleType ScriptEngine::GetVehicleType(EngineID engine_id)
 {
-	if (!IsValidEngine(engine_id)) return AIVehicle::VT_INVALID;
+	if (!IsValidEngine(engine_id)) return ScriptVehicle::VT_INVALID;
 
 	switch (::Engine::Get(engine_id)->type) {
-		case VEH_ROAD:     return AIVehicle::VT_ROAD;
-		case VEH_TRAIN:    return AIVehicle::VT_RAIL;
-		case VEH_SHIP:     return AIVehicle::VT_WATER;
-		case VEH_AIRCRAFT: return AIVehicle::VT_AIR;
+		case VEH_ROAD:     return ScriptVehicle::VT_ROAD;
+		case VEH_TRAIN:    return ScriptVehicle::VT_RAIL;
+		case VEH_SHIP:     return ScriptVehicle::VT_WATER;
+		case VEH_AIRCRAFT: return ScriptVehicle::VT_AIR;
 		default: NOT_REACHED();
 	}
 }
 
-/* static */ bool AIEngine::IsWagon(EngineID engine_id)
+/* static */ bool ScriptEngine::IsWagon(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return false;
-	if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL) return false;
+	if (GetVehicleType(engine_id) != ScriptVehicle::VT_RAIL) return false;
 
 	return ::RailVehInfo(engine_id)->power == 0;
 }
 
-/* static */ bool AIEngine::CanRunOnRail(EngineID engine_id, AIRail::RailType track_rail_type)
+/* static */ bool ScriptEngine::CanRunOnRail(EngineID engine_id, ScriptRail::RailType track_rail_type)
 {
 	if (!IsValidEngine(engine_id)) return false;
-	if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL) return false;
-	if (!AIRail::IsRailTypeAvailable(track_rail_type)) return false;
+	if (GetVehicleType(engine_id) != ScriptVehicle::VT_RAIL) return false;
+	if (!ScriptRail::IsRailTypeAvailable(track_rail_type)) return false;
 
 	return ::IsCompatibleRail((::RailType)::RailVehInfo(engine_id)->railtype, (::RailType)track_rail_type);
 }
 
-/* static */ bool AIEngine::HasPowerOnRail(EngineID engine_id, AIRail::RailType track_rail_type)
+/* static */ bool ScriptEngine::HasPowerOnRail(EngineID engine_id, ScriptRail::RailType track_rail_type)
 {
 	if (!IsValidEngine(engine_id)) return false;
-	if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL) return false;
-	if (!AIRail::IsRailTypeAvailable(track_rail_type)) return false;
+	if (GetVehicleType(engine_id) != ScriptVehicle::VT_RAIL) return false;
+	if (!ScriptRail::IsRailTypeAvailable(track_rail_type)) return false;
 
 	return ::HasPowerOnRail((::RailType)::RailVehInfo(engine_id)->railtype, (::RailType)track_rail_type);
 }
 
-/* static */ AIRoad::RoadType AIEngine::GetRoadType(EngineID engine_id)
+/* static */ ScriptRoad::RoadType ScriptEngine::GetRoadType(EngineID engine_id)
 {
-	if (!IsValidEngine(engine_id)) return AIRoad::ROADTYPE_INVALID;
-	if (GetVehicleType(engine_id) != AIVehicle::VT_ROAD) return AIRoad::ROADTYPE_INVALID;
+	if (!IsValidEngine(engine_id)) return ScriptRoad::ROADTYPE_INVALID;
+	if (GetVehicleType(engine_id) != ScriptVehicle::VT_ROAD) return ScriptRoad::ROADTYPE_INVALID;
 
-	return HasBit(::EngInfo(engine_id)->misc_flags, EF_ROAD_TRAM) ? AIRoad::ROADTYPE_TRAM : AIRoad::ROADTYPE_ROAD;
+	return HasBit(::EngInfo(engine_id)->misc_flags, EF_ROAD_TRAM) ? ScriptRoad::ROADTYPE_TRAM : ScriptRoad::ROADTYPE_ROAD;
 }
 
-/* static */ AIRail::RailType AIEngine::GetRailType(EngineID engine_id)
+/* static */ ScriptRail::RailType ScriptEngine::GetRailType(EngineID engine_id)
 {
-	if (!IsValidEngine(engine_id)) return AIRail::RAILTYPE_INVALID;
-	if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL) return AIRail::RAILTYPE_INVALID;
+	if (!IsValidEngine(engine_id)) return ScriptRail::RAILTYPE_INVALID;
+	if (GetVehicleType(engine_id) != ScriptVehicle::VT_RAIL) return ScriptRail::RAILTYPE_INVALID;
 
-	return (AIRail::RailType)(uint)::RailVehInfo(engine_id)->railtype;
+	return (ScriptRail::RailType)(uint)::RailVehInfo(engine_id)->railtype;
 }
 
-/* static */ bool AIEngine::IsArticulated(EngineID engine_id)
+/* static */ bool ScriptEngine::IsArticulated(EngineID engine_id)
 {
 	if (!IsValidEngine(engine_id)) return false;
-	if (GetVehicleType(engine_id) != AIVehicle::VT_ROAD && GetVehicleType(engine_id) != AIVehicle::VT_RAIL) return false;
+	if (GetVehicleType(engine_id) != ScriptVehicle::VT_ROAD && GetVehicleType(engine_id) != ScriptVehicle::VT_RAIL) return false;
 
 	return CountArticulatedParts(engine_id, true) != 0;
 }
 
-/* static */ AIAirport::PlaneType AIEngine::GetPlaneType(EngineID engine_id)
+/* static */ ScriptAirport::PlaneType ScriptEngine::GetPlaneType(EngineID engine_id)
 {
-	if (!IsValidEngine(engine_id)) return AIAirport::PT_INVALID;
-	if (GetVehicleType(engine_id) != AIVehicle::VT_AIR) return AIAirport::PT_INVALID;
+	if (!IsValidEngine(engine_id)) return ScriptAirport::PT_INVALID;
+	if (GetVehicleType(engine_id) != ScriptVehicle::VT_AIR) return ScriptAirport::PT_INVALID;
 
-	return (AIAirport::PlaneType)::AircraftVehInfo(engine_id)->subtype;
+	return (ScriptAirport::PlaneType)::AircraftVehInfo(engine_id)->subtype;
 }
--- a/src/script/api/script_engine.hpp
+++ b/src/script/api/script_engine.hpp
@@ -19,7 +19,7 @@
 /**
  * Class that handles all engine related functions.
  */
-class AIEngine : public AIObject {
+class ScriptEngine : public ScriptObject {
 public:
 	/**
 	 * Checks whether the given engine type is valid. An engine is valid if you
@@ -61,7 +61,7 @@
 	 * @param engine_id The engine to check for refitting.
 	 * @param cargo_id The cargo to check for refitting.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre AICargo::IsValidCargo(cargo_id).
+	 * @pre ScriptCargo::IsValidCargo(cargo_id).
 	 * @return True if the engine can carry this cargo, either via refit, or
 	 *  by default.
 	 */
@@ -72,8 +72,8 @@
 	 * @param engine_id The engine to check.
 	 * @param cargo_id The cargo to check.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre GetVehicleType(engine_id) == AIVehicle::VT_RAIL.
-	 * @pre AICargo::IsValidCargo(cargo_id).
+	 * @pre GetVehicleType(engine_id) == ScriptVehicle::VT_RAIL.
+	 * @pre ScriptCargo::IsValidCargo(cargo_id).
 	 * @return True if the engine can pull wagons carrying this cargo.
 	 * @note This function is not exhaustive; a true here does not mean
 	 *  that the vehicle can pull the wagons, a false does mean it can't.
@@ -95,7 +95,7 @@
 	 *  reliability (you most likely don't want to buy it).
 	 * @param engine_id The engine to get the reliability of.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre GetVehicleType(engine_id) != AIVehicle::VT_TRAIN || !IsWagon(engine_id).
+	 * @pre GetVehicleType(engine_id) != ScriptVehicle::VT_TRAIN || !IsWagon(engine_id).
 	 * @return The reliability the engine has.
 	 */
 	static int32 GetReliability(EngineID engine_id);
@@ -104,7 +104,7 @@
 	 * Get the maximum speed of an engine.
 	 * @param engine_id The engine to get the maximum speed of.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre GetVehicleType(engine_id) != AIVehicle::VT_TRAIN || !IsWagon(engine_id).
+	 * @pre GetVehicleType(engine_id) != ScriptVehicle::VT_TRAIN || !IsWagon(engine_id).
 	 * @return The maximum speed the engine has.
 	 * @note The speed is in OpenTTD's internal speed unit.
 	 *       This is mph / 1.6, which is roughly km/h.
@@ -142,7 +142,7 @@
 	 * Get the power of an engine.
 	 * @param engine_id The engine to get the power of.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre (GetVehicleType(engine_id) == AIVehicle::VT_RAIL || GetVehicleType(engine_id) == AIVehicle::VT_ROAD) && !IsWagon(engine_id).
+	 * @pre (GetVehicleType(engine_id) == ScriptVehicle::VT_RAIL || GetVehicleType(engine_id) == ScriptVehicle::VT_ROAD) && !IsWagon(engine_id).
 	 * @return The power of the engine in hp.
 	 */
 	static int32 GetPower(EngineID engine_id);
@@ -151,7 +151,7 @@
 	 * Get the weight of an engine.
 	 * @param engine_id The engine to get the weight of.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre (GetVehicleType(engine_id) == AIVehicle::VT_RAIL || GetVehicleType(engine_id) == AIVehicle::VT_ROAD).
+	 * @pre (GetVehicleType(engine_id) == ScriptVehicle::VT_RAIL || GetVehicleType(engine_id) == ScriptVehicle::VT_ROAD).
 	 * @return The weight of the engine in metric tons.
 	 */
 	static int32 GetWeight(EngineID engine_id);
@@ -160,7 +160,7 @@
 	 * Get the maximum tractive effort of an engine.
 	 * @param engine_id The engine to get the maximum tractive effort of.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre (GetVehicleType(engine_id) == AIVehicle::VT_RAIL || GetVehicleType(engine_id) == AIVehicle::VT_ROAD) && !IsWagon(engine_id).
+	 * @pre (GetVehicleType(engine_id) == ScriptVehicle::VT_RAIL || GetVehicleType(engine_id) == ScriptVehicle::VT_ROAD) && !IsWagon(engine_id).
 	 * @return The maximum tractive effort of the engine in kN.
 	 */
 	static int32 GetMaxTractiveEffort(EngineID engine_id);
@@ -179,13 +179,13 @@
 	 * @pre IsValidEngine(engine_id).
 	 * @return The type the engine has.
 	 */
-	static AIVehicle::VehicleType GetVehicleType(EngineID engine_id);
+	static ScriptVehicle::VehicleType GetVehicleType(EngineID engine_id);
 
 	/**
 	 * Check if an engine is a wagon.
 	 * @param engine_id The engine to check.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre GetVehicleType(engine_id) == AIVehicle::VT_RAIL.
+	 * @pre GetVehicleType(engine_id) == ScriptVehicle::VT_RAIL.
 	 * @return Whether or not the engine is a wagon.
 	 */
 	static bool IsWagon(EngineID engine_id);
@@ -195,48 +195,48 @@
 	 * @param engine_id The engine to check.
 	 * @param track_rail_type The type you want to check.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre GetVehicleType(engine_id) == AIVehicle::VT_RAIL.
-	 * @pre AIRail::IsRailTypeAvailable(track_rail_type).
+	 * @pre GetVehicleType(engine_id) == ScriptVehicle::VT_RAIL.
+	 * @pre ScriptRail::IsRailTypeAvailable(track_rail_type).
 	 * @return Whether an engine of type 'engine_id' can run on 'track_rail_type'.
 	 * @note Even if a train can run on a RailType that doesn't mean that it'll be
 	 *   able to power the train. Use HasPowerOnRail for that.
 	 */
-	static bool CanRunOnRail(EngineID engine_id, AIRail::RailType track_rail_type);
+	static bool CanRunOnRail(EngineID engine_id, ScriptRail::RailType track_rail_type);
 
 	/**
 	 * Check if a train engine has power on a RailType.
 	 * @param engine_id The engine to check.
 	 * @param track_rail_type Another RailType.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre GetVehicleType(engine_id) == AIVehicle::VT_RAIL.
-	 * @pre AIRail::IsRailTypeAvailable(track_rail_type).
+	 * @pre GetVehicleType(engine_id) == ScriptVehicle::VT_RAIL.
+	 * @pre ScriptRail::IsRailTypeAvailable(track_rail_type).
 	 * @return Whether an engine of type 'engine_id' has power on 'track_rail_type'.
 	 */
-	static bool HasPowerOnRail(EngineID engine_id, AIRail::RailType track_rail_type);
+	static bool HasPowerOnRail(EngineID engine_id, ScriptRail::RailType track_rail_type);
 
 	/**
 	 * Get the RoadType of the engine.
 	 * @param engine_id The engine to get the RoadType of.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre GetVehicleType(engine_id) == AIVehicle::VT_ROAD.
+	 * @pre GetVehicleType(engine_id) == ScriptVehicle::VT_ROAD.
 	 * @return The RoadType the engine has.
 	 */
-	static AIRoad::RoadType GetRoadType(EngineID engine_id);
+	static ScriptRoad::RoadType GetRoadType(EngineID engine_id);
 
 	/**
 	 * Get the RailType of the engine.
 	 * @param engine_id The engine to get the RailType of.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre GetVehicleType(engine_id) == AIVehicle::VT_RAIL.
+	 * @pre GetVehicleType(engine_id) == ScriptVehicle::VT_RAIL.
 	 * @return The RailType the engine has.
 	 */
-	static AIRail::RailType GetRailType(EngineID engine_id);
+	static ScriptRail::RailType GetRailType(EngineID engine_id);
 
 	/**
 	 * Check if the engine is articulated.
 	 * @param engine_id The engine to check.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre GetVehicleType(engine_id) == AIVehicle::VT_ROAD || GetVehicleType(engine_id) == AIVehicle::VT_RAIL.
+	 * @pre GetVehicleType(engine_id) == ScriptVehicle::VT_ROAD || GetVehicleType(engine_id) == ScriptVehicle::VT_RAIL.
 	 * @return True if the engine is articulated.
 	 */
 	static bool IsArticulated(EngineID engine_id);
@@ -245,10 +245,10 @@
 	 * Get the PlaneType of the engine.
 	 * @param engine_id The engine to get the PlaneType of.
 	 * @pre IsValidEngine(engine_id).
-	 * @pre GetVehicleType(engine_id) == AIVehicle::VT_AIR.
+	 * @pre GetVehicleType(engine_id) == ScriptVehicle::VT_AIR.
 	 * @return The PlaneType the engine has.
 	 */
-	static AIAirport::PlaneType GetPlaneType(EngineID engine_id);
+	static ScriptAirport::PlaneType GetPlaneType(EngineID engine_id);
 };
 
 #endif /* SCRIPT_ENGINE_HPP */
--- a/src/script/api/script_enginelist.cpp
+++ b/src/script/api/script_enginelist.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_enginelist.cpp Implementation of AIEngineList and friends. */
+/** @file script_enginelist.cpp Implementation of ScriptEngineList and friends. */
 
 #include "../../stdafx.h"
 #include "script_enginelist.hpp"
@@ -15,7 +15,7 @@
 #include "../../engine_base.h"
 #include "../../core/bitmath_func.hpp"
 
-AIEngineList::AIEngineList(AIVehicle::VehicleType vehicle_type)
+ScriptEngineList::ScriptEngineList(ScriptVehicle::VehicleType vehicle_type)
 {
 	Engine *e;
 	FOR_ALL_ENGINES_OF_TYPE(e, (::VehicleType)vehicle_type) {
--- a/src/script/api/script_enginelist.hpp
+++ b/src/script/api/script_enginelist.hpp
@@ -17,14 +17,14 @@
 
 /**
  * Create a list of engines based on a vehicle type.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIEngineList : public AIList {
+class ScriptEngineList : public ScriptList {
 public:
 	/**
 	 * @param vehicle_type The type of vehicle to make a list of engines for.
 	 */
-	AIEngineList(AIVehicle::VehicleType vehicle_type);
+	ScriptEngineList(ScriptVehicle::VehicleType vehicle_type);
 };
 
 #endif /* SCRIPT_ENGINELIST_HPP */
--- a/src/script/api/script_error.cpp
+++ b/src/script/api/script_error.cpp
@@ -7,26 +7,26 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_error.cpp Implementation of AIError. */
+/** @file script_error.cpp Implementation of ScriptError. */
 
 #include "../../stdafx.h"
 #include "script_error.hpp"
 #include "../../core/bitmath_func.hpp"
 
-AIError::AIErrorMap AIError::error_map = AIError::AIErrorMap();
-AIError::AIErrorMapString AIError::error_map_string = AIError::AIErrorMapString();
+ScriptError::ScriptErrorMap ScriptError::error_map = ScriptError::ScriptErrorMap();
+ScriptError::ScriptErrorMapString ScriptError::error_map_string = ScriptError::ScriptErrorMapString();
 
-/* static */ AIErrorType AIError::GetLastError()
+/* static */ ScriptErrorType ScriptError::GetLastError()
 {
-	return AIObject::GetLastError();
+	return ScriptObject::GetLastError();
 }
 
-/* static */ char *AIError::GetLastErrorString()
+/* static */ char *ScriptError::GetLastErrorString()
 {
-	return strdup((*error_map_string.find(AIError::GetLastError())).second);
+	return strdup((*error_map_string.find(ScriptError::GetLastError())).second);
 }
 
-/* static */ AIErrorType AIError::StringToError(StringID internal_string_id)
+/* static */ ScriptErrorType ScriptError::StringToError(StringID internal_string_id)
 {
 	uint index = GB(internal_string_id, 11, 5);
 	switch (GB(internal_string_id, 11, 5)) {
@@ -47,22 +47,22 @@
 			break;
 	}
 
-	AIErrorMap::iterator it = error_map.find(internal_string_id);
+	ScriptErrorMap::iterator it = error_map.find(internal_string_id);
 	if (it == error_map.end()) return ERR_UNKNOWN;
 	return (*it).second;
 }
 
-/* static */ void AIError::RegisterErrorMap(StringID internal_string_id, AIErrorType ai_error_msg)
+/* static */ void ScriptError::RegisterErrorMap(StringID internal_string_id, ScriptErrorType ai_error_msg)
 {
 	error_map[internal_string_id] = ai_error_msg;
 }
 
-/* static */ void AIError::RegisterErrorMapString(AIErrorType ai_error_msg, const char *message)
+/* static */ void ScriptError::RegisterErrorMapString(ScriptErrorType ai_error_msg, const char *message)
 {
 	error_map_string[ai_error_msg] = message;
 }
 
-/* static */ AIError::ErrorCategories AIError::GetErrorCategory()
+/* static */ ScriptError::ErrorCategories ScriptError::GetErrorCategory()
 {
-	return (AIError::ErrorCategories)(GetLastError() >> (uint)ERR_CAT_BIT_SIZE);
+	return (ScriptError::ErrorCategories)(GetLastError() >> (uint)ERR_CAT_BIT_SIZE);
 }
--- a/src/script/api/script_error.hpp
+++ b/src/script/api/script_error.hpp
@@ -22,7 +22,7 @@
  */
 #define EnforcePrecondition(returnval, condition)               \
 	if (!(condition)) {                                           \
-		AIObject::SetLastError(AIError::ERR_PRECONDITION_FAILED);   \
+		ScriptObject::SetLastError(ScriptError::ERR_PRECONDITION_FAILED);   \
 		return returnval;                                           \
 	}
 
@@ -30,18 +30,18 @@
  * Helper to write precondition enforcers for the AI API in an abbreviated manner.
  * @param returnval The value to return on failure.
  * @param condition The condition that must be obeyed.
- * @param error_code The error code passed to AIObject::SetLastError.
+ * @param error_code The error code passed to ScriptObject::SetLastError.
  */
 #define EnforcePreconditionCustomError(returnval, condition, error_code)   \
 	if (!(condition)) {                                                      \
-		AIObject::SetLastError(error_code);                                    \
+		ScriptObject::SetLastError(error_code);                                    \
 		return returnval;                                                      \
 	}
 
 /**
  * Class that handles all error related functions.
  */
-class AIError : public AIObject {
+class ScriptError : public ScriptObject {
 public:
 	/**
 	 * All categories errors can be divided in.
@@ -134,7 +134,7 @@
 	 * Get the last error.
 	 * @return An ErrorMessages enum value.
 	 */
-	static AIErrorType GetLastError();
+	static ScriptErrorType GetLastError();
 
 	/**
 	 * Get the last error in string format (for human readability).
@@ -149,7 +149,7 @@
 	 * @param internal_string_id The string to convert.
 	 * @return The NoAI equivalent error message.
 	 */
-	static AIErrorType StringToError(StringID internal_string_id);
+	static ScriptErrorType StringToError(StringID internal_string_id);
 
 	/**
 	 * Map an internal OpenTTD error message to its NoAI equivalent.
@@ -157,7 +157,7 @@
 	 * @param internal_string_id The OpenTTD StringID used for an error.
 	 * @param ai_error_msg The NoAI equivalent error message.
 	 */
-	static void RegisterErrorMap(StringID internal_string_id, AIErrorType ai_error_msg);
+	static void RegisterErrorMap(StringID internal_string_id, ScriptErrorType ai_error_msg);
 
 	/**
 	 * Map an internal OpenTTD error message to its NoAI equivalent.
@@ -165,15 +165,15 @@
 	 * @param ai_error_msg The NoAI error message representation.
 	 * @param message The string representation of this error message, used for debug purposes.
 	 */
-	static void RegisterErrorMapString(AIErrorType ai_error_msg, const char *message);
+	static void RegisterErrorMapString(ScriptErrorType ai_error_msg, const char *message);
 #endif /* EXPORT_SKIP */
 
 private:
-	typedef std::map<StringID, AIErrorType> AIErrorMap;           ///< The type for mapping between error (internal OpenTTD) StringID to the AI error type.
-	typedef std::map<AIErrorType, const char *> AIErrorMapString; ///< The type for mapping between error type and textual representation.
+	typedef std::map<StringID, ScriptErrorType> ScriptErrorMap;           ///< The type for mapping between error (internal OpenTTD) StringID to the AI error type.
+	typedef std::map<ScriptErrorType, const char *> ScriptErrorMapString; ///< The type for mapping between error type and textual representation.
 
-	static AIErrorMap error_map;              ///< The mapping between error (internal OpenTTD) StringID to the AI error type.
-	static AIErrorMapString error_map_string; ///< The mapping between error type and textual representation.
+	static ScriptErrorMap error_map;              ///< The mapping between error (internal OpenTTD) StringID to the AI error type.
+	static ScriptErrorMapString error_map_string; ///< The mapping between error type and textual representation.
 };
 
 #endif /* SCRIPT_ERROR_HPP */
--- a/src/script/api/script_event.cpp
+++ b/src/script/api/script_event.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_event.cpp Implementation of AIEvent. */
+/** @file script_event.cpp Implementation of ScriptEvent. */
 
 #include "../../stdafx.h"
 #include "script_event_types.hpp"
@@ -15,24 +15,24 @@
 #include <queue>
 
 /** The queue of events for an AI. */
-struct AIEventData {
-	std::queue<AIEvent *> stack; ///< The actual queue.
+struct ScriptEventData {
+	std::queue<ScriptEvent *> stack; ///< The actual queue.
 };
 
-/* static */ void AIEventController::CreateEventPointer()
+/* static */ void ScriptEventController::CreateEventPointer()
 {
-	assert(AIObject::GetEventPointer() == NULL);
+	assert(ScriptObject::GetEventPointer() == NULL);
 
-	AIObject::GetEventPointer() = new AIEventData();
+	ScriptObject::GetEventPointer() = new ScriptEventData();
 }
 
-/* static */ void AIEventController::FreeEventPointer()
+/* static */ void ScriptEventController::FreeEventPointer()
 {
-	AIEventData *data = (AIEventData *)AIObject::GetEventPointer();
+	ScriptEventData *data = (ScriptEventData *)ScriptObject::GetEventPointer();
 
 	/* Free all waiting events (if any) */
 	while (!data->stack.empty()) {
-		AIEvent *e = data->stack.front();
+		ScriptEvent *e = data->stack.front();
 		data->stack.pop();
 		e->Release();
 	}
@@ -41,30 +41,30 @@
 	delete data;
 }
 
-/* static */ bool AIEventController::IsEventWaiting()
+/* static */ bool ScriptEventController::IsEventWaiting()
 {
-	if (AIObject::GetEventPointer() == NULL) AIEventController::CreateEventPointer();
-	AIEventData *data = (AIEventData *)AIObject::GetEventPointer();
+	if (ScriptObject::GetEventPointer() == NULL) ScriptEventController::CreateEventPointer();
+	ScriptEventData *data = (ScriptEventData *)ScriptObject::GetEventPointer();
 
 	return !data->stack.empty();
 }
 
-/* static */ AIEvent *AIEventController::GetNextEvent()
+/* static */ ScriptEvent *ScriptEventController::GetNextEvent()
 {
-	if (AIObject::GetEventPointer() == NULL) AIEventController::CreateEventPointer();
-	AIEventData *data = (AIEventData *)AIObject::GetEventPointer();
+	if (ScriptObject::GetEventPointer() == NULL) ScriptEventController::CreateEventPointer();
+	ScriptEventData *data = (ScriptEventData *)ScriptObject::GetEventPointer();
 
 	if (data->stack.empty()) return NULL;
 
-	AIEvent *e = data->stack.front();
+	ScriptEvent *e = data->stack.front();
 	data->stack.pop();
 	return e;
 }
 
-/* static */ void AIEventController::InsertEvent(AIEvent *event)
+/* static */ void ScriptEventController::InsertEvent(ScriptEvent *event)
 {
-	if (AIObject::GetEventPointer() == NULL) AIEventController::CreateEventPointer();
-	AIEventData *data = (AIEventData *)AIObject::GetEventPointer();
+	if (ScriptObject::GetEventPointer() == NULL) ScriptEventController::CreateEventPointer();
+	ScriptEventData *data = (ScriptEventData *)ScriptObject::GetEventPointer();
 
 	event->AddRef();
 	data->stack.push(event);
--- a/src/script/api/script_event.hpp
+++ b/src/script/api/script_event.hpp
@@ -19,12 +19,12 @@
  * You can lookup the type, and than convert it to the real event-class.
  * That way you can request more detailed information about the event.
  */
-class AIEvent : public AIObject {
+class ScriptEvent : public ScriptObject {
 public:
 	/**
 	 * The type of event. Needed to lookup the detailed class.
 	 */
-	enum AIEventType {
+	enum ScriptEventType {
 		AI_ET_INVALID = 0,
 		AI_ET_TEST,
 		AI_ET_SUBSIDY_OFFER,
@@ -51,31 +51,31 @@
 	};
 
 	/**
-	 * Constructor of AIEvent, to get the type of event.
+	 * Constructor of ScriptEvent, to get the type of event.
 	 */
-	AIEvent(AIEvent::AIEventType type) :
+	ScriptEvent(ScriptEvent::ScriptEventType type) :
 		type(type)
 	{}
 
 	/**
 	 * Get the event-type.
-	 * @return The @c AIEventType.
+	 * @return The @c ScriptEventType.
 	 */
-	AIEventType GetEventType() { return this->type; }
+	ScriptEventType GetEventType() { return this->type; }
 
 protected:
 	/**
 	 * The type of this event.
 	 */
-	AIEventType type;
+	ScriptEventType type;
 };
 
 /**
  * Class that handles all event related functions.
- * @note it is not needed to create an instance of AIEvent to access it, as
+ * @note it is not needed to create an instance of ScriptEvent to access it, as
  *  all members are static, and all data is stored AI-wide.
  */
-class AIEventController : public AIObject {
+class ScriptEventController : public ScriptObject {
 public:
 	/**
 	 * Check if there is an event waiting.
@@ -87,7 +87,7 @@
 	 * Get the next event.
 	 * @return a class of the event-child issues.
 	 */
-	static AIEvent *GetNextEvent();
+	static ScriptEvent *GetNextEvent();
 
 #ifndef EXPORT_SKIP
 	/**
@@ -95,7 +95,7 @@
 	 * @param event The event to insert.
 	 * @note DO NOT CALL YOURSELF; leave it to the internal AI programming.
 	 */
-	static void InsertEvent(AIEvent *event);
+	static void InsertEvent(ScriptEvent *event);
 
 	/**
 	 * Free the event pointer.
--- a/src/script/api/script_event_types.cpp
+++ b/src/script/api/script_event_types.cpp
@@ -19,13 +19,13 @@
 #include "../../articulated_vehicles.h"
 #include "table/strings.h"
 
-bool AIEventEnginePreview::IsEngineValid() const
+bool ScriptEventEnginePreview::IsEngineValid() const
 {
 	const Engine *e = ::Engine::GetIfValid(this->engine);
 	return e != NULL && e->IsEnabled();
 }
 
-char *AIEventEnginePreview::GetName()
+char *ScriptEventEnginePreview::GetName()
 {
 	if (!this->IsEngineValid()) return NULL;
 	static const int len = 64;
@@ -36,7 +36,7 @@
 	return engine_name;
 }
 
-CargoID AIEventEnginePreview::GetCargoType()
+CargoID ScriptEventEnginePreview::GetCargoType()
 {
 	if (!this->IsEngineValid()) return CT_INVALID;
 	CargoArray cap = ::GetCapacityOfArticulatedParts(this->engine);
@@ -53,7 +53,7 @@
 	return most_cargo;
 }
 
-int32 AIEventEnginePreview::GetCapacity()
+int32 ScriptEventEnginePreview::GetCapacity()
 {
 	if (!this->IsEngineValid()) return -1;
 	const Engine *e = ::Engine::Get(this->engine);
@@ -76,7 +76,7 @@
 	}
 }
 
-int32 AIEventEnginePreview::GetMaxSpeed()
+int32 ScriptEventEnginePreview::GetMaxSpeed()
 {
 	if (!this->IsEngineValid()) return -1;
 	const Engine *e = ::Engine::Get(this->engine);
@@ -85,37 +85,37 @@
 	return max_speed;
 }
 
-Money AIEventEnginePreview::GetPrice()
+Money ScriptEventEnginePreview::GetPrice()
 {
 	if (!this->IsEngineValid()) return -1;
 	return ::Engine::Get(this->engine)->GetCost();
 }
 
-Money AIEventEnginePreview::GetRunningCost()
+Money ScriptEventEnginePreview::GetRunningCost()
 {
 	if (!this->IsEngineValid()) return -1;
 	return ::Engine::Get(this->engine)->GetRunningCost();
 }
 
-int32 AIEventEnginePreview::GetVehicleType()
+int32 ScriptEventEnginePreview::GetVehicleType()
 {
-	if (!this->IsEngineValid()) return AIVehicle::VT_INVALID;
+	if (!this->IsEngineValid()) return ScriptVehicle::VT_INVALID;
 	switch (::Engine::Get(this->engine)->type) {
-		case VEH_ROAD:     return AIVehicle::VT_ROAD;
-		case VEH_TRAIN:    return AIVehicle::VT_RAIL;
-		case VEH_SHIP:     return AIVehicle::VT_WATER;
-		case VEH_AIRCRAFT: return AIVehicle::VT_AIR;
+		case VEH_ROAD:     return ScriptVehicle::VT_ROAD;
+		case VEH_TRAIN:    return ScriptVehicle::VT_RAIL;
+		case VEH_SHIP:     return ScriptVehicle::VT_WATER;
+		case VEH_AIRCRAFT: return ScriptVehicle::VT_AIR;
 		default: NOT_REACHED();
 	}
 }
 
-bool AIEventEnginePreview::AcceptPreview()
+bool ScriptEventEnginePreview::AcceptPreview()
 {
 	if (!this->IsEngineValid()) return false;
-	return AIObject::DoCommand(0, this->engine, 0, CMD_WANT_ENGINE_PREVIEW);
+	return ScriptObject::DoCommand(0, this->engine, 0, CMD_WANT_ENGINE_PREVIEW);
 }
 
-bool AIEventCompanyAskMerger::AcceptMerger()
+bool ScriptEventCompanyAskMerger::AcceptMerger()
 {
-	return AIObject::DoCommand(0, this->owner, 0, CMD_BUY_COMPANY);
+	return ScriptObject::DoCommand(0, this->owner, 0, CMD_BUY_COMPANY);
 }
--- a/src/script/api/script_event_types.hpp
+++ b/src/script/api/script_event_types.hpp
@@ -19,7 +19,7 @@
  * Event Vehicle Crash, indicating a vehicle of yours is crashed.
  *  It contains the crash site, the crashed vehicle and the reason for the crash.
  */
-class AIEventVehicleCrashed : public AIEvent {
+class ScriptEventVehicleCrashed : public ScriptEvent {
 public:
 	/**
 	 * The reasons for vehicle crashes
@@ -38,19 +38,19 @@
 	 * @param crash_site Where the vehicle crashed.
 	 * @param crash_reason The reason why the vehicle crashed.
 	 */
-	AIEventVehicleCrashed(VehicleID vehicle, TileIndex crash_site, CrashReason crash_reason) :
-		AIEvent(AI_ET_VEHICLE_CRASHED),
+	ScriptEventVehicleCrashed(VehicleID vehicle, TileIndex crash_site, CrashReason crash_reason) :
+		ScriptEvent(AI_ET_VEHICLE_CRASHED),
 		crash_site(crash_site),
 		vehicle(vehicle),
 		crash_reason(crash_reason)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventVehicleCrashed *Convert(AIEvent *instance) { return (AIEventVehicleCrashed *)instance; }
+	static ScriptEventVehicleCrashed *Convert(ScriptEvent *instance) { return (ScriptEventVehicleCrashed *)instance; }
 
 	/**
 	 * Get the VehicleID of the crashed vehicle.
@@ -79,22 +79,22 @@
 /**
  * Event Subsidy Offered, indicating someone offered a subsidy.
  */
-class AIEventSubsidyOffer : public AIEvent {
+class ScriptEventSubsidyOffer : public ScriptEvent {
 public:
 	/**
 	 * @param subsidy_id The index of this subsidy in the _subsidies array.
 	 */
-	AIEventSubsidyOffer(SubsidyID subsidy_id) :
-		AIEvent(AI_ET_SUBSIDY_OFFER),
+	ScriptEventSubsidyOffer(SubsidyID subsidy_id) :
+		ScriptEvent(AI_ET_SUBSIDY_OFFER),
 		subsidy_id(subsidy_id)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventSubsidyOffer *Convert(AIEvent *instance) { return (AIEventSubsidyOffer *)instance; }
+	static ScriptEventSubsidyOffer *Convert(ScriptEvent *instance) { return (ScriptEventSubsidyOffer *)instance; }
 
 	/**
 	 * Get the SubsidyID of the subsidy.
@@ -109,22 +109,22 @@
 /**
  * Event Subsidy Offer Expired, indicating a subsidy will no longer be awarded.
  */
-class AIEventSubsidyOfferExpired : public AIEvent {
+class ScriptEventSubsidyOfferExpired : public ScriptEvent {
 public:
 	/**
 	 * @param subsidy_id The index of this subsidy in the _subsidies array.
 	 */
-	AIEventSubsidyOfferExpired(SubsidyID subsidy_id) :
-		AIEvent(AI_ET_SUBSIDY_OFFER_EXPIRED),
+	ScriptEventSubsidyOfferExpired(SubsidyID subsidy_id) :
+		ScriptEvent(AI_ET_SUBSIDY_OFFER_EXPIRED),
 		subsidy_id(subsidy_id)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventSubsidyOfferExpired *Convert(AIEvent *instance) { return (AIEventSubsidyOfferExpired *)instance; }
+	static ScriptEventSubsidyOfferExpired *Convert(ScriptEvent *instance) { return (ScriptEventSubsidyOfferExpired *)instance; }
 
 	/**
 	 * Get the SubsidyID of the subsidy.
@@ -139,22 +139,22 @@
 /**
  * Event Subidy Awarded, indicating a subsidy is awarded to some company.
  */
-class AIEventSubsidyAwarded : public AIEvent {
+class ScriptEventSubsidyAwarded : public ScriptEvent {
 public:
 	/**
 	 * @param subsidy_id The index of this subsidy in the _subsidies array.
 	 */
-	AIEventSubsidyAwarded(SubsidyID subsidy_id) :
-		AIEvent(AI_ET_SUBSIDY_AWARDED),
+	ScriptEventSubsidyAwarded(SubsidyID subsidy_id) :
+		ScriptEvent(AI_ET_SUBSIDY_AWARDED),
 		subsidy_id(subsidy_id)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventSubsidyAwarded *Convert(AIEvent *instance) { return (AIEventSubsidyAwarded *)instance; }
+	static ScriptEventSubsidyAwarded *Convert(ScriptEvent *instance) { return (ScriptEventSubsidyAwarded *)instance; }
 
 	/**
 	 * Get the SubsidyID of the subsidy.
@@ -169,22 +169,22 @@
 /**
  * Event Subsidy Expired, indicating a route that was once subsidized no longer is.
  */
-class AIEventSubsidyExpired : public AIEvent {
+class ScriptEventSubsidyExpired : public ScriptEvent {
 public:
 	/**
 	 * @param subsidy_id The index of this subsidy in the _subsidies array.
 	 */
-	AIEventSubsidyExpired(SubsidyID subsidy_id) :
-		AIEvent(AI_ET_SUBSIDY_EXPIRED),
+	ScriptEventSubsidyExpired(SubsidyID subsidy_id) :
+		ScriptEvent(AI_ET_SUBSIDY_EXPIRED),
 		subsidy_id(subsidy_id)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventSubsidyExpired *Convert(AIEvent *instance) { return (AIEventSubsidyExpired *)instance; }
+	static ScriptEventSubsidyExpired *Convert(ScriptEvent *instance) { return (ScriptEventSubsidyExpired *)instance; }
 
 	/**
 	 * Get the SubsidyID of the subsidy.
@@ -201,22 +201,22 @@
  *  You can get the same information about the offered engine as a real user
  *  would see in the offer window. And you can also accept the offer.
  */
-class AIEventEnginePreview : public AIEvent {
+class ScriptEventEnginePreview : public ScriptEvent {
 public:
 	/**
 	 * @param engine The engine offered to test.
 	 */
-	AIEventEnginePreview(EngineID engine) :
-		AIEvent(AI_ET_ENGINE_PREVIEW),
+	ScriptEventEnginePreview(EngineID engine) :
+		ScriptEvent(AI_ET_ENGINE_PREVIEW),
 		engine(engine)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventEnginePreview *Convert(AIEvent *instance) { return (AIEventEnginePreview *)instance; }
+	static ScriptEventEnginePreview *Convert(ScriptEvent *instance) { return (ScriptEventEnginePreview *)instance; }
 
 	/**
 	 * Get the name of the offered engine.
@@ -265,7 +265,7 @@
 	 * @return The type the engine has.
 	 */
 #ifdef DOXYGEN_AI_DOCS
-	AIVehicle::VehicleType GetVehicleType();
+	ScriptVehicle::VehicleType GetVehicleType();
 #else
 	int32 GetVehicleType();
 #endif
@@ -289,92 +289,92 @@
 /**
  * Event Company New, indicating a new company has been created.
  */
-class AIEventCompanyNew : public AIEvent {
+class ScriptEventCompanyNew : public ScriptEvent {
 public:
 	/**
 	 * @param owner The new company.
 	 */
-	AIEventCompanyNew(Owner owner) :
-		AIEvent(AI_ET_COMPANY_NEW),
-		owner((AICompany::CompanyID)owner)
+	ScriptEventCompanyNew(Owner owner) :
+		ScriptEvent(AI_ET_COMPANY_NEW),
+		owner((ScriptCompany::CompanyID)owner)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventCompanyNew *Convert(AIEvent *instance) { return (AIEventCompanyNew *)instance; }
+	static ScriptEventCompanyNew *Convert(ScriptEvent *instance) { return (ScriptEventCompanyNew *)instance; }
 
 	/**
 	 * Get the CompanyID of the company that has been created.
 	 * @return The CompanyID of the company.
 	 */
-	AICompany::CompanyID GetCompanyID() { return this->owner; }
+	ScriptCompany::CompanyID GetCompanyID() { return this->owner; }
 
 private:
-	AICompany::CompanyID owner; ///< The new company.
+	ScriptCompany::CompanyID owner; ///< The new company.
 };
 
 /**
  * Event Company In Trouble, indicating a company is in trouble and might go
  *  bankrupt soon.
  */
-class AIEventCompanyInTrouble : public AIEvent {
+class ScriptEventCompanyInTrouble : public ScriptEvent {
 public:
 	/**
 	 * @param owner The company that is in trouble.
 	 */
-	AIEventCompanyInTrouble(Owner owner) :
-		AIEvent(AI_ET_COMPANY_IN_TROUBLE),
-		owner((AICompany::CompanyID)owner)
+	ScriptEventCompanyInTrouble(Owner owner) :
+		ScriptEvent(AI_ET_COMPANY_IN_TROUBLE),
+		owner((ScriptCompany::CompanyID)owner)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventCompanyInTrouble *Convert(AIEvent *instance) { return (AIEventCompanyInTrouble *)instance; }
+	static ScriptEventCompanyInTrouble *Convert(ScriptEvent *instance) { return (ScriptEventCompanyInTrouble *)instance; }
 
 	/**
 	 * Get the CompanyID of the company that is in trouble.
 	 * @return The CompanyID of the company in trouble.
 	 */
-	AICompany::CompanyID GetCompanyID() { return this->owner; }
+	ScriptCompany::CompanyID GetCompanyID() { return this->owner; }
 
 private:
-	AICompany::CompanyID owner; ///< The company that is in trouble.
+	ScriptCompany::CompanyID owner; ///< The company that is in trouble.
 };
 
 /**
  * Event Company Ask Merger, indicating a company can be bought (cheaply) by you.
  */
-class AIEventCompanyAskMerger : public AIEvent {
+class ScriptEventCompanyAskMerger : public ScriptEvent {
 public:
 	/**
 	 * @param owner The company that can be bough.
 	 * @param value The value/costs of buying the company.
 	 */
-	AIEventCompanyAskMerger(Owner owner, int32 value) :
-		AIEvent(AI_ET_COMPANY_ASK_MERGER),
-		owner((AICompany::CompanyID)owner),
+	ScriptEventCompanyAskMerger(Owner owner, int32 value) :
+		ScriptEvent(AI_ET_COMPANY_ASK_MERGER),
+		owner((ScriptCompany::CompanyID)owner),
 		value(value)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventCompanyAskMerger *Convert(AIEvent *instance) { return (AIEventCompanyAskMerger *)instance; }
+	static ScriptEventCompanyAskMerger *Convert(ScriptEvent *instance) { return (ScriptEventCompanyAskMerger *)instance; }
 
 	/**
 	 * Get the CompanyID of the company that can be bought.
 	 * @return The CompanyID of the company that can be bought.
 	 * @note If the company is bought this will become invalid.
 	 */
-	AICompany::CompanyID GetCompanyID() { return this->owner; }
+	ScriptCompany::CompanyID GetCompanyID() { return this->owner; }
 
 	/**
 	 * Get the value of the new company.
@@ -389,7 +389,7 @@
 	bool AcceptMerger();
 
 private:
-	AICompany::CompanyID owner; ///< The company that is in trouble.
+	ScriptCompany::CompanyID owner; ///< The company that is in trouble.
 	int32 value;                ///< The value of the company, i.e. the amount you would pay.
 };
 
@@ -397,94 +397,94 @@
  * Event Company Merger, indicating a company has been bought by another
  *  company.
  */
-class AIEventCompanyMerger : public AIEvent {
+class ScriptEventCompanyMerger : public ScriptEvent {
 public:
 	/**
 	 * @param old_owner The company bought off.
 	 * @param new_owner The company that bougth owner.
 	 */
-	AIEventCompanyMerger(Owner old_owner, Owner new_owner) :
-		AIEvent(AI_ET_COMPANY_MERGER),
-		old_owner((AICompany::CompanyID)old_owner),
-		new_owner((AICompany::CompanyID)new_owner)
+	ScriptEventCompanyMerger(Owner old_owner, Owner new_owner) :
+		ScriptEvent(AI_ET_COMPANY_MERGER),
+		old_owner((ScriptCompany::CompanyID)old_owner),
+		new_owner((ScriptCompany::CompanyID)new_owner)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventCompanyMerger *Convert(AIEvent *instance) { return (AIEventCompanyMerger *)instance; }
+	static ScriptEventCompanyMerger *Convert(ScriptEvent *instance) { return (ScriptEventCompanyMerger *)instance; }
 
 	/**
 	 * Get the CompanyID of the company that has been bought.
 	 * @return The CompanyID of the company that has been bought.
 	 * @note: The value below is not valid anymore as CompanyID, and
-	 *  AICompany::ResolveCompanyID will return COMPANY_COMPANY. It's
+	 *  ScriptCompany::ResolveCompanyID will return COMPANY_COMPANY. It's
 	 *  only usefull if you're keeping track of company's yourself.
 	 */
-	AICompany::CompanyID GetOldCompanyID() { return this->old_owner; }
+	ScriptCompany::CompanyID GetOldCompanyID() { return this->old_owner; }
 
 	/**
 	 * Get the CompanyID of the new owner.
 	 * @return The CompanyID of the new owner.
 	 */
-	AICompany::CompanyID GetNewCompanyID() { return this->new_owner; }
+	ScriptCompany::CompanyID GetNewCompanyID() { return this->new_owner; }
 
 private:
-	AICompany::CompanyID old_owner; ///< The company that ended to exist.
-	AICompany::CompanyID new_owner; ///< The company that's the end result of the merger.
+	ScriptCompany::CompanyID old_owner; ///< The company that ended to exist.
+	ScriptCompany::CompanyID new_owner; ///< The company that's the end result of the merger.
 };
 
 /**
  * Event Company Bankrupt, indicating a company has gone bankrupt.
  */
-class AIEventCompanyBankrupt : public AIEvent {
+class ScriptEventCompanyBankrupt : public ScriptEvent {
 public:
 	/**
 	 * @param owner The company that has gone bankrupt.
 	 */
-	AIEventCompanyBankrupt(Owner owner) :
-		AIEvent(AI_ET_COMPANY_BANKRUPT),
-		owner((AICompany::CompanyID)owner)
+	ScriptEventCompanyBankrupt(Owner owner) :
+		ScriptEvent(AI_ET_COMPANY_BANKRUPT),
+		owner((ScriptCompany::CompanyID)owner)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventCompanyBankrupt *Convert(AIEvent *instance) { return (AIEventCompanyBankrupt *)instance; }
+	static ScriptEventCompanyBankrupt *Convert(ScriptEvent *instance) { return (ScriptEventCompanyBankrupt *)instance; }
 
 	/**
 	 * Get the CompanyID of the company that has gone bankrupt.
 	 * @return The CompanyID of the company that has gone bankrupt.
 	 */
-	AICompany::CompanyID GetCompanyID() { return this->owner; }
+	ScriptCompany::CompanyID GetCompanyID() { return this->owner; }
 
 private:
-	AICompany::CompanyID owner; ///< The company that has gone bankrupt.
+	ScriptCompany::CompanyID owner; ///< The company that has gone bankrupt.
 };
 
 /**
  * Event Vehicle Lost, indicating a vehicle can't find its way to its destination.
  */
-class AIEventVehicleLost : public AIEvent {
+class ScriptEventVehicleLost : public ScriptEvent {
 public:
 	/**
 	 * @param vehicle_id The vehicle that is lost.
 	 */
-	AIEventVehicleLost(VehicleID vehicle_id) :
-		AIEvent(AI_ET_VEHICLE_LOST),
+	ScriptEventVehicleLost(VehicleID vehicle_id) :
+		ScriptEvent(AI_ET_VEHICLE_LOST),
 		vehicle_id(vehicle_id)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventVehicleLost *Convert(AIEvent *instance) { return (AIEventVehicleLost *)instance; }
+	static ScriptEventVehicleLost *Convert(ScriptEvent *instance) { return (ScriptEventVehicleLost *)instance; }
 
 	/**
 	 * Get the VehicleID of the vehicle that is lost.
@@ -499,22 +499,22 @@
 /**
  * Event VehicleWaitingInDepot, indicating a vehicle has arrived a depot and is now waiting there.
  */
-class AIEventVehicleWaitingInDepot : public AIEvent {
+class ScriptEventVehicleWaitingInDepot : public ScriptEvent {
 public:
 	/**
 	 * @param vehicle_id The vehicle that is waiting in a depot.
 	 */
-	AIEventVehicleWaitingInDepot(VehicleID vehicle_id) :
-		AIEvent(AI_ET_VEHICLE_WAITING_IN_DEPOT),
+	ScriptEventVehicleWaitingInDepot(VehicleID vehicle_id) :
+		ScriptEvent(AI_ET_VEHICLE_WAITING_IN_DEPOT),
 		vehicle_id(vehicle_id)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventVehicleWaitingInDepot *Convert(AIEvent *instance) { return (AIEventVehicleWaitingInDepot *)instance; }
+	static ScriptEventVehicleWaitingInDepot *Convert(ScriptEvent *instance) { return (ScriptEventVehicleWaitingInDepot *)instance; }
 
 	/**
 	 * Get the VehicleID of the vehicle that is waiting in a depot.
@@ -529,22 +529,22 @@
 /**
  * Event Vehicle Unprofitable, indicating a vehicle lost money last year.
  */
-class AIEventVehicleUnprofitable : public AIEvent {
+class ScriptEventVehicleUnprofitable : public ScriptEvent {
 public:
 	/**
 	 * @param vehicle_id The vehicle that was unprofitable.
 	 */
-	AIEventVehicleUnprofitable(VehicleID vehicle_id) :
-		AIEvent(AI_ET_VEHICLE_UNPROFITABLE),
+	ScriptEventVehicleUnprofitable(VehicleID vehicle_id) :
+		ScriptEvent(AI_ET_VEHICLE_UNPROFITABLE),
 		vehicle_id(vehicle_id)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventVehicleUnprofitable *Convert(AIEvent *instance) { return (AIEventVehicleUnprofitable *)instance; }
+	static ScriptEventVehicleUnprofitable *Convert(ScriptEvent *instance) { return (ScriptEventVehicleUnprofitable *)instance; }
 
 	/**
 	 * Get the VehicleID of the vehicle that lost money.
@@ -559,22 +559,22 @@
 /**
  * Event Industry Open, indicating a new industry has been created.
  */
-class AIEventIndustryOpen : public AIEvent {
+class ScriptEventIndustryOpen : public ScriptEvent {
 public:
 	/**
 	 * @param industry_id The new industry.
 	 */
-	AIEventIndustryOpen(IndustryID industry_id) :
-		AIEvent(AI_ET_INDUSTRY_OPEN),
+	ScriptEventIndustryOpen(IndustryID industry_id) :
+		ScriptEvent(AI_ET_INDUSTRY_OPEN),
 		industry_id(industry_id)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventIndustryOpen *Convert(AIEvent *instance) { return (AIEventIndustryOpen *)instance; }
+	static ScriptEventIndustryOpen *Convert(ScriptEvent *instance) { return (ScriptEventIndustryOpen *)instance; }
 
 	/**
 	 * Get the IndustryID of the new industry.
@@ -589,22 +589,22 @@
 /**
  * Event Industry Close, indicating an industry is going to be closed.
  */
-class AIEventIndustryClose : public AIEvent {
+class ScriptEventIndustryClose : public ScriptEvent {
 public:
 	/**
 	 * @param industry_id The new industry.
 	 */
-	AIEventIndustryClose(IndustryID industry_id) :
-		AIEvent(AI_ET_INDUSTRY_CLOSE),
+	ScriptEventIndustryClose(IndustryID industry_id) :
+		ScriptEvent(AI_ET_INDUSTRY_CLOSE),
 		industry_id(industry_id)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventIndustryClose *Convert(AIEvent *instance) { return (AIEventIndustryClose *)instance; }
+	static ScriptEventIndustryClose *Convert(ScriptEvent *instance) { return (ScriptEventIndustryClose *)instance; }
 
 	/**
 	 * Get the IndustryID of the closing industry.
@@ -619,22 +619,22 @@
 /**
  * Event Engine Available, indicating a new engine is available.
  */
-class AIEventEngineAvailable : public AIEvent {
+class ScriptEventEngineAvailable : public ScriptEvent {
 public:
 	/**
 	 * @param engine The engine that is available.
 	 */
-	AIEventEngineAvailable(EngineID engine) :
-		AIEvent(AI_ET_ENGINE_AVAILABLE),
+	ScriptEventEngineAvailable(EngineID engine) :
+		ScriptEvent(AI_ET_ENGINE_AVAILABLE),
 		engine(engine)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventEngineAvailable *Convert(AIEvent *instance) { return (AIEventEngineAvailable *)instance; }
+	static ScriptEventEngineAvailable *Convert(ScriptEvent *instance) { return (ScriptEventEngineAvailable *)instance; }
 
 	/**
 	 * Get the EngineID of the new engine.
@@ -649,24 +649,24 @@
 /**
  * Event Station First Vehicle, indicating a station has been visited by a vehicle for the first time.
  */
-class AIEventStationFirstVehicle : public AIEvent {
+class ScriptEventStationFirstVehicle : public ScriptEvent {
 public:
 	/**
 	 * @param station The station visited for the first time.
 	 * @param vehicle The vehicle visiting the station.
 	 */
-	AIEventStationFirstVehicle(StationID station, VehicleID vehicle) :
-		AIEvent(AI_ET_STATION_FIRST_VEHICLE),
+	ScriptEventStationFirstVehicle(StationID station, VehicleID vehicle) :
+		ScriptEvent(AI_ET_STATION_FIRST_VEHICLE),
 		station(station),
 		vehicle(vehicle)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventStationFirstVehicle *Convert(AIEvent *instance) { return (AIEventStationFirstVehicle *)instance; }
+	static ScriptEventStationFirstVehicle *Convert(ScriptEvent *instance) { return (ScriptEventStationFirstVehicle *)instance; }
 
 	/**
 	 * Get the StationID of the visited station.
@@ -688,22 +688,22 @@
 /**
  * Event Disaster Zeppeliner Crashed, indicating a zeppeliner has crashed on an airport and is blocking the runway.
  */
-class AIEventDisasterZeppelinerCrashed : public AIEvent {
+class ScriptEventDisasterZeppelinerCrashed : public ScriptEvent {
 public:
 	/**
 	 * @param station The station containing the affected airport
 	 */
-	AIEventDisasterZeppelinerCrashed(StationID station) :
-		AIEvent(AI_ET_DISASTER_ZEPPELINER_CRASHED),
+	ScriptEventDisasterZeppelinerCrashed(StationID station) :
+		ScriptEvent(AI_ET_DISASTER_ZEPPELINER_CRASHED),
 		station(station)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventDisasterZeppelinerCrashed *Convert(AIEvent *instance) { return (AIEventDisasterZeppelinerCrashed *)instance; }
+	static ScriptEventDisasterZeppelinerCrashed *Convert(ScriptEvent *instance) { return (ScriptEventDisasterZeppelinerCrashed *)instance; }
 
 	/**
 	 * Get the StationID of the station containing the affected airport.
@@ -718,22 +718,22 @@
 /**
  * Event Disaster Zeppeliner Cleared, indicating a previously crashed zeppeliner has been removed, and the airport is operating again.
  */
-class AIEventDisasterZeppelinerCleared : public AIEvent {
+class ScriptEventDisasterZeppelinerCleared : public ScriptEvent {
 public:
 	/**
 	 * @param station The station containing the affected airport
 	 */
-	AIEventDisasterZeppelinerCleared(StationID station) :
-		AIEvent(AI_ET_DISASTER_ZEPPELINER_CLEARED),
+	ScriptEventDisasterZeppelinerCleared(StationID station) :
+		ScriptEvent(AI_ET_DISASTER_ZEPPELINER_CLEARED),
 		station(station)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventDisasterZeppelinerCleared *Convert(AIEvent *instance) { return (AIEventDisasterZeppelinerCleared *)instance; }
+	static ScriptEventDisasterZeppelinerCleared *Convert(ScriptEvent *instance) { return (ScriptEventDisasterZeppelinerCleared *)instance; }
 
 	/**
 	 * Get the StationID of the station containing the affected airport.
@@ -748,22 +748,22 @@
 /**
  * Event Town Founded, indicating a new town has been created.
  */
-class AIEventTownFounded : public AIEvent {
+class ScriptEventTownFounded : public ScriptEvent {
 public:
 	/**
 	 * @param town The town that was created.
 	 */
-	AIEventTownFounded(TownID town) :
-		AIEvent(AI_ET_TOWN_FOUNDED),
+	ScriptEventTownFounded(TownID town) :
+		ScriptEvent(AI_ET_TOWN_FOUNDED),
 		town(town)
 	{}
 
 	/**
-	 * Convert an AIEvent to the real instance.
+	 * Convert an ScriptEvent to the real instance.
 	 * @param instance The instance to convert.
 	 * @return The converted instance.
 	 */
-	static AIEventTownFounded *Convert(AIEvent *instance) { return (AIEventTownFounded *)instance; }
+	static ScriptEventTownFounded *Convert(ScriptEvent *instance) { return (ScriptEventTownFounded *)instance; }
 
 	/**
 	 * Get the TownID of the town.
--- a/src/script/api/script_execmode.cpp
+++ b/src/script/api/script_execmode.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_execmode.cpp Implementation of AIExecMode. */
+/** @file script_execmode.cpp Implementation of ScriptExecMode. */
 
 #include "../../stdafx.h"
 #include "script_execmode.hpp"
@@ -15,26 +15,26 @@
 #include "../../company_func.h"
 #include "../../ai/ai_instance.hpp"
 
-bool AIExecMode::ModeProc()
+bool ScriptExecMode::ModeProc()
 {
 	/* In execution mode we only return 'true', telling the DoCommand it
 	 *  should continue with the real execution of the command. */
 	return true;
 }
 
-AIExecMode::AIExecMode()
+ScriptExecMode::ScriptExecMode()
 {
 	this->last_mode     = this->GetDoCommandMode();
 	this->last_instance = this->GetDoCommandModeInstance();
-	this->SetDoCommandMode(&AIExecMode::ModeProc, this);
+	this->SetDoCommandMode(&ScriptExecMode::ModeProc, this);
 }
 
-AIExecMode::~AIExecMode()
+ScriptExecMode::~ScriptExecMode()
 {
 	if (this->GetDoCommandModeInstance() != this) {
 		/* Ignore this error if the AI already died. */
-		if (!AIObject::GetActiveInstance()->IsDead()) {
-			throw AI_FatalError("AIExecMode object was removed while it was not the latest AI*Mode object created.");
+		if (!ScriptObject::GetActiveInstance()->IsDead()) {
+			throw AI_FatalError("ScriptExecMode object was removed while it was not the latest AI*Mode object created.");
 		}
 	}
 	this->SetDoCommandMode(this->last_mode, this->last_instance);
--- a/src/script/api/script_execmode.hpp
+++ b/src/script/api/script_execmode.hpp
@@ -21,10 +21,10 @@
  *   instance is destroyed.
  * In Execute mode all commands you do are executed for real.
  */
-class AIExecMode : public AIObject {
+class ScriptExecMode : public ScriptObject {
 private:
 	AIModeProc *last_mode;   ///< The previous mode we were in.
-	AIObject *last_instance; ///< The previous instace of the mode.
+	ScriptObject *last_instance; ///< The previous instace of the mode.
 
 protected:
 	/**
@@ -38,13 +38,13 @@
 	 * @note When the instance is destroyed, he restores the mode that was
 	 *   current when the instance was created!
 	 */
-	AIExecMode();
+	ScriptExecMode();
 
 	/**
 	 * Destroying this instance reset the building mode to the mode it was
 	 *   in when the instance was created.
 	 */
-	~AIExecMode();
+	~ScriptExecMode();
 };
 
 #endif /* SCRIPT_EXECMODE_HPP */
--- a/src/script/api/script_gamesettings.cpp
+++ b/src/script/api/script_gamesettings.cpp
@@ -7,20 +7,20 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_gamesettings.cpp Implementation of AIGameSettings. */
+/** @file script_gamesettings.cpp Implementation of ScriptGameSettings. */
 
 #include "../../stdafx.h"
 #include "script_gamesettings.hpp"
 #include "../../settings_internal.h"
 
-/* static */ bool AIGameSettings::IsValid(const char *setting)
+/* static */ bool ScriptGameSettings::IsValid(const char *setting)
 {
 	uint i;
 	const SettingDesc *sd = GetSettingFromName(setting, &i);
 	return sd != NULL && sd->desc.cmd != SDT_STRING;
 }
 
-/* static */ int32 AIGameSettings::GetValue(const char *setting)
+/* static */ int32 ScriptGameSettings::GetValue(const char *setting)
 {
 	if (!IsValid(setting)) return -1;
 
@@ -33,13 +33,13 @@
 	return (int32)ReadValue(ptr, sd->save.conv);
 }
 
-/* static */ bool AIGameSettings::IsDisabledVehicleType(AIVehicle::VehicleType vehicle_type)
+/* static */ bool ScriptGameSettings::IsDisabledVehicleType(ScriptVehicle::VehicleType vehicle_type)
 {
 	switch (vehicle_type) {
-		case AIVehicle::VT_RAIL:  return _settings_game.ai.ai_disable_veh_train;
-		case AIVehicle::VT_ROAD:  return _settings_game.ai.ai_disable_veh_roadveh;
-		case AIVehicle::VT_WATER: return _settings_game.ai.ai_disable_veh_ship;
-		case AIVehicle::VT_AIR:   return _settings_game.ai.ai_disable_veh_aircraft;
+		case ScriptVehicle::VT_RAIL:  return _settings_game.ai.ai_disable_veh_train;
+		case ScriptVehicle::VT_ROAD:  return _settings_game.ai.ai_disable_veh_roadveh;
+		case ScriptVehicle::VT_WATER: return _settings_game.ai.ai_disable_veh_ship;
+		case ScriptVehicle::VT_AIR:   return _settings_game.ai.ai_disable_veh_aircraft;
 		default:                       return true;
 	}
 }
--- a/src/script/api/script_gamesettings.hpp
+++ b/src/script/api/script_gamesettings.hpp
@@ -17,24 +17,24 @@
 /**
  * Class that handles all game settings related functions.
  *
- * @note AIGameSettings::IsValid and AIGameSettings::GetValue are functions
+ * @note ScriptGameSettings::IsValid and ScriptGameSettings::GetValue are functions
  *       that rely on the settings as OpenTTD stores them in savegame and
  *       openttd.cfg. No guarantees can be given on the long term validity,
  *       consistency and stability of the names, values and value ranges.
  *       Using these settings can be dangerous and could cause issues in
  *       future versions. To make sure that a setting still exists in the
- *       current version you have to run AIGameSettings::IsValid before
+ *       current version you have to run ScriptGameSettings::IsValid before
  *       accessing it.
  *
- * @note The names of the setting for AIGameSettings::IsValid and
- *       AIGameSettings::GetValue are the same ones as those that are shown by
+ * @note The names of the setting for ScriptGameSettings::IsValid and
+ *       ScriptGameSettings::GetValue are the same ones as those that are shown by
  *       the list_settings command in the in-game console. Settings that are
  *       string based are NOT supported and AIGAmeSettings::IsValid will return
  *       false for them. These settings will not be supported either because
  *       they have no relevance for the AI (default client names, server IPs,
  *       etc.).
  */
-class AIGameSettings : public AIObject {
+class ScriptGameSettings : public ScriptObject {
 public:
 	/**
 	 * Is the given game setting a valid setting for this instance of OpenTTD?
@@ -65,7 +65,7 @@
 	 * @param vehicle_type The vehicle-type to check.
 	 * @return True if the vehicle-type is disabled.
 	 */
-	static bool IsDisabledVehicleType(AIVehicle::VehicleType vehicle_type);
+	static bool IsDisabledVehicleType(ScriptVehicle::VehicleType vehicle_type);
 };
 
 #endif /* SCRIPT_GAMESETTINGS_HPP */
--- a/src/script/api/script_group.cpp
+++ b/src/script/api/script_group.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_group.cpp Implementation of AIGroup. */
+/** @file script_group.cpp Implementation of ScriptGroup. */
 
 #include "../../stdafx.h"
 #include "script_group.hpp"
@@ -21,44 +21,44 @@
 #include "../../settings_func.h"
 #include "table/strings.h"
 
-/* static */ bool AIGroup::IsValidGroup(GroupID group_id)
+/* static */ bool ScriptGroup::IsValidGroup(GroupID group_id)
 {
 	const Group *g = ::Group::GetIfValid(group_id);
 	return g != NULL && g->owner == _current_company;
 }
 
-/* static */ AIGroup::GroupID AIGroup::CreateGroup(AIVehicle::VehicleType vehicle_type)
+/* static */ ScriptGroup::GroupID ScriptGroup::CreateGroup(ScriptVehicle::VehicleType vehicle_type)
 {
-	if (!AIObject::DoCommand(0, (::VehicleType)vehicle_type, 0, CMD_CREATE_GROUP, NULL, &AIInstance::DoCommandReturnGroupID)) return GROUP_INVALID;
+	if (!ScriptObject::DoCommand(0, (::VehicleType)vehicle_type, 0, CMD_CREATE_GROUP, NULL, &AIInstance::DoCommandReturnGroupID)) return GROUP_INVALID;
 
 	/* In case of test-mode, we return GroupID 0 */
-	return (AIGroup::GroupID)0;
+	return (ScriptGroup::GroupID)0;
 }
 
-/* static */ bool AIGroup::DeleteGroup(GroupID group_id)
+/* static */ bool ScriptGroup::DeleteGroup(GroupID group_id)
 {
 	EnforcePrecondition(false, IsValidGroup(group_id));
 
-	return AIObject::DoCommand(0, group_id, 0, CMD_DELETE_GROUP);
+	return ScriptObject::DoCommand(0, group_id, 0, CMD_DELETE_GROUP);
 }
 
-/* static */ AIVehicle::VehicleType AIGroup::GetVehicleType(GroupID group_id)
+/* static */ ScriptVehicle::VehicleType ScriptGroup::GetVehicleType(GroupID group_id)
 {
-	if (!IsValidGroup(group_id)) return AIVehicle::VT_INVALID;
+	if (!IsValidGroup(group_id)) return ScriptVehicle::VT_INVALID;
 
-	return (AIVehicle::VehicleType)((::VehicleType)::Group::Get(group_id)->vehicle_type);
+	return (ScriptVehicle::VehicleType)((::VehicleType)::Group::Get(group_id)->vehicle_type);
 }
 
-/* static */ bool AIGroup::SetName(GroupID group_id, const char *name)
+/* static */ bool ScriptGroup::SetName(GroupID group_id, const char *name)
 {
 	EnforcePrecondition(false, IsValidGroup(group_id));
 	EnforcePrecondition(false, !::StrEmpty(name));
-	EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_GROUP_NAME_CHARS, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
+	EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_GROUP_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
 
-	return AIObject::DoCommand(0, group_id, 0, CMD_RENAME_GROUP, name);
+	return ScriptObject::DoCommand(0, group_id, 0, CMD_RENAME_GROUP, name);
 }
 
-/* static */ char *AIGroup::GetName(GroupID group_id)
+/* static */ char *ScriptGroup::GetName(GroupID group_id)
 {
 	if (!IsValidGroup(group_id)) return NULL;
 
@@ -70,65 +70,65 @@
 	return group_name;
 }
 
-/* static */ bool AIGroup::EnableAutoReplaceProtection(GroupID group_id, bool enable)
+/* static */ bool ScriptGroup::EnableAutoReplaceProtection(GroupID group_id, bool enable)
 {
 	EnforcePrecondition(false, IsValidGroup(group_id));
 
-	return AIObject::DoCommand(0, group_id, enable ? 1 : 0, CMD_SET_GROUP_REPLACE_PROTECTION);
+	return ScriptObject::DoCommand(0, group_id, enable ? 1 : 0, CMD_SET_GROUP_REPLACE_PROTECTION);
 }
 
-/* static */ bool AIGroup::GetAutoReplaceProtection(GroupID group_id)
+/* static */ bool ScriptGroup::GetAutoReplaceProtection(GroupID group_id)
 {
 	if (!IsValidGroup(group_id)) return false;
 
 	return ::Group::Get(group_id)->replace_protection;
 }
 
-/* static */ int32 AIGroup::GetNumEngines(GroupID group_id, EngineID engine_id)
+/* static */ int32 ScriptGroup::GetNumEngines(GroupID group_id, EngineID engine_id)
 {
 	if (!IsValidGroup(group_id) && group_id != GROUP_DEFAULT && group_id != GROUP_ALL) return -1;
 
 	return GetGroupNumEngines(_current_company, group_id, engine_id);
 }
 
-/* static */ bool AIGroup::MoveVehicle(GroupID group_id, VehicleID vehicle_id)
+/* static */ bool ScriptGroup::MoveVehicle(GroupID group_id, VehicleID vehicle_id)
 {
 	EnforcePrecondition(false, IsValidGroup(group_id) || group_id == GROUP_DEFAULT);
-	EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id));
+	EnforcePrecondition(false, ScriptVehicle::IsValidVehicle(vehicle_id));
 
-	return AIObject::DoCommand(0, group_id, vehicle_id, CMD_ADD_VEHICLE_GROUP);
+	return ScriptObject::DoCommand(0, group_id, vehicle_id, CMD_ADD_VEHICLE_GROUP);
 }
 
-/* static */ bool AIGroup::EnableWagonRemoval(bool enable_removal)
+/* static */ bool ScriptGroup::EnableWagonRemoval(bool enable_removal)
 {
 	if (HasWagonRemoval() == enable_removal) return true;
 
-	return AIObject::DoCommand(0, ::GetCompanySettingIndex("company.renew_keep_length"), enable_removal ? 1 : 0, CMD_CHANGE_COMPANY_SETTING);
+	return ScriptObject::DoCommand(0, ::GetCompanySettingIndex("company.renew_keep_length"), enable_removal ? 1 : 0, CMD_CHANGE_COMPANY_SETTING);
 }
 
-/* static */ bool AIGroup::HasWagonRemoval()
+/* static */ bool ScriptGroup::HasWagonRemoval()
 {
 	return ::Company::Get(_current_company)->settings.renew_keep_length;
 }
 
-/* static */ bool AIGroup::SetAutoReplace(GroupID group_id, EngineID engine_id_old, EngineID engine_id_new)
+/* static */ bool ScriptGroup::SetAutoReplace(GroupID group_id, EngineID engine_id_old, EngineID engine_id_new)
 {
 	EnforcePrecondition(false, IsValidGroup(group_id) || group_id == GROUP_DEFAULT || group_id == GROUP_ALL);
-	EnforcePrecondition(false, AIEngine::IsBuildable(engine_id_new));
+	EnforcePrecondition(false, ScriptEngine::IsBuildable(engine_id_new));
 
-	return AIObject::DoCommand(0, group_id << 16, (engine_id_new << 16) | engine_id_old, CMD_SET_AUTOREPLACE);
+	return ScriptObject::DoCommand(0, group_id << 16, (engine_id_new << 16) | engine_id_old, CMD_SET_AUTOREPLACE);
 }
 
-/* static */ EngineID AIGroup::GetEngineReplacement(GroupID group_id, EngineID engine_id)
+/* static */ EngineID ScriptGroup::GetEngineReplacement(GroupID group_id, EngineID engine_id)
 {
 	if (!IsValidGroup(group_id) && group_id != GROUP_DEFAULT && group_id != GROUP_ALL) return ::INVALID_ENGINE;
 
 	return ::EngineReplacementForCompany(Company::Get(_current_company), engine_id, group_id);
 }
 
-/* static */ bool AIGroup::StopAutoReplace(GroupID group_id, EngineID engine_id)
+/* static */ bool ScriptGroup::StopAutoReplace(GroupID group_id, EngineID engine_id)
 {
 	EnforcePrecondition(false, IsValidGroup(group_id) || group_id == GROUP_DEFAULT || group_id == GROUP_ALL);
 
-	return AIObject::DoCommand(0, group_id << 16, (::INVALID_ENGINE << 16) | engine_id, CMD_SET_AUTOREPLACE);
+	return ScriptObject::DoCommand(0, group_id << 16, (::INVALID_ENGINE << 16) | engine_id, CMD_SET_AUTOREPLACE);
 }
--- a/src/script/api/script_group.hpp
+++ b/src/script/api/script_group.hpp
@@ -17,7 +17,7 @@
 /**
  * Class that handles all group related functions.
  */
-class AIGroup : public AIObject {
+class ScriptGroup : public ScriptObject {
 public:
 	/**
 	 * The group IDs of some special groups.
@@ -44,7 +44,7 @@
 	 *  it failed. Check the return value using IsValidGroup(). In test-mode
 	 *  0 is returned if it was successful; any other value indicates failure.
 	 */
-	static GroupID CreateGroup(AIVehicle::VehicleType vehicle_type);
+	static GroupID CreateGroup(ScriptVehicle::VehicleType vehicle_type);
 
 	/**
 	 * Delete the given group. When the deletion succeeds all vehicles in the
@@ -61,7 +61,7 @@
 	 * @pre IsValidGroup(group_id).
 	 * @return The vehicletype of the given group.
 	 */
-	static AIVehicle::VehicleType GetVehicleType(GroupID group_id);
+	static ScriptVehicle::VehicleType GetVehicleType(GroupID group_id);
 
 	/**
 	 * Set the name of a group.
@@ -70,7 +70,7 @@
 	 * @pre IsValidGroup(group_id).
 	 * @pre 'name' must have at least one character.
 	 * @pre 'name' must have at most 30 characters.
-	 * @exception AIError::ERR_NAME_IS_NOT_UNIQUE
+	 * @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
 	 * @return True if and only if the name was changed.
 	 */
 	static bool SetName(GroupID group_id, const char *name);
@@ -115,7 +115,7 @@
 	 * @param group_id The group to move the vehicel to.
 	 * @param vehicle_id The vehicle to move to the group.
 	 * @pre IsValidGroup(group_id) || group_id == GROUP_DEFAULT.
-	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
+	 * @pre ScriptVehicle::IsValidVehicle(vehicle_id).
 	 * @return True if and only if the vehicle was successfully moved to the group.
 	 * @note A vehicle can be in only one group at the same time. To remove it from
 	 *  a group, move it to another or to GROUP_DEFAULT. Moving the vehicle to the
@@ -146,7 +146,7 @@
 	 * @param engine_id_old The engine id to start replacing.
 	 * @param engine_id_new The engine id to replace with.
 	 * @pre IsValidGroup(group_id) || group_id == GROUP_DEFAULT || group_id == GROUP_ALL.
-	 * @pre AIEngine.IsBuildable(engine_id_new).
+	 * @pre ScriptEngine.IsBuildable(engine_id_new).
 	 * @return True if and if the replacing was successfully started.
 	 * @note To stop autoreplacing engine_id_old, call StopAutoReplace(group_id, engine_id_old).
 	 */
--- a/src/script/api/script_grouplist.cpp
+++ b/src/script/api/script_grouplist.cpp
@@ -7,14 +7,14 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_grouplist.cpp Implementation of AIGroupList and friends. */
+/** @file script_grouplist.cpp Implementation of ScriptGroupList and friends. */
 
 #include "../../stdafx.h"
 #include "script_grouplist.hpp"
 #include "../../company_func.h"
 #include "../../group.h"
 
-AIGroupList::AIGroupList()
+ScriptGroupList::ScriptGroupList()
 {
 	Group *g;
 	FOR_ALL_GROUPS(g) {
--- a/src/script/api/script_grouplist.hpp
+++ b/src/script/api/script_grouplist.hpp
@@ -16,12 +16,12 @@
 
 /**
  * Creates a list of groups of which you are the owner.
- * @note Neither AIGroup::GROUP_ALL nor AIGroup::GROUP_DEFAULT is in this list.
- * @ingroup AIList
+ * @note Neither ScriptGroup::GROUP_ALL nor ScriptGroup::GROUP_DEFAULT is in this list.
+ * @ingroup ScriptList
  */
-class AIGroupList : public AIList {
+class ScriptGroupList : public ScriptList {
 public:
-	AIGroupList();
+	ScriptGroupList();
 };
 
 #endif /* SCRIPT_GROUPLIST_HPP */
--- a/src/script/api/script_industry.cpp
+++ b/src/script/api/script_industry.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_industry.cpp Implementation of AIIndustry. */
+/** @file script_industry.cpp Implementation of ScriptIndustry. */
 
 #include "../../stdafx.h"
 #include "script_industry.hpp"
@@ -19,23 +19,23 @@
 #include "../../newgrf_industries.h"
 #include "table/strings.h"
 
-/* static */ int32 AIIndustry::GetIndustryCount()
+/* static */ int32 ScriptIndustry::GetIndustryCount()
 {
 	return (int32)::Industry::GetNumItems();
 }
 
-/* static */ bool AIIndustry::IsValidIndustry(IndustryID industry_id)
+/* static */ bool ScriptIndustry::IsValidIndustry(IndustryID industry_id)
 {
 	return ::Industry::IsValidID(industry_id);
 }
 
-/* static */ IndustryID AIIndustry::GetIndustryID(TileIndex tile)
+/* static */ IndustryID ScriptIndustry::GetIndustryID(TileIndex tile)
 {
 	if (!::IsValidTile(tile) || !::IsTileType(tile, MP_INDUSTRY)) return INVALID_INDUSTRY;
 	return ::GetIndustryIndex(tile);
 }
 
-/* static */ char *AIIndustry::GetName(IndustryID industry_id)
+/* static */ char *ScriptIndustry::GetName(IndustryID industry_id)
 {
 	if (!IsValidIndustry(industry_id)) return NULL;
 	static const int len = 64;
@@ -47,10 +47,10 @@
 	return industry_name;
 }
 
-/* static */ AIIndustry::CargoAcceptState AIIndustry::IsCargoAccepted(IndustryID industry_id, CargoID cargo_id)
+/* static */ ScriptIndustry::CargoAcceptState ScriptIndustry::IsCargoAccepted(IndustryID industry_id, CargoID cargo_id)
 {
 	if (!IsValidIndustry(industry_id)) return CAS_NOT_ACCEPTED;
-	if (!AICargo::IsValidCargo(cargo_id)) return CAS_NOT_ACCEPTED;
+	if (!ScriptCargo::IsValidCargo(cargo_id)) return CAS_NOT_ACCEPTED;
 
 	Industry *i = ::Industry::Get(industry_id);
 
@@ -64,10 +64,10 @@
 	return CAS_NOT_ACCEPTED;
 }
 
-/* static */ int32 AIIndustry::GetStockpiledCargo(IndustryID industry_id, CargoID cargo_id)
+/* static */ int32 ScriptIndustry::GetStockpiledCargo(IndustryID industry_id, CargoID cargo_id)
 {
 	if (!IsValidIndustry(industry_id)) return -1;
-	if (!AICargo::IsValidCargo(cargo_id)) return -1;
+	if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
 
 	Industry *ind = ::Industry::Get(industry_id);
 	for (uint i = 0; i < lengthof(ind->accepts_cargo); i++) {
@@ -80,10 +80,10 @@
 	return -1;
 }
 
-/* static */ int32 AIIndustry::GetLastMonthProduction(IndustryID industry_id, CargoID cargo_id)
+/* static */ int32 ScriptIndustry::GetLastMonthProduction(IndustryID industry_id, CargoID cargo_id)
 {
 	if (!IsValidIndustry(industry_id)) return -1;
-	if (!AICargo::IsValidCargo(cargo_id)) return -1;
+	if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
 
 	const Industry *i = ::Industry::Get(industry_id);
 
@@ -94,10 +94,10 @@
 	return -1;
 }
 
-/* static */ int32 AIIndustry::GetLastMonthTransported(IndustryID industry_id, CargoID cargo_id)
+/* static */ int32 ScriptIndustry::GetLastMonthTransported(IndustryID industry_id, CargoID cargo_id)
 {
 	if (!IsValidIndustry(industry_id)) return -1;
-	if (!AICargo::IsValidCargo(cargo_id)) return -1;
+	if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
 
 	const Industry *i = ::Industry::Get(industry_id);
 
@@ -108,10 +108,10 @@
 	return -1;
 }
 
-/* static */ int32 AIIndustry::GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id)
+/* static */ int32 ScriptIndustry::GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id)
 {
 	if (!IsValidIndustry(industry_id)) return -1;
-	if (!AICargo::IsValidCargo(cargo_id)) return -1;
+	if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
 
 	const Industry *i = ::Industry::Get(industry_id);
 
@@ -122,14 +122,14 @@
 	return -1;
 }
 
-/* static */ TileIndex AIIndustry::GetLocation(IndustryID industry_id)
+/* static */ TileIndex ScriptIndustry::GetLocation(IndustryID industry_id)
 {
 	if (!IsValidIndustry(industry_id)) return INVALID_TILE;
 
 	return ::Industry::Get(industry_id)->location.tile;
 }
 
-/* static */ int32 AIIndustry::GetAmountOfStationsAround(IndustryID industry_id)
+/* static */ int32 ScriptIndustry::GetAmountOfStationsAround(IndustryID industry_id)
 {
 	if (!IsValidIndustry(industry_id)) return -1;
 
@@ -139,35 +139,35 @@
 	return (int32)stations.Length();
 }
 
-/* static */ int32 AIIndustry::GetDistanceManhattanToTile(IndustryID industry_id, TileIndex tile)
+/* static */ int32 ScriptIndustry::GetDistanceManhattanToTile(IndustryID industry_id, TileIndex tile)
 {
 	if (!IsValidIndustry(industry_id)) return -1;
 
-	return AIMap::DistanceManhattan(tile, GetLocation(industry_id));
+	return ScriptMap::DistanceManhattan(tile, GetLocation(industry_id));
 }
 
-/* static */ int32 AIIndustry::GetDistanceSquareToTile(IndustryID industry_id, TileIndex tile)
+/* static */ int32 ScriptIndustry::GetDistanceSquareToTile(IndustryID industry_id, TileIndex tile)
 {
 	if (!IsValidIndustry(industry_id)) return -1;
 
-	return AIMap::DistanceSquare(tile, GetLocation(industry_id));
+	return ScriptMap::DistanceSquare(tile, GetLocation(industry_id));
 }
 
-/* static */ bool AIIndustry::IsBuiltOnWater(IndustryID industry_id)
+/* static */ bool ScriptIndustry::IsBuiltOnWater(IndustryID industry_id)
 {
 	if (!IsValidIndustry(industry_id)) return false;
 
 	return (::GetIndustrySpec(::Industry::Get(industry_id)->type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0;
 }
 
-/* static */ bool AIIndustry::HasHeliport(IndustryID industry_id)
+/* static */ bool ScriptIndustry::HasHeliport(IndustryID industry_id)
 {
 	if (!IsValidIndustry(industry_id)) return false;
 
 	return (::GetIndustrySpec(::Industry::Get(industry_id)->type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
 }
 
-/* static */ TileIndex AIIndustry::GetHeliportLocation(IndustryID industry_id)
+/* static */ TileIndex ScriptIndustry::GetHeliportLocation(IndustryID industry_id)
 {
 	if (!IsValidIndustry(industry_id)) return INVALID_TILE;
 	if (!HasHeliport(industry_id)) return INVALID_TILE;
@@ -182,14 +182,14 @@
 	return INVALID_TILE;
 }
 
-/* static */ bool AIIndustry::HasDock(IndustryID industry_id)
+/* static */ bool ScriptIndustry::HasDock(IndustryID industry_id)
 {
 	if (!IsValidIndustry(industry_id)) return false;
 
 	return (::GetIndustrySpec(::Industry::Get(industry_id)->type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
 }
 
-/* static */ TileIndex AIIndustry::GetDockLocation(IndustryID industry_id)
+/* static */ TileIndex ScriptIndustry::GetDockLocation(IndustryID industry_id)
 {
 	if (!IsValidIndustry(industry_id)) return INVALID_TILE;
 	if (!HasDock(industry_id)) return INVALID_TILE;
@@ -204,7 +204,7 @@
 	return INVALID_TILE;
 }
 
-/* static */ IndustryType AIIndustry::GetIndustryType(IndustryID industry_id)
+/* static */ IndustryType ScriptIndustry::GetIndustryType(IndustryID industry_id)
 {
 	if (!IsValidIndustry(industry_id)) return INVALID_INDUSTRYTYPE;
 
--- a/src/script/api/script_industry.hpp
+++ b/src/script/api/script_industry.hpp
@@ -17,7 +17,7 @@
 /**
  * Class that handles all industry related functions.
  */
-class AIIndustry : public AIObject {
+class ScriptIndustry : public ScriptObject {
 public:
 	/** Ways for an industry to accept a cargo. */
 	enum CargoAcceptState {
@@ -63,7 +63,7 @@
 	 * @param industry_id The index of the industry.
 	 * @param cargo_id The index of the cargo.
 	 * @pre IsValidIndustry(industry_id).
-	 * @pre AICargo::IsValidCargo(cargo_id).
+	 * @pre ScriptCargo::IsValidCargo(cargo_id).
 	 * @return Whether the industry accepts, temporarily refuses or never accepts this cargo.
 	 */
 	static CargoAcceptState IsCargoAccepted(IndustryID industry_id, CargoID cargo_id);
@@ -73,7 +73,7 @@
 	 * @param industry_id The index of the industry.
 	 * @param cargo_id The index of the cargo.
 	 * @pre IsValidIndustry(industry_id).
-	 * @pre AICargo::IsValidCargo(cargo_id).
+	 * @pre ScriptCargo::IsValidCargo(cargo_id).
 	 * @return The amount of cargo that is waiting for processing.
 	 */
 	static int32 GetStockpiledCargo(IndustryID industry_id, CargoID cargo_id);
@@ -83,7 +83,7 @@
 	 * @param industry_id The index of the industry.
 	 * @param cargo_id The index of the cargo.
 	 * @pre IsValidIndustry(industry_id).
-	 * @pre AICargo::IsValidCargo(cargo_id).
+	 * @pre ScriptCargo::IsValidCargo(cargo_id).
 	 * @return The last month's production of the given cargo for this industry.
 	 */
 	static int32 GetLastMonthProduction(IndustryID industry_id, CargoID cargo_id);
@@ -93,7 +93,7 @@
 	 * @param industry_id The index of the industry.
 	 * @param cargo_id The index of the cargo.
 	 * @pre IsValidIndustry(industry_id).
-	 * @pre AICargo::IsValidCargo(cargo_id).
+	 * @pre ScriptCargo::IsValidCargo(cargo_id).
 	 * @return The amount of given cargo transported from this industry last month.
 	 */
 	static int32 GetLastMonthTransported(IndustryID industry_id, CargoID cargo_id);
@@ -103,7 +103,7 @@
 	 * @param industry_id The index of the industry.
 	 * @param cargo_id The index of the cargo.
 	 * @pre IsValidIndustry(industry_id).
-	 * @pre AICargo::IsValidCargo(cargo_id).
+	 * @pre ScriptCargo::IsValidCargo(cargo_id).
 	 * @return The percentage of given cargo transported from this industry last month.
 	 */
 	static int32 GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id);
@@ -127,23 +127,23 @@
 	static int32 GetAmountOfStationsAround(IndustryID industry_id);
 
 	/**
-	 * Get the manhattan distance from the tile to the AIIndustry::GetLocation()
+	 * Get the manhattan distance from the tile to the ScriptIndustry::GetLocation()
 	 *  of the industry.
 	 * @param industry_id The industry to get the distance to.
 	 * @param tile The tile to get the distance to.
 	 * @pre IsValidIndustry(industry_id).
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return The distance between industry and tile.
 	 */
 	static int32 GetDistanceManhattanToTile(IndustryID industry_id, TileIndex tile);
 
 	/**
-	 * Get the square distance from the tile to the AIIndustry::GetLocation()
+	 * Get the square distance from the tile to the ScriptIndustry::GetLocation()
 	 *  of the industry.
 	 * @param industry_id The industry to get the distance to.
 	 * @param tile The tile to get the distance to.
 	 * @pre IsValidIndustry(industry_id).
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return The distance between industry and tile.
 	 */
 	static int32 GetDistanceSquareToTile(IndustryID industry_id, TileIndex tile);
--- a/src/script/api/script_industrylist.cpp
+++ b/src/script/api/script_industrylist.cpp
@@ -7,13 +7,13 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_industrylist.cpp Implementation of AIIndustryList and friends. */
+/** @file script_industrylist.cpp Implementation of ScriptIndustryList and friends. */
 
 #include "../../stdafx.h"
 #include "script_industrylist.hpp"
 #include "../../industry.h"
 
-AIIndustryList::AIIndustryList()
+ScriptIndustryList::ScriptIndustryList()
 {
 	Industry *i;
 	FOR_ALL_INDUSTRIES(i) {
@@ -21,7 +21,7 @@
 	}
 }
 
-AIIndustryList_CargoAccepting::AIIndustryList_CargoAccepting(CargoID cargo_id)
+ScriptIndustryList_CargoAccepting::ScriptIndustryList_CargoAccepting(CargoID cargo_id)
 {
 	const Industry *i;
 
@@ -32,7 +32,7 @@
 	}
 }
 
-AIIndustryList_CargoProducing::AIIndustryList_CargoProducing(CargoID cargo_id)
+ScriptIndustryList_CargoProducing::ScriptIndustryList_CargoProducing(CargoID cargo_id)
 {
 	const Industry *i;
 
--- a/src/script/api/script_industrylist.hpp
+++ b/src/script/api/script_industrylist.hpp
@@ -16,36 +16,36 @@
 
 /**
  * Creates a list of industries that are currently on the map.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIIndustryList : public AIList {
+class ScriptIndustryList : public ScriptList {
 public:
-	AIIndustryList();
+	ScriptIndustryList();
 };
 
 /**
  * Creates a list of industries that accepts a given cargo.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIIndustryList_CargoAccepting : public AIList {
+class ScriptIndustryList_CargoAccepting : public ScriptList {
 public:
 	/**
 	 * @param cargo_id The cargo this industry should accept.
 	 */
-	AIIndustryList_CargoAccepting(CargoID cargo_id);
+	ScriptIndustryList_CargoAccepting(CargoID cargo_id);
 };
 
 /**
  * Creates a list of industries that can produce a given cargo.
  * @note It also contains industries that currently produces 0 units of the cargo.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIIndustryList_CargoProducing : public AIList {
+class ScriptIndustryList_CargoProducing : public ScriptList {
 public:
 	/**
 	 * @param cargo_id The cargo this industry should produce.
 	 */
-	AIIndustryList_CargoProducing(CargoID cargo_id);
+	ScriptIndustryList_CargoProducing(CargoID cargo_id);
 };
 
 #endif /* SCRIPT_INDUSTRYLIST_HPP */
--- a/src/script/api/script_industrytype.cpp
+++ b/src/script/api/script_industrytype.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_industrytype.cpp Implementation of AIIndustryType. */
+/** @file script_industrytype.cpp Implementation of ScriptIndustryType. */
 
 #include "../../stdafx.h"
 #include "script_industrytype.hpp"
@@ -18,21 +18,21 @@
 #include "../../newgrf_industries.h"
 #include "../../core/random_func.hpp"
 
-/* static */ bool AIIndustryType::IsValidIndustryType(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::IsValidIndustryType(IndustryType industry_type)
 {
 	if (industry_type >= NUM_INDUSTRYTYPES) return false;
 
 	return ::GetIndustrySpec(industry_type)->enabled;
 }
 
-/* static */ bool AIIndustryType::IsRawIndustry(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::IsRawIndustry(IndustryType industry_type)
 {
 	if (!IsValidIndustryType(industry_type)) return false;
 
 	return ::GetIndustrySpec(industry_type)->IsRawIndustry();
 }
 
-/* static */ bool AIIndustryType::ProductionCanIncrease(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::ProductionCanIncrease(IndustryType industry_type)
 {
 	if (!IsValidIndustryType(industry_type)) return false;
 
@@ -40,7 +40,7 @@
 	return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_DONT_INCR_PROD) == 0;
 }
 
-/* static */ Money AIIndustryType::GetConstructionCost(IndustryType industry_type)
+/* static */ Money ScriptIndustryType::GetConstructionCost(IndustryType industry_type)
 {
 	if (!IsValidIndustryType(industry_type)) return -1;
 	if (::GetIndustrySpec(industry_type)->IsRawIndustry() && _settings_game.construction.raw_industry_construction == 0) return -1;
@@ -48,7 +48,7 @@
 	return ::GetIndustrySpec(industry_type)->GetConstructionCost();
 }
 
-/* static */ char *AIIndustryType::GetName(IndustryType industry_type)
+/* static */ char *ScriptIndustryType::GetName(IndustryType industry_type)
 {
 	if (!IsValidIndustryType(industry_type)) return NULL;
 	static const int len = 64;
@@ -59,13 +59,13 @@
 	return industrytype_name;
 }
 
-/* static */ AIList *AIIndustryType::GetProducedCargo(IndustryType industry_type)
+/* static */ ScriptList *ScriptIndustryType::GetProducedCargo(IndustryType industry_type)
 {
 	if (!IsValidIndustryType(industry_type)) return NULL;
 
 	const IndustrySpec *ins = ::GetIndustrySpec(industry_type);
 
-	AIList *list = new AIList();
+	ScriptList *list = new ScriptList();
 	for (size_t i = 0; i < lengthof(ins->produced_cargo); i++) {
 		if (ins->produced_cargo[i] != CT_INVALID) list->AddItem(ins->produced_cargo[i]);
 	}
@@ -73,13 +73,13 @@
 	return list;
 }
 
-/* static */ AIList *AIIndustryType::GetAcceptedCargo(IndustryType industry_type)
+/* static */ ScriptList *ScriptIndustryType::GetAcceptedCargo(IndustryType industry_type)
 {
 	if (!IsValidIndustryType(industry_type)) return NULL;
 
 	const IndustrySpec *ins = ::GetIndustrySpec(industry_type);
 
-	AIList *list = new AIList();
+	ScriptList *list = new ScriptList();
 	for (size_t i = 0; i < lengthof(ins->accepts_cargo); i++) {
 		if (ins->accepts_cargo[i] != CT_INVALID) list->AddItem(ins->accepts_cargo[i]);
 	}
@@ -87,7 +87,7 @@
 	return list;
 }
 
-/* static */ bool AIIndustryType::CanBuildIndustry(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::CanBuildIndustry(IndustryType industry_type)
 {
 	if (!IsValidIndustryType(industry_type)) return false;
 
@@ -98,7 +98,7 @@
 	return _settings_game.construction.raw_industry_construction == 1;
 }
 
-/* static */ bool AIIndustryType::CanProspectIndustry(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::CanProspectIndustry(IndustryType industry_type)
 {
 	if (!IsValidIndustryType(industry_type)) return false;
 
@@ -109,38 +109,38 @@
 	return _settings_game.construction.raw_industry_construction == 2;
 }
 
-/* static */ bool AIIndustryType::BuildIndustry(IndustryType industry_type, TileIndex tile)
+/* static */ bool ScriptIndustryType::BuildIndustry(IndustryType industry_type, TileIndex tile)
 {
 	EnforcePrecondition(false, CanBuildIndustry(industry_type));
-	EnforcePrecondition(false, AIMap::IsValidTile(tile));
+	EnforcePrecondition(false, ScriptMap::IsValidTile(tile));
 
 	uint32 seed = ::InteractiveRandom();
-	return AIObject::DoCommand(tile, (::InteractiveRandomRange(::GetIndustrySpec(industry_type)->num_table) << 8) | industry_type, seed, CMD_BUILD_INDUSTRY);
+	return ScriptObject::DoCommand(tile, (::InteractiveRandomRange(::GetIndustrySpec(industry_type)->num_table) << 8) | industry_type, seed, CMD_BUILD_INDUSTRY);
 }
 
-/* static */ bool AIIndustryType::ProspectIndustry(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::ProspectIndustry(IndustryType industry_type)
 {
 	EnforcePrecondition(false, CanProspectIndustry(industry_type));
 
 	uint32 seed = ::InteractiveRandom();
-	return AIObject::DoCommand(0, industry_type, seed, CMD_BUILD_INDUSTRY);
+	return ScriptObject::DoCommand(0, industry_type, seed, CMD_BUILD_INDUSTRY);
 }
 
-/* static */ bool AIIndustryType::IsBuiltOnWater(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::IsBuiltOnWater(IndustryType industry_type)
 {
 	if (!IsValidIndustryType(industry_type)) return false;
 
 	return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0;
 }
 
-/* static */ bool AIIndustryType::HasHeliport(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::HasHeliport(IndustryType industry_type)
 {
 	if (!IsValidIndustryType(industry_type)) return false;
 
 	return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
 }
 
-/* static */ bool AIIndustryType::HasDock(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::HasDock(IndustryType industry_type)
 {
 	if (!IsValidIndustryType(industry_type)) return false;
 
--- a/src/script/api/script_industrytype.hpp
+++ b/src/script/api/script_industrytype.hpp
@@ -17,14 +17,14 @@
 /**
  * Class that handles all industry-type related functions.
  */
-class AIIndustryType : public AIObject {
+class ScriptIndustryType : public ScriptObject {
 public:
 	/**
 	 * Special IndustryTypes.
 	 */
 	enum SpecialIndustryType {
-		INDUSTRYTYPE_UNKNOWN = 0xFE, ///< Unknown/unspecific industrytype. (Usable for AIRail::BuildNewGRFRailStation())
-		INDUSTRYTYPE_TOWN    = 0xFF, ///< No industry, but town. (Usable for AIRail::BuildNewGRFRailStation())
+		INDUSTRYTYPE_UNKNOWN = 0xFE, ///< Unknown/unspecific industrytype. (Usable for ScriptRail::BuildNewGRFRailStation())
+		INDUSTRYTYPE_TOWN    = 0xFF, ///< No industry, but town. (Usable for ScriptRail::BuildNewGRFRailStation())
 	};
 
 	/**
@@ -50,7 +50,7 @@
 	 * @pre IsValidIndustryType(industry_type).
 	 * @return The CargoIDs of all cargotypes this industry could produce.
 	 */
-	static AIList *GetProducedCargo(IndustryType industry_type);
+	static ScriptList *GetProducedCargo(IndustryType industry_type);
 
 	/**
 	 * Get a list of CargoID accepted by this industry-type.
@@ -60,7 +60,7 @@
 	 * @pre IsValidIndustryType(industry_type).
 	 * @return The CargoIDs of all cargotypes this industry accepts.
 	 */
-	static AIList *GetAcceptedCargo(IndustryType industry_type);
+	static ScriptList *GetAcceptedCargo(IndustryType industry_type);
 
 	/**
 	 * Is this industry type a raw industry?
--- a/src/script/api/script_industrytypelist.cpp
+++ b/src/script/api/script_industrytypelist.cpp
@@ -7,15 +7,15 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_industrytypelist.cpp Implementation of AIIndustryTypeList. */
+/** @file script_industrytypelist.cpp Implementation of ScriptIndustryTypeList. */
 
 #include "../../stdafx.h"
 #include "script_industrytypelist.hpp"
 #include "../../industry.h"
 
-AIIndustryTypeList::AIIndustryTypeList()
+ScriptIndustryTypeList::ScriptIndustryTypeList()
 {
 	for (int i = 0; i < NUM_INDUSTRYTYPES; i++) {
-		if (AIIndustryType::IsValidIndustryType(i)) this->AddItem(i);
+		if (ScriptIndustryType::IsValidIndustryType(i)) this->AddItem(i);
 	}
 }
--- a/src/script/api/script_industrytypelist.hpp
+++ b/src/script/api/script_industrytypelist.hpp
@@ -16,11 +16,11 @@
 
 /**
  * Creates a list of valid industry types.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIIndustryTypeList : public AIList {
+class ScriptIndustryTypeList : public ScriptList {
 public:
-	AIIndustryTypeList();
+	ScriptIndustryTypeList();
 };
 
 
--- a/src/script/api/script_list.cpp
+++ b/src/script/api/script_list.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_list.cpp Implementation of AIList. */
+/** @file script_list.cpp Implementation of ScriptList. */
 
 #include "../../stdafx.h"
 #include "script_list.hpp"
@@ -15,11 +15,11 @@
 #include "../../script/squirrel.hpp"
 
 /**
- * Base class for any AIList sorter.
+ * Base class for any ScriptList sorter.
  */
-class AIListSorter {
+class ScriptListSorter {
 protected:
-	AIList *list;           ///< The list that's being sorted.
+	ScriptList *list;           ///< The list that's being sorted.
 	bool has_no_more_items; ///< Whether we have more items to iterate over.
 	int32 item_next;        ///< The next item we will show.
 
@@ -27,7 +27,7 @@
 	/**
 	 * Virtual dtor, needed to mute warnings.
 	 */
-	virtual ~AIListSorter() { }
+	virtual ~ScriptListSorter() { }
 
 	/**
 	 * Get the first item of the sorter.
@@ -61,18 +61,18 @@
 /**
  * Sort by value, ascending.
  */
-class AIListSorterValueAscending : public AIListSorter {
+class ScriptListSorterValueAscending : public ScriptListSorter {
 private:
-	AIList::AIListBucket::iterator bucket_iter;    ///< The iterator over the list to find the buckets.
-	AIList::AIItemList *bucket_list;               ///< The current bucket list we're iterator over.
-	AIList::AIItemList::iterator bucket_list_iter; ///< The iterator over the bucket list.
+	ScriptList::ScriptListBucket::iterator bucket_iter;    ///< The iterator over the list to find the buckets.
+	ScriptList::AIItemList *bucket_list;               ///< The current bucket list we're iterator over.
+	ScriptList::AIItemList::iterator bucket_list_iter; ///< The iterator over the bucket list.
 
 public:
 	/**
 	 * Create a new sorter.
 	 * @param list The list to sort.
 	 */
-	AIListSorterValueAscending(AIList *list)
+	ScriptListSorterValueAscending(ScriptList *list)
 	{
 		this->list = list;
 		this->End();
@@ -147,18 +147,18 @@
 /**
  * Sort by value, descending.
  */
-class AIListSorterValueDescending : public AIListSorter {
+class ScriptListSorterValueDescending : public ScriptListSorter {
 private:
-	AIList::AIListBucket::iterator bucket_iter;    ///< The iterator over the list to find the buckets.
-	AIList::AIItemList *bucket_list;               ///< The current bucket list we're iterator over.
-	AIList::AIItemList::iterator bucket_list_iter; ///< The iterator over the bucket list.
+	ScriptList::ScriptListBucket::iterator bucket_iter;    ///< The iterator over the list to find the buckets.
+	ScriptList::AIItemList *bucket_list;               ///< The current bucket list we're iterator over.
+	ScriptList::AIItemList::iterator bucket_list_iter; ///< The iterator over the bucket list.
 
 public:
 	/**
 	 * Create a new sorter.
 	 * @param list The list to sort.
 	 */
-	AIListSorterValueDescending(AIList *list)
+	ScriptListSorterValueDescending(ScriptList *list)
 	{
 		this->list = list;
 		this->End();
@@ -241,16 +241,16 @@
 /**
  * Sort by item, ascending.
  */
-class AIListSorterItemAscending : public AIListSorter {
+class ScriptListSorterItemAscending : public ScriptListSorter {
 private:
-	AIList::AIListMap::iterator item_iter; ///< The iterator over the items in the map.
+	ScriptList::ScriptListMap::iterator item_iter; ///< The iterator over the items in the map.
 
 public:
 	/**
 	 * Create a new sorter.
 	 * @param list The list to sort.
 	 */
-	AIListSorterItemAscending(AIList *list)
+	ScriptListSorterItemAscending(ScriptList *list)
 	{
 		this->list = list;
 		this->End();
@@ -311,16 +311,16 @@
 /**
  * Sort by item, descending.
  */
-class AIListSorterItemDescending : public AIListSorter {
+class ScriptListSorterItemDescending : public ScriptListSorter {
 private:
-	AIList::AIListMap::iterator item_iter; ///< The iterator over the items in the map.
+	ScriptList::ScriptListMap::iterator item_iter; ///< The iterator over the items in the map.
 
 public:
 	/**
 	 * Create a new sorter.
 	 * @param list The list to sort.
 	 */
-	AIListSorterItemDescending(AIList *list)
+	ScriptListSorterItemDescending(ScriptList *list)
 	{
 		this->list = list;
 		this->End();
@@ -381,27 +381,27 @@
 
 
 
-AIList::AIList()
+ScriptList::ScriptList()
 {
 	/* Default sorter */
-	this->sorter         = new AIListSorterValueDescending(this);
+	this->sorter         = new ScriptListSorterValueDescending(this);
 	this->sorter_type    = SORT_BY_VALUE;
 	this->sort_ascending = false;
 	this->initialized    = false;
 	this->modifications  = 0;
 }
 
-AIList::~AIList()
+ScriptList::~ScriptList()
 {
 	delete this->sorter;
 }
 
-bool AIList::HasItem(int32 item)
+bool ScriptList::HasItem(int32 item)
 {
 	return this->items.count(item) == 1;
 }
 
-void AIList::Clear()
+void ScriptList::Clear()
 {
 	this->modifications++;
 
@@ -410,7 +410,7 @@
 	this->sorter->End();
 }
 
-void AIList::AddItem(int32 item, int32 value)
+void ScriptList::AddItem(int32 item, int32 value)
 {
 	this->modifications++;
 
@@ -422,7 +422,7 @@
 	this->SetValue(item, value);
 }
 
-void AIList::RemoveItem(int32 item)
+void ScriptList::RemoveItem(int32 item)
 {
 	this->modifications++;
 
@@ -436,13 +436,13 @@
 	this->items.erase(item);
 }
 
-int32 AIList::Begin()
+int32 ScriptList::Begin()
 {
 	this->initialized = true;
 	return this->sorter->Begin();
 }
 
-int32 AIList::Next()
+int32 ScriptList::Next()
 {
 	if (this->initialized == false) {
 		DEBUG(ai, 0, "Next() is invalid as Begin() is never called");
@@ -451,12 +451,12 @@
 	return this->sorter->Next();
 }
 
-bool AIList::IsEmpty()
+bool ScriptList::IsEmpty()
 {
 	return this->items.empty();
 }
 
-bool AIList::IsEnd()
+bool ScriptList::IsEnd()
 {
 	if (this->initialized == false) {
 		DEBUG(ai, 0, "IsEnd() is invalid as Begin() is never called");
@@ -465,19 +465,19 @@
 	return this->sorter->IsEnd();
 }
 
-int32 AIList::Count()
+int32 ScriptList::Count()
 {
 	return (int32)this->items.size();
 }
 
-int32 AIList::GetValue(int32 item)
+int32 ScriptList::GetValue(int32 item)
 {
 	if (!this->HasItem(item)) return 0;
 
 	return this->items[item];
 }
 
-bool AIList::SetValue(int32 item, int32 value)
+bool ScriptList::SetValue(int32 item, int32 value)
 {
 	this->modifications++;
 
@@ -495,7 +495,7 @@
 	return true;
 }
 
-void AIList::Sort(SorterType sorter, bool ascending)
+void ScriptList::Sort(SorterType sorter, bool ascending)
 {
 	this->modifications++;
 
@@ -506,17 +506,17 @@
 	switch (sorter) {
 		case SORT_BY_ITEM:
 			if (ascending) {
-				this->sorter = new AIListSorterItemAscending(this);
+				this->sorter = new ScriptListSorterItemAscending(this);
 			} else {
-				this->sorter = new AIListSorterItemDescending(this);
+				this->sorter = new ScriptListSorterItemDescending(this);
 			}
 			break;
 
 		case SORT_BY_VALUE:
 			if (ascending) {
-				this->sorter = new AIListSorterValueAscending(this);
+				this->sorter = new ScriptListSorterValueAscending(this);
 			} else {
-				this->sorter = new AIListSorterValueDescending(this);
+				this->sorter = new ScriptListSorterValueDescending(this);
 			}
 			break;
 
@@ -529,56 +529,56 @@
 	this->initialized    = false;
 }
 
-void AIList::AddList(AIList *list)
+void ScriptList::AddList(ScriptList *list)
 {
-	AIListMap *list_items = &list->items;
-	for (AIListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) {
+	ScriptListMap *list_items = &list->items;
+	for (ScriptListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) {
 		this->AddItem((*iter).first);
 		this->SetValue((*iter).first, (*iter).second);
 	}
 }
 
-void AIList::RemoveAboveValue(int32 value)
+void ScriptList::RemoveAboveValue(int32 value)
 {
 	this->modifications++;
 
-	for (AIListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
+	for (ScriptListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
 		next_iter = iter; next_iter++;
 		if ((*iter).second > value) this->RemoveItem((*iter).first);
 	}
 }
 
-void AIList::RemoveBelowValue(int32 value)
+void ScriptList::RemoveBelowValue(int32 value)
 {
 	this->modifications++;
 
-	for (AIListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
+	for (ScriptListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
 		next_iter = iter; next_iter++;
 		if ((*iter).second < value) this->RemoveItem((*iter).first);
 	}
 }
 
-void AIList::RemoveBetweenValue(int32 start, int32 end)
+void ScriptList::RemoveBetweenValue(int32 start, int32 end)
 {
 	this->modifications++;
 
-	for (AIListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
+	for (ScriptListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
 		next_iter = iter; next_iter++;
 		if ((*iter).second > start && (*iter).second < end) this->RemoveItem((*iter).first);
 	}
 }
 
-void AIList::RemoveValue(int32 value)
+void ScriptList::RemoveValue(int32 value)
 {
 	this->modifications++;
 
-	for (AIListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
+	for (ScriptListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
 		next_iter = iter; next_iter++;
 		if ((*iter).second == value) this->RemoveItem((*iter).first);
 	}
 }
 
-void AIList::RemoveTop(int32 count)
+void ScriptList::RemoveTop(int32 count)
 {
 	this->modifications++;
 
@@ -592,7 +592,7 @@
 	switch (this->sorter_type) {
 		default: NOT_REACHED();
 		case SORT_BY_VALUE:
-			for (AIListBucket::iterator iter = this->buckets.begin(); iter != this->buckets.end(); iter = this->buckets.begin()) {
+			for (ScriptListBucket::iterator iter = this->buckets.begin(); iter != this->buckets.end(); iter = this->buckets.begin()) {
 				AIItemList *items = &(*iter).second;
 				size_t size = items->size();
 				for (AIItemList::iterator iter = items->begin(); iter != items->end(); iter = items->begin()) {
@@ -607,7 +607,7 @@
 			break;
 
 		case SORT_BY_ITEM:
-			for (AIListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter = this->items.begin()) {
+			for (ScriptListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter = this->items.begin()) {
 				if (--count < 0) return;
 				this->RemoveItem((*iter).first);
 			}
@@ -615,7 +615,7 @@
 	}
 }
 
-void AIList::RemoveBottom(int32 count)
+void ScriptList::RemoveBottom(int32 count)
 {
 	this->modifications++;
 
@@ -629,7 +629,7 @@
 	switch (this->sorter_type) {
 		default: NOT_REACHED();
 		case SORT_BY_VALUE:
-			for (AIListBucket::reverse_iterator iter = this->buckets.rbegin(); iter != this->buckets.rend(); iter = this->buckets.rbegin()) {
+			for (ScriptListBucket::reverse_iterator iter = this->buckets.rbegin(); iter != this->buckets.rend(); iter = this->buckets.rbegin()) {
 				AIItemList *items = &(*iter).second;
 				size_t size = items->size();
 				for (AIItemList::reverse_iterator iter = items->rbegin(); iter != items->rend(); iter = items->rbegin()) {
@@ -643,7 +643,7 @@
 			}
 
 		case SORT_BY_ITEM:
-			for (AIListMap::reverse_iterator iter = this->items.rbegin(); iter != this->items.rend(); iter = this->items.rbegin()) {
+			for (ScriptListMap::reverse_iterator iter = this->items.rbegin(); iter != this->items.rend(); iter = this->items.rbegin()) {
 				if (--count < 0) return;
 				this->RemoveItem((*iter).first);
 			}
@@ -651,76 +651,76 @@
 	}
 }
 
-void AIList::RemoveList(AIList *list)
+void ScriptList::RemoveList(ScriptList *list)
 {
 	this->modifications++;
 
-	AIListMap *list_items = &list->items;
-	for (AIListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) {
+	ScriptListMap *list_items = &list->items;
+	for (ScriptListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) {
 		this->RemoveItem((*iter).first);
 	}
 }
 
-void AIList::KeepAboveValue(int32 value)
+void ScriptList::KeepAboveValue(int32 value)
 {
 	this->modifications++;
 
-	for (AIListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
+	for (ScriptListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
 		next_iter = iter; next_iter++;
 		if ((*iter).second <= value) this->RemoveItem((*iter).first);
 	}
 }
 
-void AIList::KeepBelowValue(int32 value)
+void ScriptList::KeepBelowValue(int32 value)
 {
 	this->modifications++;
 
-	for (AIListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
+	for (ScriptListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
 		next_iter = iter; next_iter++;
 		if ((*iter).second >= value) this->RemoveItem((*iter).first);
 	}
 }
 
-void AIList::KeepBetweenValue(int32 start, int32 end)
+void ScriptList::KeepBetweenValue(int32 start, int32 end)
 {
 	this->modifications++;
 
-	for (AIListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
+	for (ScriptListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
 		next_iter = iter; next_iter++;
 		if ((*iter).second <= start || (*iter).second >= end) this->RemoveItem((*iter).first);
 	}
 }
 
-void AIList::KeepValue(int32 value)
+void ScriptList::KeepValue(int32 value)
 {
 	this->modifications++;
 
-	for (AIListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
+	for (ScriptListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
 		next_iter = iter; next_iter++;
 		if ((*iter).second != value) this->RemoveItem((*iter).first);
 	}
 }
 
-void AIList::KeepTop(int32 count)
+void ScriptList::KeepTop(int32 count)
 {
 	this->modifications++;
 
 	this->RemoveBottom(this->Count() - count);
 }
 
-void AIList::KeepBottom(int32 count)
+void ScriptList::KeepBottom(int32 count)
 {
 	this->modifications++;
 
 	this->RemoveTop(this->Count() - count);
 }
 
-void AIList::KeepList(AIList *list)
+void ScriptList::KeepList(ScriptList *list)
 {
 	this->modifications++;
 
-	AIList tmp;
-	for (AIListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) {
+	ScriptList tmp;
+	for (ScriptListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) {
 		tmp.AddItem((*iter).first);
 		tmp.SetValue((*iter).first, (*iter).second);
 	}
@@ -729,7 +729,7 @@
 	this->RemoveList(&tmp);
 }
 
-SQInteger AIList::_get(HSQUIRRELVM vm)
+SQInteger ScriptList::_get(HSQUIRRELVM vm)
 {
 	if (sq_gettype(vm, 2) != OT_INTEGER) return SQ_ERROR;
 
@@ -742,7 +742,7 @@
 	return 1;
 }
 
-SQInteger AIList::_set(HSQUIRRELVM vm)
+SQInteger ScriptList::_set(HSQUIRRELVM vm)
 {
 	if (sq_gettype(vm, 2) != OT_INTEGER) return SQ_ERROR;
 	if (sq_gettype(vm, 3) != OT_INTEGER || sq_gettype(vm, 3) == OT_NULL) {
@@ -766,7 +766,7 @@
 	return 0;
 }
 
-SQInteger AIList::_nexti(HSQUIRRELVM vm)
+SQInteger ScriptList::_nexti(HSQUIRRELVM vm)
 {
 	if (sq_gettype(vm, 2) == OT_NULL) {
 		if (this->IsEmpty()) {
@@ -790,15 +790,15 @@
 	return 1;
 }
 
-SQInteger AIList::Valuate(HSQUIRRELVM vm)
+SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
 {
 	this->modifications++;
 
-	/* The first parameter is the instance of AIList. */
+	/* The first parameter is the instance of ScriptList. */
 	int nparam = sq_gettop(vm) - 1;
 
 	if (nparam < 1) {
-		return sq_throwerror(vm, _SC("You need to give a least a Valuator as parameter to AIList::Valuate"));
+		return sq_throwerror(vm, _SC("You need to give a least a Valuator as parameter to ScriptList::Valuate"));
 	}
 
 	/* Make sure the valuator function is really a function, and not any
@@ -811,13 +811,13 @@
 
 	/* Don't allow docommand from a Valuator, as we can't resume in
 	 * mid C++-code. */
-	bool backup_allow = AIObject::GetAllowDoCommand();
-	AIObject::SetAllowDoCommand(false);
+	bool backup_allow = ScriptObject::GetAllowDoCommand();
+	ScriptObject::SetAllowDoCommand(false);
 
 	/* Push the function to call */
 	sq_push(vm, 2);
 
-	for (AIListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) {
+	for (ScriptListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) {
 		/* Check for changing of items. */
 		int previous_modification_count = this->modifications;
 
@@ -831,7 +831,7 @@
 
 		/* Call the function. Squirrel pops all parameters and pushes the return value. */
 		if (SQ_FAILED(sq_call(vm, nparam + 1, SQTrue, SQTrue))) {
-			AIObject::SetAllowDoCommand(backup_allow);
+			ScriptObject::SetAllowDoCommand(backup_allow);
 			return SQ_ERROR;
 		}
 
@@ -854,7 +854,7 @@
 				/* See below for explanation. The extra pop is the return value. */
 				sq_pop(vm, nparam + 4);
 
-				AIObject::SetAllowDoCommand(backup_allow);
+				ScriptObject::SetAllowDoCommand(backup_allow);
 				return sq_throwerror(vm, _SC("return value of valuator is not valid (not integer/bool)"));
 			}
 		}
@@ -864,7 +864,7 @@
 			/* See below for explanation. The extra pop is the return value. */
 			sq_pop(vm, nparam + 4);
 
-			AIObject::SetAllowDoCommand(backup_allow);
+			ScriptObject::SetAllowDoCommand(backup_allow);
 			return sq_throwerror(vm, _SC("modifying valuated list outside of valuator function"));
 		}
 
@@ -879,9 +879,9 @@
 	 * 1. The root stable (as instance object).
 	 * 2. The valuator function.
 	 * 3. The parameters given to this function.
-	 * 4. The AIList instance object. */
+	 * 4. The ScriptList instance object. */
 	sq_pop(vm, nparam + 3);
 
-	AIObject::SetAllowDoCommand(backup_allow);
+	ScriptObject::SetAllowDoCommand(backup_allow);
 	return 0;
 }
--- a/src/script/api/script_list.hpp
+++ b/src/script/api/script_list.hpp
@@ -8,7 +8,7 @@
  */
 
 /** @file script_list.hpp A list which can keep item/value pairs, which you can walk. */
-/** @defgroup AIList Classes that create a list of items. */
+/** @defgroup ScriptList Classes that create a list of items. */
 
 #ifndef SCRIPT_LIST_HPP
 #define SCRIPT_LIST_HPP
@@ -17,12 +17,12 @@
 #include <map>
 #include <set>
 
-class AIListSorter;
+class ScriptListSorter;
 
 /**
  * Class that creates a list which can keep item/value pairs, which you can walk.
  */
-class AIList : public AIObject {
+class ScriptList : public ScriptObject {
 public:
 	/** Type of sorter */
 	enum SorterType {
@@ -36,7 +36,7 @@
 	static const bool SORT_DESCENDING = false;
 
 private:
-	AIListSorter *sorter;         ///< Sorting algorithm
+	ScriptListSorter *sorter;         ///< Sorting algorithm
 	SorterType sorter_type;       ///< Sorting type
 	bool sort_ascending;          ///< Whether to sort ascending or descending
 	bool initialized;             ///< Whether an iteration has been started
@@ -44,14 +44,14 @@
 
 public:
 	typedef std::set<int32> AIItemList;               ///< The list of items inside the bucket
-	typedef std::map<int32, AIItemList> AIListBucket; ///< The bucket list per value
-	typedef std::map<int32, int32> AIListMap;         ///< List per item
+	typedef std::map<int32, AIItemList> ScriptListBucket; ///< The bucket list per value
+	typedef std::map<int32, int32> ScriptListMap;         ///< List per item
 
-	AIListMap items;           ///< The items in the list
-	AIListBucket buckets;      ///< The items in the list, sorted by value
+	ScriptListMap items;           ///< The items in the list
+	ScriptListBucket buckets;      ///< The items in the list, sorted by value
 
-	AIList();
-	~AIList();
+	ScriptList();
+	~ScriptList();
 
 	/**
 	 * Add a single item to the list.
@@ -146,7 +146,7 @@
 	 * @note If the item already exists inside the caller, the value of the
 	 *  list that is added is set on the item.
 	 */
-	void AddList(AIList *list);
+	void AddList(ScriptList *list);
 
 	/**
 	 * Removes all items with a higher value than 'value'.
@@ -190,7 +190,7 @@
 	 * @param list the list of items to remove.
 	 * @pre list != NULL
 	 */
-	void RemoveList(AIList *list);
+	void RemoveList(ScriptList *list);
 
 	/**
 	 * Keep all items with a higher value than 'value'.
@@ -234,7 +234,7 @@
 	 * @param list the list of items to keep.
 	 * @pre list != NULL
 	 */
-	void KeepList(AIList *list);
+	void KeepList(ScriptList *list);
 
 #ifndef DOXYGEN_AI_DOCS
 	/**
@@ -268,8 +268,8 @@
 	 *  the first parameter should be the index-value, and it should return
 	 *  an integer.
 	 * @note Example:
-	 *  list.Valuate(AIBridge.GetPrice, 5);
-	 *  list.Valuate(AIBridge.GetMaxLength);
+	 *  list.Valuate(ScriptBridge.GetPrice, 5);
+	 *  list.Valuate(ScriptBridge.GetMaxLength);
 	 *  function MyVal(bridge_id, myparam)
 	 *  {
 	 *    return myparam * bridge_id; // This is silly
--- a/src/script/api/script_log.cpp
+++ b/src/script/api/script_log.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_log.cpp Implementation of AILog. */
+/** @file script_log.cpp Implementation of ScriptLog. */
 
 #include "../../stdafx.h"
 #include "script_log.hpp"
@@ -16,34 +16,34 @@
 #include "../../debug.h"
 #include "../../window_func.h"
 
-/* static */ void AILog::Info(const char *message)
+/* static */ void ScriptLog::Info(const char *message)
 {
-	AILog::Log(LOG_INFO, message);
+	ScriptLog::Log(LOG_INFO, message);
 }
 
-/* static */ void AILog::Warning(const char *message)
+/* static */ void ScriptLog::Warning(const char *message)
 {
-	AILog::Log(LOG_WARNING, message);
+	ScriptLog::Log(LOG_WARNING, message);
 }
 
-/* static */ void AILog::Error(const char *message)
+/* static */ void ScriptLog::Error(const char *message)
 {
-	AILog::Log(LOG_ERROR, message);
+	ScriptLog::Log(LOG_ERROR, message);
 }
 
-/* static */ void AILog::Log(AILog::AILogType level, const char *message)
+/* static */ void ScriptLog::Log(ScriptLog::ScriptLogType level, const char *message)
 {
-	if (AIObject::GetLogPointer() == NULL) {
-		AIObject::GetLogPointer() = new LogData();
-		LogData *log = (LogData *)AIObject::GetLogPointer();
+	if (ScriptObject::GetLogPointer() == NULL) {
+		ScriptObject::GetLogPointer() = new LogData();
+		LogData *log = (LogData *)ScriptObject::GetLogPointer();
 
 		log->lines = CallocT<char *>(400);
-		log->type = CallocT<AILog::AILogType>(400);
+		log->type = CallocT<ScriptLog::ScriptLogType>(400);
 		log->count = 400;
 		log->pos = log->count - 1;
 		log->used = 0;
 	}
-	LogData *log = (LogData *)AIObject::GetLogPointer();
+	LogData *log = (LogData *)ScriptObject::GetLogPointer();
 
 	/* Go to the next log-line */
 	log->pos = (log->pos + 1) % log->count;
@@ -78,9 +78,9 @@
 	InvalidateWindowData(WC_AI_DEBUG, 0, _current_company);
 }
 
-/* static */ void AILog::FreeLogPointer()
+/* static */ void ScriptLog::FreeLogPointer()
 {
-	LogData *log = (LogData *)AIObject::GetLogPointer();
+	LogData *log = (LogData *)ScriptObject::GetLogPointer();
 
 	for (int i = 0; i < log->count; i++) {
 		free(log->lines[i]);
--- a/src/script/api/script_log.hpp
+++ b/src/script/api/script_log.hpp
@@ -17,10 +17,10 @@
 /**
  * Class that handles all log related functions.
  */
-class AILog : public AIObject {
-	/* AIController needs access to Enum and Log, in order to keep the flow from
+class ScriptLog : public ScriptObject {
+	/* ScriptController needs access to Enum and Log, in order to keep the flow from
 	 *  OpenTTD core to NoAI API clear and simple. */
-	friend class AIController;
+	friend class ScriptController;
 
 public:
 #ifndef EXPORT_SKIP
@@ -28,7 +28,7 @@
 	 * Log levels; The value is also feed to DEBUG() lvl.
 	 *  This has no use for you, as AI writer.
 	 */
-	enum AILogType {
+	enum ScriptLogType {
 		LOG_SQ_ERROR = 0, ///< Squirrel printed an error.
 		LOG_ERROR = 1,    ///< User printed an error.
 		LOG_SQ_INFO = 2,  ///< Squirrel printed some info.
@@ -42,7 +42,7 @@
 	 */
 	struct LogData {
 		char **lines;           ///< The log-lines.
-		AILog::AILogType *type; ///< Per line, which type of log it was.
+		ScriptLog::ScriptLogType *type; ///< Per line, which type of log it was.
 		int count;              ///< Total amount of log-lines possible.
 		int pos;                ///< Current position in lines.
 		int used;               ///< Total amount of used log-lines.
@@ -79,7 +79,7 @@
 	/**
 	 * Internal command to log the message in a common way.
 	 */
-	static void Log(AILog::AILogType level, const char *message);
+	static void Log(ScriptLog::ScriptLogType level, const char *message);
 };
 
 #endif /* SCRIPT_LOG_HPP */
--- a/src/script/api/script_map.cpp
+++ b/src/script/api/script_map.cpp
@@ -7,68 +7,68 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_map.cpp Implementation of AIMap. */
+/** @file script_map.cpp Implementation of ScriptMap. */
 
 #include "../../stdafx.h"
 #include "script_map.hpp"
 #include "../../tile_map.h"
 
-/* static */ bool AIMap::IsValidTile(TileIndex t)
+/* static */ bool ScriptMap::IsValidTile(TileIndex t)
 {
 	return ::IsValidTile(t);
 }
 
-/* static */ TileIndex AIMap::GetMapSize()
+/* static */ TileIndex ScriptMap::GetMapSize()
 {
 	return ::MapSize();
 }
 
-/* static */ uint32 AIMap::GetMapSizeX()
+/* static */ uint32 ScriptMap::GetMapSizeX()
 {
 	return ::MapSizeX();
 }
 
-/* static */ uint32 AIMap::GetMapSizeY()
+/* static */ uint32 ScriptMap::GetMapSizeY()
 {
 	return ::MapSizeY();
 }
 
-/* static */ int32 AIMap::GetTileX(TileIndex t)
+/* static */ int32 ScriptMap::GetTileX(TileIndex t)
 {
 	if (!::IsValidTile(t)) return -1;
 	return ::TileX(t);
 }
 
-/* static */ int32 AIMap::GetTileY(TileIndex t)
+/* static */ int32 ScriptMap::GetTileY(TileIndex t)
 {
 	if (!::IsValidTile(t)) return -1;
 	return ::TileY(t);
 }
 
-/* static */ TileIndex AIMap::GetTileIndex(uint32 x, uint32 y)
+/* static */ TileIndex ScriptMap::GetTileIndex(uint32 x, uint32 y)
 {
 	return ::TileXY(x, y);
 }
 
-/* static */ int32 AIMap::DistanceManhattan(TileIndex t1, TileIndex t2)
+/* static */ int32 ScriptMap::DistanceManhattan(TileIndex t1, TileIndex t2)
 {
 	if (!::IsValidTile(t1) || !::IsValidTile(t2)) return -1;
 	return ::DistanceManhattan(t1, t2);
 }
 
-/* static */ int32 AIMap::DistanceMax(TileIndex t1, TileIndex t2)
+/* static */ int32 ScriptMap::DistanceMax(TileIndex t1, TileIndex t2)
 {
 	if (!::IsValidTile(t1) || !::IsValidTile(t2)) return -1;
 	return ::DistanceMax(t1, t2);
 }
 
-/* static */ int32 AIMap::DistanceSquare(TileIndex t1, TileIndex t2)
+/* static */ int32 ScriptMap::DistanceSquare(TileIndex t1, TileIndex t2)
 {
 	if (!::IsValidTile(t1) || !::IsValidTile(t2)) return -1;
 	return ::DistanceSquare(t1, t2);
 }
 
-/* static */ int32 AIMap::DistanceFromEdge(TileIndex t)
+/* static */ int32 ScriptMap::DistanceFromEdge(TileIndex t)
 {
 	if (!::IsValidTile(t)) return -1;
 	return ::DistanceFromEdge(t);
--- a/src/script/api/script_map.hpp
+++ b/src/script/api/script_map.hpp
@@ -18,7 +18,7 @@
 /**
  * Class that handles all map related functions.
  */
-class AIMap : public AIObject {
+class ScriptMap : public ScriptObject {
 public:
 	static const int TILE_INVALID = (int)INVALID_TILE; ///< Invalid TileIndex.
 
--- a/src/script/api/script_marine.cpp
+++ b/src/script/api/script_marine.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_marine.cpp Implementation of AIMarine. */
+/** @file script_marine.cpp Implementation of ScriptMarine. */
 
 #include "../../stdafx.h"
 #include "script_marine.hpp"
@@ -16,42 +16,42 @@
 #include "../../tile_cmd.h"
 
 
-/* static */ bool AIMarine::IsWaterDepotTile(TileIndex tile)
+/* static */ bool ScriptMarine::IsWaterDepotTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_WATER) && ::GetWaterTileType(tile) == WATER_TILE_DEPOT;
 }
 
-/* static */ bool AIMarine::IsDockTile(TileIndex tile)
+/* static */ bool ScriptMarine::IsDockTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_STATION) && ::IsDock(tile);
 }
 
-/* static */ bool AIMarine::IsBuoyTile(TileIndex tile)
+/* static */ bool ScriptMarine::IsBuoyTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_STATION) && ::IsBuoy(tile);
 }
 
-/* static */ bool AIMarine::IsLockTile(TileIndex tile)
+/* static */ bool ScriptMarine::IsLockTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_WATER) && ::GetWaterTileType(tile) == WATER_TILE_LOCK;
 }
 
-/* static */ bool AIMarine::IsCanalTile(TileIndex tile)
+/* static */ bool ScriptMarine::IsCanalTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_WATER) && ::IsCanal(tile);
 }
 
-/* static */ bool AIMarine::AreWaterTilesConnected(TileIndex t1, TileIndex t2)
+/* static */ bool ScriptMarine::AreWaterTilesConnected(TileIndex t1, TileIndex t2)
 {
 	if (!::IsValidTile(t1)) return false;
 	if (!::IsValidTile(t2)) return false;
@@ -71,87 +71,87 @@
 	return gtts2 != TRACK_BIT_NONE;
 }
 
-/* static */ bool AIMarine::BuildWaterDepot(TileIndex tile, TileIndex front)
+/* static */ bool ScriptMarine::BuildWaterDepot(TileIndex tile, TileIndex front)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, ::IsValidTile(front));
 	EnforcePrecondition(false, (::TileX(front) == ::TileX(tile)) != (::TileY(front) == ::TileY(tile)));
 
-	return AIObject::DoCommand(tile, ::TileX(front) == ::TileX(tile), 0, CMD_BUILD_SHIP_DEPOT);
+	return ScriptObject::DoCommand(tile, ::TileX(front) == ::TileX(tile), 0, CMD_BUILD_SHIP_DEPOT);
 }
 
-/* static */ bool AIMarine::BuildDock(TileIndex tile, StationID station_id)
+/* static */ bool ScriptMarine::BuildDock(TileIndex tile, StationID station_id)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
-	EnforcePrecondition(false, station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id));
+	EnforcePrecondition(false, station_id == ScriptStation::STATION_NEW || station_id == ScriptStation::STATION_JOIN_ADJACENT || ScriptStation::IsValidStation(station_id));
 
-	uint p1 = station_id == AIStation::STATION_JOIN_ADJACENT ? 0 : 1;
-	uint p2 = (AIStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16;
-	return AIObject::DoCommand(tile, p1, p2, CMD_BUILD_DOCK);
+	uint p1 = station_id == ScriptStation::STATION_JOIN_ADJACENT ? 0 : 1;
+	uint p2 = (ScriptStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16;
+	return ScriptObject::DoCommand(tile, p1, p2, CMD_BUILD_DOCK);
 }
 
-/* static */ bool AIMarine::BuildBuoy(TileIndex tile)
+/* static */ bool ScriptMarine::BuildBuoy(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 
-	return AIObject::DoCommand(tile, 0, 0, CMD_BUILD_BUOY);
+	return ScriptObject::DoCommand(tile, 0, 0, CMD_BUILD_BUOY);
 }
 
-/* static */ bool AIMarine::BuildLock(TileIndex tile)
+/* static */ bool ScriptMarine::BuildLock(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 
-	return AIObject::DoCommand(tile, 0, 0, CMD_BUILD_LOCK);
+	return ScriptObject::DoCommand(tile, 0, 0, CMD_BUILD_LOCK);
 }
 
-/* static */ bool AIMarine::BuildCanal(TileIndex tile)
+/* static */ bool ScriptMarine::BuildCanal(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 
-	return AIObject::DoCommand(tile, tile, WATER_CLASS_CANAL, CMD_BUILD_CANAL);
+	return ScriptObject::DoCommand(tile, tile, WATER_CLASS_CANAL, CMD_BUILD_CANAL);
 }
 
-/* static */ bool AIMarine::RemoveWaterDepot(TileIndex tile)
+/* static */ bool ScriptMarine::RemoveWaterDepot(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, IsWaterDepotTile(tile));
 
-	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
+	return ScriptObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
 }
 
-/* static */ bool AIMarine::RemoveDock(TileIndex tile)
+/* static */ bool ScriptMarine::RemoveDock(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, IsDockTile(tile));
 
-	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
+	return ScriptObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
 }
 
-/* static */ bool AIMarine::RemoveBuoy(TileIndex tile)
+/* static */ bool ScriptMarine::RemoveBuoy(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, IsBuoyTile(tile));
 
-	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
+	return ScriptObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
 }
 
-/* static */ bool AIMarine::RemoveLock(TileIndex tile)
+/* static */ bool ScriptMarine::RemoveLock(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, IsLockTile(tile));
 
-	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
+	return ScriptObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
 }
 
-/* static */ bool AIMarine::RemoveCanal(TileIndex tile)
+/* static */ bool ScriptMarine::RemoveCanal(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, IsCanalTile(tile));
 
-	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
+	return ScriptObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
 }
 
-/* static */ Money AIMarine::GetBuildCost(BuildType build_type)
+/* static */ Money ScriptMarine::GetBuildCost(BuildType build_type)
 {
 	switch (build_type) {
 		case BT_DOCK:  return ::GetPrice(PR_BUILD_STATION_DOCK, 1, NULL);
--- a/src/script/api/script_marine.hpp
+++ b/src/script/api/script_marine.hpp
@@ -17,14 +17,14 @@
 /**
  * Class that handles all marine related functions.
  */
-class AIMarine : public AIObject {
+class ScriptMarine : public ScriptObject {
 public:
 	/**
 	 * All marine related error messages.
 	 */
 	enum ErrorMessages {
 		/** Base for marine related errors */
-		ERR_MARINE_BASE = AIError::ERR_CAT_MARINE << AIError::ERR_CAT_BIT_SIZE,
+		ERR_MARINE_BASE = ScriptError::ERR_CAT_MARINE << ScriptError::ERR_CAT_BIT_SIZE,
 
 		/** Infrastructure must be built on water */
 		ERR_MARINE_MUST_BE_BUILT_ON_WATER,                  // [STR_ERROR_MUST_BE_BUILT_ON_WATER]
@@ -42,7 +42,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a water depot.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has a water depot.
 	 */
 	static bool IsWaterDepotTile(TileIndex tile);
@@ -50,7 +50,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a dock.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has a dock.
 	 */
 	static bool IsDockTile(TileIndex tile);
@@ -58,7 +58,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a buoy.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has a buoy.
 	 */
 	static bool IsBuoyTile(TileIndex tile);
@@ -66,7 +66,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a lock.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has a lock.
 	 */
 	static bool IsLockTile(TileIndex tile);
@@ -74,7 +74,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a canal.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has a canal.
 	 */
 	static bool IsCanalTile(TileIndex tile);
@@ -85,8 +85,8 @@
 	 *  center of the second tile.
 	 * @param tile_from The source tile.
 	 * @param tile_to The destination tile.
-	 * @pre AIMap::IsValidTile(tile_from).
-	 * @pre AIMap::IsValidTile(tile_to).
+	 * @pre ScriptMap::IsValidTile(tile_from).
+	 * @pre ScriptMap::IsValidTile(tile_to).
 	 * @pre 'tile_from' and 'tile_to' are directly neighbouring tiles.
 	 * @return True if and only if a ship can go from tile_from to tile_to.
 	 */
@@ -96,11 +96,11 @@
 	 * Builds a water depot on tile.
 	 * @param tile The tile where the water depot will be build.
 	 * @param front A tile on the same axis with 'tile' as the depot shall be oriented.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @pre AIMap::IsValidTile(front).
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_SITE_UNSUITABLE
-	 * @exception AIMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(front).
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_SITE_UNSUITABLE
+	 * @exception ScriptMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER
 	 * @return Whether the water depot has been/can be build or not.
 	 * @note A WaterDepot is 1 tile in width, and 2 tiles in length.
 	 * @note The depot will be built towards the south from 'tile', not necessarily towards 'front'.
@@ -110,13 +110,13 @@
 	/**
 	 * Builds a dock where tile is the tile still on land.
 	 * @param tile The tile still on land of the dock.
-	 * @param station_id The station to join, AIStation::STATION_NEW or AIStation::STATION_JOIN_ADJACENT.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @pre station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id).
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_SITE_UNSUITABLE
-	 * @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
-	 * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
+	 * @param station_id The station to join, ScriptStation::STATION_NEW or ScriptStation::STATION_JOIN_ADJACENT.
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @pre station_id == ScriptStation::STATION_NEW || station_id == ScriptStation::STATION_JOIN_ADJACENT || ScriptStation::IsValidStation(station_id).
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_SITE_UNSUITABLE
+	 * @exception ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
+	 * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS
 	 * @return Whether the dock has been/can be build or not.
 	 */
 	static bool BuildDock(TileIndex tile, StationID station_id);
@@ -124,10 +124,10 @@
 	/**
 	 * Builds a buoy on tile.
 	 * @param tile The tile where the buoy will be build.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_SITE_UNSUITABLE
-	 * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_SITE_UNSUITABLE
+	 * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS
 	 * @return Whether the buoy has been/can be build or not.
 	 */
 	static bool BuildBuoy(TileIndex tile);
@@ -135,9 +135,9 @@
 	/**
 	 * Builds a lock on tile.
 	 * @param tile The tile where the lock will be build.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @exception AIError::ERR_LAND_SLOPED_WRONG
-	 * @exception AIError::ERR_SITE_UNSUITABLE
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @exception ScriptError::ERR_LAND_SLOPED_WRONG
+	 * @exception ScriptError::ERR_SITE_UNSUITABLE
 	 * @return Whether the lock has been/can be build or not.
 	 */
 	static bool BuildLock(TileIndex tile);
@@ -145,11 +145,11 @@
 	/**
 	 * Builds a canal on tile.
 	 * @param tile The tile where the canal will be build.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_LAND_SLOPED_WRONG
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIError::ERR_ALREADY_BUILT
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_LAND_SLOPED_WRONG
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptError::ERR_ALREADY_BUILT
 	 * @return Whether the canal has been/can be build or not.
 	 */
 	static bool BuildCanal(TileIndex tile);
@@ -157,8 +157,8 @@
 	/**
 	 * Removes a water depot.
 	 * @param tile Any tile of the water depot.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
 	 * @return Whether the water depot has been/can be removed or not.
 	 */
 	static bool RemoveWaterDepot(TileIndex tile);
@@ -166,8 +166,8 @@
 	/**
 	 * Removes a dock.
 	 * @param tile Any tile of the dock.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
 	 * @return Whether the dock has been/can be removed or not.
 	 */
 	static bool RemoveDock(TileIndex tile);
@@ -175,8 +175,8 @@
 	/**
 	 * Removes a buoy.
 	 * @param tile Any tile of the buoy.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
 	 * @return Whether the buoy has been/can be removed or not.
 	 */
 	static bool RemoveBuoy(TileIndex tile);
@@ -184,8 +184,8 @@
 	/**
 	 * Removes a lock.
 	 * @param tile Any tile of the lock.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
 	 * @return Whether the lock has been/can be removed or not.
 	 */
 	static bool RemoveLock(TileIndex tile);
@@ -193,8 +193,8 @@
 	/**
 	 * Removes a canal.
 	 * @param tile Any tile of the canal.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
 	 * @return Whether the canal has been/can be removed or not.
 	 */
 	static bool RemoveCanal(TileIndex tile);
--- a/src/script/api/script_object.cpp
+++ b/src/script/api/script_object.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_object.cpp Implementation of AIObject. */
+/** @file script_object.cpp Implementation of ScriptObject. */
 
 #include "../../stdafx.h"
 #include "../../script/squirrel.hpp"
@@ -25,113 +25,113 @@
  */
 static AIStorage *GetStorage()
 {
-	return AIObject::GetActiveInstance()->GetStorage();
+	return ScriptObject::GetActiveInstance()->GetStorage();
 }
 
 
-/* static */ AIInstance *AIObject::ActiveInstance::active = NULL;
+/* static */ AIInstance *ScriptObject::ActiveInstance::active = NULL;
 
-AIObject::ActiveInstance::ActiveInstance(AIInstance *instance)
+ScriptObject::ActiveInstance::ActiveInstance(AIInstance *instance)
 {
-	this->last_active = AIObject::ActiveInstance::active;
-	AIObject::ActiveInstance::active = instance;
+	this->last_active = ScriptObject::ActiveInstance::active;
+	ScriptObject::ActiveInstance::active = instance;
 }
 
-AIObject::ActiveInstance::~ActiveInstance()
+ScriptObject::ActiveInstance::~ActiveInstance()
 {
-	AIObject::ActiveInstance::active = this->last_active;
+	ScriptObject::ActiveInstance::active = this->last_active;
 }
 
-/* static */ AIInstance *AIObject::GetActiveInstance()
+/* static */ AIInstance *ScriptObject::GetActiveInstance()
 {
-	assert(AIObject::ActiveInstance::active != NULL);
-	return AIObject::ActiveInstance::active;
+	assert(ScriptObject::ActiveInstance::active != NULL);
+	return ScriptObject::ActiveInstance::active;
 }
 
 
-/* static */ void AIObject::SetDoCommandDelay(uint ticks)
+/* static */ void ScriptObject::SetDoCommandDelay(uint ticks)
 {
 	assert(ticks > 0);
 	GetStorage()->delay = ticks;
 }
 
-/* static */ uint AIObject::GetDoCommandDelay()
+/* static */ uint ScriptObject::GetDoCommandDelay()
 {
 	return GetStorage()->delay;
 }
 
-/* static */ void AIObject::SetDoCommandMode(AIModeProc *proc, AIObject *instance)
+/* static */ void ScriptObject::SetDoCommandMode(AIModeProc *proc, ScriptObject *instance)
 {
 	GetStorage()->mode = proc;
 	GetStorage()->mode_instance = instance;
 }
 
-/* static */ AIModeProc *AIObject::GetDoCommandMode()
+/* static */ AIModeProc *ScriptObject::GetDoCommandMode()
 {
 	return GetStorage()->mode;
 }
 
-/* static */ AIObject *AIObject::GetDoCommandModeInstance()
+/* static */ ScriptObject *ScriptObject::GetDoCommandModeInstance()
 {
 	return GetStorage()->mode_instance;
 }
 
-/* static */ void AIObject::SetDoCommandCosts(Money value)
+/* static */ void ScriptObject::SetDoCommandCosts(Money value)
 {
 	GetStorage()->costs = CommandCost(value);
 }
 
-/* static */ void AIObject::IncreaseDoCommandCosts(Money value)
+/* static */ void ScriptObject::IncreaseDoCommandCosts(Money value)
 {
 	GetStorage()->costs.AddCost(value);
 }
 
-/* static */ Money AIObject::GetDoCommandCosts()
+/* static */ Money ScriptObject::GetDoCommandCosts()
 {
 	return GetStorage()->costs.GetCost();
 }
 
-/* static */ void AIObject::SetLastError(AIErrorType last_error)
+/* static */ void ScriptObject::SetLastError(ScriptErrorType last_error)
 {
 	GetStorage()->last_error = last_error;
 }
 
-/* static */ AIErrorType AIObject::GetLastError()
+/* static */ ScriptErrorType ScriptObject::GetLastError()
 {
 	return GetStorage()->last_error;
 }
 
-/* static */ void AIObject::SetLastCost(Money last_cost)
+/* static */ void ScriptObject::SetLastCost(Money last_cost)
 {
 	GetStorage()->last_cost = last_cost;
 }
 
-/* static */ Money AIObject::GetLastCost()
+/* static */ Money ScriptObject::GetLastCost()
 {
 	return GetStorage()->last_cost;
 }
 
-/* static */ void AIObject::SetRoadType(RoadType road_type)
+/* static */ void ScriptObject::SetRoadType(RoadType road_type)
 {
 	GetStorage()->road_type = road_type;
 }
 
-/* static */ RoadType AIObject::GetRoadType()
+/* static */ RoadType ScriptObject::GetRoadType()
 {
 	return GetStorage()->road_type;
 }
 
-/* static */ void AIObject::SetRailType(RailType rail_type)
+/* static */ void ScriptObject::SetRailType(RailType rail_type)
 {
 	GetStorage()->rail_type = rail_type;
 }
 
-/* static */ RailType AIObject::GetRailType()
+/* static */ RailType ScriptObject::GetRailType()
 {
 	return GetStorage()->rail_type;
 }
 
-/* static */ void AIObject::SetLastCommandRes(bool res)
+/* static */ void ScriptObject::SetLastCommandRes(bool res)
 {
 	GetStorage()->last_command_res = res;
 	/* Also store the results of various global variables */
@@ -141,91 +141,91 @@
 	SetNewGroupID(_new_group_id);
 }
 
-/* static */ bool AIObject::GetLastCommandRes()
+/* static */ bool ScriptObject::GetLastCommandRes()
 {
 	return GetStorage()->last_command_res;
 }
 
-/* static */ void AIObject::SetNewVehicleID(VehicleID vehicle_id)
+/* static */ void ScriptObject::SetNewVehicleID(VehicleID vehicle_id)
 {
 	GetStorage()->new_vehicle_id = vehicle_id;
 }
 
-/* static */ VehicleID AIObject::GetNewVehicleID()
+/* static */ VehicleID ScriptObject::GetNewVehicleID()
 {
 	return GetStorage()->new_vehicle_id;
 }
 
-/* static */ void AIObject::SetNewSignID(SignID sign_id)
+/* static */ void ScriptObject::SetNewSignID(SignID sign_id)
 {
 	GetStorage()->new_sign_id = sign_id;
 }
 
-/* static */ SignID AIObject::GetNewSignID()
+/* static */ SignID ScriptObject::GetNewSignID()
 {
 	return GetStorage()->new_sign_id;
 }
 
-/* static */ void AIObject::SetNewTunnelEndtile(TileIndex tile)
+/* static */ void ScriptObject::SetNewTunnelEndtile(TileIndex tile)
 {
 	GetStorage()->new_tunnel_endtile = tile;
 }
 
-/* static */ TileIndex AIObject::GetNewTunnelEndtile()
+/* static */ TileIndex ScriptObject::GetNewTunnelEndtile()
 {
 	return GetStorage()->new_tunnel_endtile;
 }
 
-/* static */ void AIObject::SetNewGroupID(GroupID group_id)
+/* static */ void ScriptObject::SetNewGroupID(GroupID group_id)
 {
 	GetStorage()->new_group_id = group_id;
 }
 
-/* static */ GroupID AIObject::GetNewGroupID()
+/* static */ GroupID ScriptObject::GetNewGroupID()
 {
 	return GetStorage()->new_group_id;
 }
 
-/* static */ void AIObject::SetAllowDoCommand(bool allow)
+/* static */ void ScriptObject::SetAllowDoCommand(bool allow)
 {
 	GetStorage()->allow_do_command = allow;
 }
 
-/* static */ bool AIObject::GetAllowDoCommand()
+/* static */ bool ScriptObject::GetAllowDoCommand()
 {
 	return GetStorage()->allow_do_command;
 }
 
-/* static */ bool AIObject::CanSuspend()
+/* static */ bool ScriptObject::CanSuspend()
 {
-	Squirrel *squirrel = AIObject::GetActiveInstance()->engine;
+	Squirrel *squirrel = ScriptObject::GetActiveInstance()->engine;
 	return GetStorage()->allow_do_command && squirrel->CanSuspend();
 }
 
-/* static */ void *&AIObject::GetEventPointer()
+/* static */ void *&ScriptObject::GetEventPointer()
 {
 	return GetStorage()->event_data;
 }
 
-/* static */ void *&AIObject::GetLogPointer()
+/* static */ void *&ScriptObject::GetLogPointer()
 {
 	return GetStorage()->log_data;
 }
 
-/* static */ void AIObject::SetCallbackVariable(int index, int value)
+/* static */ void ScriptObject::SetCallbackVariable(int index, int value)
 {
 	if ((size_t)index >= GetStorage()->callback_value.size()) GetStorage()->callback_value.resize(index + 1);
 	GetStorage()->callback_value[index] = value;
 }
 
-/* static */ int AIObject::GetCallbackVariable(int index)
+/* static */ int ScriptObject::GetCallbackVariable(int index)
 {
 	return GetStorage()->callback_value[index];
 }
 
-/* static */ bool AIObject::DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text, AISuspendCallbackProc *callback)
+/* static */ bool ScriptObject::DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text, AISuspendCallbackProc *callback)
 {
-	if (!AIObject::CanSuspend()) {
+	if (!ScriptObject::CanSuspend()) {
 		throw AI_FatalError("You are not allowed to execute any DoCommand (even indirect) in your constructor, Save(), Load(), and any valuator.");
 	}
 
@@ -245,12 +245,12 @@
 
 	/* We failed; set the error and bail out */
 	if (res.Failed()) {
-		SetLastError(AIError::StringToError(res.GetErrorMessage()));
+		SetLastError(ScriptError::StringToError(res.GetErrorMessage()));
 		return false;
 	}
 
 	/* No error, then clear it. */
-	SetLastError(AIError::ERR_NONE);
+	SetLastError(ScriptError::ERR_NONE);
 
 	/* Estimates, update the cost for the estimate and be done */
 	if (estimate_only) {
--- a/src/script/api/script_object.hpp
+++ b/src/script/api/script_object.hpp
@@ -34,7 +34,7 @@
  *   internally to have a common place to handle general things, like internal
  *   command processing, and command-validation checks.
  */
-class AIObject : public SimpleCountedObject {
+class ScriptObject : public SimpleCountedObject {
 friend class AIInstance;
 #ifndef DOXYGEN_AI_DOCS
 protected:
@@ -45,7 +45,7 @@
 	 *  reverts to the active instance it was before instantiating.
 	 */
 	class ActiveInstance {
-	friend class AIObject;
+	friend class ScriptObject;
 	public:
 		ActiveInstance(AIInstance *instance);
 		~ActiveInstance();
@@ -92,12 +92,12 @@
 	/**
 	 * Set the DoCommand last error.
 	 */
-	static void SetLastError(AIErrorType last_error);
+	static void SetLastError(ScriptErrorType last_error);
 
 	/**
 	 * Get the DoCommand last error.
 	 */
-	static AIErrorType GetLastError();
+	static ScriptErrorType GetLastError();
 
 	/**
 	 * Set the road type.
@@ -122,7 +122,7 @@
 	/**
 	 * Set the current mode of your AI to this proc.
 	 */
-	static void SetDoCommandMode(AIModeProc *proc, AIObject *instance);
+	static void SetDoCommandMode(AIModeProc *proc, ScriptObject *instance);
 
 	/**
 	 * Get the current mode your AI is currently under.
@@ -132,7 +132,7 @@
 	/**
 	 * Get the instance of the current mode your AI is currently under.
 	 */
-	static AIObject *GetDoCommandModeInstance();
+	static ScriptObject *GetDoCommandModeInstance();
 
 	/**
 	 * Set the delay of the DoCommand.
--- a/src/script/api/script_order.cpp
+++ b/src/script/api/script_order.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_order.cpp Implementation of AIOrder. */
+/** @file script_order.cpp Implementation of ScriptOrder. */
 
 #include "../../stdafx.h"
 #include "script_order.hpp"
@@ -47,9 +47,9 @@
 	return OT_END;
 }
 
-/* static */ bool AIOrder::IsValidVehicleOrder(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ bool ScriptOrder::IsValidVehicleOrder(VehicleID vehicle_id, OrderPosition order_position)
 {
-	return AIVehicle::IsValidVehicle(vehicle_id) && order_position >= 0 && (order_position < ::Vehicle::Get(vehicle_id)->GetNumManualOrders() || order_position == ORDER_CURRENT);
+	return ScriptVehicle::IsValidVehicle(vehicle_id) && order_position >= 0 && (order_position < ::Vehicle::Get(vehicle_id)->GetNumManualOrders() || order_position == ORDER_CURRENT);
 }
 
 /**
@@ -57,19 +57,19 @@
  *  the order list, return the order from the orderlist. If the current order
  *  was a manual order, return the current order.
  */
-static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition order_position)
+static const Order *ResolveOrder(VehicleID vehicle_id, ScriptOrder::OrderPosition order_position)
 {
 	const Vehicle *v = ::Vehicle::Get(vehicle_id);
-	if (order_position == AIOrder::ORDER_CURRENT) {
+	if (order_position == ScriptOrder::ORDER_CURRENT) {
 		const Order *order = &v->current_order;
 		if (order->GetType() == OT_GOTO_DEPOT && !(order->GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) return order;
-		order_position = AIOrder::ResolveOrderPosition(vehicle_id, order_position);
-		if (order_position == AIOrder::ORDER_INVALID) return NULL;
+		order_position = ScriptOrder::ResolveOrderPosition(vehicle_id, order_position);
+		if (order_position == ScriptOrder::ORDER_INVALID) return NULL;
 	}
 	const Order *order = v->orders.list->GetFirstOrder();
 	while (order->GetType() == OT_IMPLICIT) order = order->next;
 	while (order_position > 0) {
-		order_position = (AIOrder::OrderPosition)(order_position - 1);
+		order_position = (ScriptOrder::OrderPosition)(order_position - 1);
 		order = order->next;
 		while (order->GetType() == OT_IMPLICIT) order = order->next;
 	}
@@ -77,23 +77,23 @@
 }
 
 /**
- * Convert an AIOrder::OrderPosition (which is the manual order index) to an order index
+ * Convert an ScriptOrder::OrderPosition (which is the manual order index) to an order index
  * as expected by the OpenTTD commands.
  * @param order_position The OrderPosition to convert.
  * @return An OpenTTD-internal index for the same order.
  */
-static int AIOrderPositionToRealOrderPosition(VehicleID vehicle_id, AIOrder::OrderPosition order_position)
+static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOrder::OrderPosition order_position)
 {
 	const Vehicle *v = ::Vehicle::Get(vehicle_id);
 	if (order_position == v->GetNumManualOrders()) return v->GetNumOrders();
 
-	assert(AIOrder::IsValidVehicleOrder(vehicle_id, order_position));
+	assert(ScriptOrder::IsValidVehicleOrder(vehicle_id, order_position));
 
 	int res = (int)order_position;
 	const Order *order = v->orders.list->GetFirstOrder();
 	for (; order->GetType() == OT_IMPLICIT; order = order->next) res++;
 	while (order_position > 0) {
-		order_position = (AIOrder::OrderPosition)(order_position - 1);
+		order_position = (ScriptOrder::OrderPosition)(order_position - 1);
 		order = order->next;
 		for (; order->GetType() == OT_IMPLICIT; order = order->next) res++;
 	}
@@ -101,7 +101,7 @@
 	return res;
 }
 
-/* static */ bool AIOrder::IsGotoStationOrder(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ bool ScriptOrder::IsGotoStationOrder(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return false;
 
@@ -109,7 +109,7 @@
 	return order != NULL && order->GetType() == OT_GOTO_STATION;
 }
 
-/* static */ bool AIOrder::IsGotoDepotOrder(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ bool ScriptOrder::IsGotoDepotOrder(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return false;
 
@@ -117,7 +117,7 @@
 	return order != NULL && order->GetType() == OT_GOTO_DEPOT;
 }
 
-/* static */ bool AIOrder::IsGotoWaypointOrder(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ bool ScriptOrder::IsGotoWaypointOrder(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return false;
 
@@ -125,16 +125,16 @@
 	return order != NULL && order->GetType() == OT_GOTO_WAYPOINT;
 }
 
-/* static */ bool AIOrder::IsConditionalOrder(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ bool ScriptOrder::IsConditionalOrder(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (order_position == ORDER_CURRENT) return false;
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return false;
 
-	const Order *order = ::Vehicle::Get(vehicle_id)->GetOrder(AIOrderPositionToRealOrderPosition(vehicle_id, order_position));
+	const Order *order = ::Vehicle::Get(vehicle_id)->GetOrder(ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position));
 	return order->GetType() == OT_CONDITIONAL;
 }
 
-/* static */ bool AIOrder::IsVoidOrder(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ bool ScriptOrder::IsVoidOrder(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (order_position == ORDER_CURRENT) return false;
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return false;
@@ -143,7 +143,7 @@
 	return order->GetType() == OT_DUMMY;
 }
 
-/* static */ bool AIOrder::IsRefitOrder(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ bool ScriptOrder::IsRefitOrder(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return false;
 
@@ -151,9 +151,9 @@
 	return order != NULL && order->IsRefit();
 }
 
-/* static */ bool AIOrder::IsCurrentOrderPartOfOrderList(VehicleID vehicle_id)
+/* static */ bool ScriptOrder::IsCurrentOrderPartOfOrderList(VehicleID vehicle_id)
 {
-	if (!AIVehicle::IsValidVehicle(vehicle_id)) return false;
+	if (!ScriptVehicle::IsValidVehicle(vehicle_id)) return false;
 	if (GetOrderCount(vehicle_id) == 0) return false;
 
 	const Order *order = &::Vehicle::Get(vehicle_id)->current_order;
@@ -161,9 +161,9 @@
 	return (order->GetDepotOrderType() & ODTFB_PART_OF_ORDERS) != 0;
 }
 
-/* static */ AIOrder::OrderPosition AIOrder::ResolveOrderPosition(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ ScriptOrder::OrderPosition ScriptOrder::ResolveOrderPosition(VehicleID vehicle_id, OrderPosition order_position)
 {
-	if (!AIVehicle::IsValidVehicle(vehicle_id)) return ORDER_INVALID;
+	if (!ScriptVehicle::IsValidVehicle(vehicle_id)) return ORDER_INVALID;
 
 	if (order_position == ORDER_CURRENT) {
 		int cur_order_pos = ::Vehicle::Get(vehicle_id)->cur_real_order_index;
@@ -174,13 +174,13 @@
 			if (order->GetType() == OT_IMPLICIT) num_implicit_orders++;
 			order = order->next;
 		}
-		return (AIOrder::OrderPosition)(cur_order_pos - num_implicit_orders);
+		return (ScriptOrder::OrderPosition)(cur_order_pos - num_implicit_orders);
 	}
 	return (order_position >= 0 && order_position < ::Vehicle::Get(vehicle_id)->GetNumManualOrders()) ? order_position : ORDER_INVALID;
 }
 
 
-/* static */ bool AIOrder::AreOrderFlagsValid(TileIndex destination, AIOrderFlags order_flags)
+/* static */ bool ScriptOrder::AreOrderFlagsValid(TileIndex destination, ScriptOrderFlags order_flags)
 {
 	OrderType ot = (order_flags & AIOF_GOTO_NEAREST_DEPOT) ? OT_GOTO_DEPOT : ::GetOrderTypeByTile(destination);
 	switch (ot) {
@@ -203,7 +203,7 @@
 	}
 }
 
-/* static */ bool AIOrder::IsValidConditionalOrder(OrderCondition condition, CompareFunction compare)
+/* static */ bool ScriptOrder::IsValidConditionalOrder(OrderCondition condition, CompareFunction compare)
 {
 	switch (condition) {
 		case OC_LOAD_PERCENTAGE:
@@ -223,12 +223,12 @@
 	}
 }
 
-/* static */ int32 AIOrder::GetOrderCount(VehicleID vehicle_id)
+/* static */ int32 ScriptOrder::GetOrderCount(VehicleID vehicle_id)
 {
-	return AIVehicle::IsValidVehicle(vehicle_id) ? ::Vehicle::Get(vehicle_id)->GetNumManualOrders() : -1;
+	return ScriptVehicle::IsValidVehicle(vehicle_id) ? ::Vehicle::Get(vehicle_id)->GetNumManualOrders() : -1;
 }
 
-/* static */ TileIndex AIOrder::GetOrderDestination(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ TileIndex ScriptOrder::GetOrderDestination(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return INVALID_TILE;
 
@@ -282,15 +282,15 @@
 	}
 }
 
-/* static */ AIOrder::AIOrderFlags AIOrder::GetOrderFlags(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ ScriptOrder::ScriptOrderFlags ScriptOrder::GetOrderFlags(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return AIOF_INVALID;
 
 	const Order *order = ::ResolveOrder(vehicle_id, order_position);
 	if (order == NULL || order->GetType() == OT_CONDITIONAL || order->GetType() == OT_DUMMY) return AIOF_INVALID;
 
-	AIOrderFlags order_flags = AIOF_NONE;
-	order_flags |= (AIOrderFlags)order->GetNonStopType();
+	ScriptOrderFlags order_flags = AIOF_NONE;
+	order_flags |= (ScriptOrderFlags)order->GetNonStopType();
 	switch (order->GetType()) {
 		case OT_GOTO_DEPOT:
 			if (order->GetDepotOrderType() & ODTFB_SERVICE) order_flags |= AIOF_SERVICE_IF_NEEDED;
@@ -299,8 +299,8 @@
 			break;
 
 		case OT_GOTO_STATION:
-			order_flags |= (AIOrderFlags)(order->GetLoadType()   << 5);
-			order_flags |= (AIOrderFlags)(order->GetUnloadType() << 2);
+			order_flags |= (ScriptOrderFlags)(order->GetLoadType()   << 5);
+			order_flags |= (ScriptOrderFlags)(order->GetUnloadType() << 2);
 			break;
 
 		default: break;
@@ -309,7 +309,7 @@
 	return order_flags;
 }
 
-/* static */ AIOrder::OrderPosition AIOrder::GetOrderJumpTo(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ ScriptOrder::OrderPosition ScriptOrder::GetOrderJumpTo(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return ORDER_INVALID;
 	if (order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position)) return ORDER_INVALID;
@@ -318,7 +318,7 @@
 	return (OrderPosition)order->GetConditionSkipToOrder();
 }
 
-/* static */ AIOrder::OrderCondition AIOrder::GetOrderCondition(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ ScriptOrder::OrderCondition ScriptOrder::GetOrderCondition(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return OC_INVALID;
 	if (order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position)) return OC_INVALID;
@@ -327,7 +327,7 @@
 	return (OrderCondition)order->GetConditionVariable();
 }
 
-/* static */ AIOrder::CompareFunction AIOrder::GetOrderCompareFunction(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ ScriptOrder::CompareFunction ScriptOrder::GetOrderCompareFunction(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return CF_INVALID;
 	if (order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position)) return CF_INVALID;
@@ -336,7 +336,7 @@
 	return (CompareFunction)order->GetConditionComparator();
 }
 
-/* static */ int32 AIOrder::GetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ int32 ScriptOrder::GetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return -1;
 	if (order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position)) return -1;
@@ -347,17 +347,17 @@
 	return value;
 }
 
-/* static */ AIOrder::StopLocation AIOrder::GetStopLocation(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ ScriptOrder::StopLocation ScriptOrder::GetStopLocation(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return STOPLOCATION_INVALID;
-	if (AIVehicle::GetVehicleType(vehicle_id) != AIVehicle::VT_RAIL) return STOPLOCATION_INVALID;
+	if (ScriptVehicle::GetVehicleType(vehicle_id) != ScriptVehicle::VT_RAIL) return STOPLOCATION_INVALID;
 	if (!IsGotoStationOrder(vehicle_id, order_position)) return STOPLOCATION_INVALID;
 
 	const Order *order = ::ResolveOrder(vehicle_id, order_position);
-	return (AIOrder::StopLocation)order->GetStopLocation();
+	return (ScriptOrder::StopLocation)order->GetStopLocation();
 }
 
-/* static */ CargoID AIOrder::GetOrderRefit(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ CargoID ScriptOrder::GetOrderRefit(VehicleID vehicle_id, OrderPosition order_position)
 {
 	if (!IsValidVehicleOrder(vehicle_id, order_position)) return CT_NO_REFIT;
 	if (order_position != ORDER_CURRENT && !IsGotoStationOrder(vehicle_id, order_position) && !IsGotoDepotOrder(vehicle_id, order_position)) return CT_NO_REFIT;
@@ -366,94 +366,94 @@
 	return order->IsRefit() ? order->GetRefitCargo() : (CargoID)CT_NO_REFIT;
 }
 
-/* static */ bool AIOrder::SetOrderJumpTo(VehicleID vehicle_id, OrderPosition order_position, OrderPosition jump_to)
+/* static */ bool ScriptOrder::SetOrderJumpTo(VehicleID vehicle_id, OrderPosition order_position, OrderPosition jump_to)
 {
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position));
 	EnforcePrecondition(false, order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position));
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, jump_to) && jump_to != ORDER_CURRENT);
 
-	return AIObject::DoCommand(0, vehicle_id | (order_position << 20), MOF_COND_DESTINATION | (jump_to << 4), CMD_MODIFY_ORDER);
+	return ScriptObject::DoCommand(0, vehicle_id | (order_position << 20), MOF_COND_DESTINATION | (jump_to << 4), CMD_MODIFY_ORDER);
 }
 
-/* static */ bool AIOrder::SetOrderCondition(VehicleID vehicle_id, OrderPosition order_position, OrderCondition condition)
+/* static */ bool ScriptOrder::SetOrderCondition(VehicleID vehicle_id, OrderPosition order_position, OrderCondition condition)
 {
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position));
 	EnforcePrecondition(false, order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position));
 	EnforcePrecondition(false, condition >= OC_LOAD_PERCENTAGE && condition <= OC_REMAINING_LIFETIME);
 
-	int order_pos = AIOrderPositionToRealOrderPosition(vehicle_id, order_position);
-	return AIObject::DoCommand(0, vehicle_id | (order_pos << 20), MOF_COND_VARIABLE | (condition << 4), CMD_MODIFY_ORDER);
+	int order_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position);
+	return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), MOF_COND_VARIABLE | (condition << 4), CMD_MODIFY_ORDER);
 }
 
-/* static */ bool AIOrder::SetOrderCompareFunction(VehicleID vehicle_id, OrderPosition order_position, CompareFunction compare)
+/* static */ bool ScriptOrder::SetOrderCompareFunction(VehicleID vehicle_id, OrderPosition order_position, CompareFunction compare)
 {
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position));
 	EnforcePrecondition(false, order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position));
 	EnforcePrecondition(false, compare >= CF_EQUALS && compare <= CF_IS_FALSE);
 
-	int order_pos = AIOrderPositionToRealOrderPosition(vehicle_id, order_position);
-	return AIObject::DoCommand(0, vehicle_id | (order_pos << 20), MOF_COND_COMPARATOR | (compare << 4), CMD_MODIFY_ORDER);
+	int order_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position);
+	return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), MOF_COND_COMPARATOR | (compare << 4), CMD_MODIFY_ORDER);
 }
 
-/* static */ bool AIOrder::SetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position, int32 value)
+/* static */ bool ScriptOrder::SetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position, int32 value)
 {
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position));
 	EnforcePrecondition(false, order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position));
 	EnforcePrecondition(false, value >= 0 && value < 2048);
 	if (GetOrderCondition(vehicle_id, order_position) == OC_MAX_SPEED) value = value * 10 / 16;
 
-	int order_pos = AIOrderPositionToRealOrderPosition(vehicle_id, order_position);
-	return AIObject::DoCommand(0, vehicle_id | (order_pos << 20), MOF_COND_VALUE | (value << 4), CMD_MODIFY_ORDER);
+	int order_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position);
+	return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), MOF_COND_VALUE | (value << 4), CMD_MODIFY_ORDER);
 }
 
-/* static */ bool AIOrder::SetStopLocation(VehicleID vehicle_id, OrderPosition order_position, StopLocation stop_location)
+/* static */ bool ScriptOrder::SetStopLocation(VehicleID vehicle_id, OrderPosition order_position, StopLocation stop_location)
 {
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position));
-	EnforcePrecondition(false, AIVehicle::GetVehicleType(vehicle_id) == AIVehicle::VT_RAIL);
+	EnforcePrecondition(false, ScriptVehicle::GetVehicleType(vehicle_id) == ScriptVehicle::VT_RAIL);
 	EnforcePrecondition(false, IsGotoStationOrder(vehicle_id, order_position));
 	EnforcePrecondition(false, stop_location >= STOPLOCATION_NEAR && stop_location <= STOPLOCATION_FAR);
 
-	order_position = AIOrder::ResolveOrderPosition(vehicle_id, order_position);
+	order_position = ScriptOrder::ResolveOrderPosition(vehicle_id, order_position);
 
-	int order_pos = AIOrderPositionToRealOrderPosition(vehicle_id, order_position);
+	int order_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position);
 	uint32 p1 = vehicle_id | (order_pos << 20);
 	uint32 p2 = MOF_STOP_LOCATION | (stop_location << 4);
-	return AIObject::DoCommand(0, p1, p2, CMD_MODIFY_ORDER);
+	return ScriptObject::DoCommand(0, p1, p2, CMD_MODIFY_ORDER);
 }
 
-/* static */ bool AIOrder::SetOrderRefit(VehicleID vehicle_id, OrderPosition order_position, CargoID refit_cargo)
+/* static */ bool ScriptOrder::SetOrderRefit(VehicleID vehicle_id, OrderPosition order_position, CargoID refit_cargo)
 {
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position));
 	EnforcePrecondition(false, IsGotoStationOrder(vehicle_id, order_position) || (IsGotoDepotOrder(vehicle_id, order_position) && refit_cargo != CT_AUTO_REFIT));
-	EnforcePrecondition(false, AICargo::IsValidCargo(refit_cargo) || refit_cargo == CT_AUTO_REFIT || refit_cargo == CT_NO_REFIT);
+	EnforcePrecondition(false, ScriptCargo::IsValidCargo(refit_cargo) || refit_cargo == CT_AUTO_REFIT || refit_cargo == CT_NO_REFIT);
 
 	uint32 p1 = vehicle_id;
-	uint32 p2 = refit_cargo | AIOrderPositionToRealOrderPosition(vehicle_id, AIOrder::ResolveOrderPosition(vehicle_id, order_position)) << 16;
-	return AIObject::DoCommand(0, p1, p2, CMD_ORDER_REFIT);
+	uint32 p2 = refit_cargo | ScriptOrderPositionToRealOrderPosition(vehicle_id, ScriptOrder::ResolveOrderPosition(vehicle_id, order_position)) << 16;
+	return ScriptObject::DoCommand(0, p1, p2, CMD_ORDER_REFIT);
 }
 
-/* static */ bool AIOrder::AppendOrder(VehicleID vehicle_id, TileIndex destination, AIOrderFlags order_flags)
+/* static */ bool ScriptOrder::AppendOrder(VehicleID vehicle_id, TileIndex destination, ScriptOrderFlags order_flags)
 {
-	EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id));
+	EnforcePrecondition(false, ScriptVehicle::IsValidVehicle(vehicle_id));
 	EnforcePrecondition(false, AreOrderFlagsValid(destination, order_flags));
 
-	return InsertOrder(vehicle_id, (AIOrder::OrderPosition)::Vehicle::Get(vehicle_id)->GetNumManualOrders(), destination, order_flags);
+	return InsertOrder(vehicle_id, (ScriptOrder::OrderPosition)::Vehicle::Get(vehicle_id)->GetNumManualOrders(), destination, order_flags);
 }
 
-/* static */ bool AIOrder::AppendConditionalOrder(VehicleID vehicle_id, OrderPosition jump_to)
+/* static */ bool ScriptOrder::AppendConditionalOrder(VehicleID vehicle_id, OrderPosition jump_to)
 {
-	EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id));
+	EnforcePrecondition(false, ScriptVehicle::IsValidVehicle(vehicle_id));
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, jump_to));
 
-	return InsertConditionalOrder(vehicle_id, (AIOrder::OrderPosition)::Vehicle::Get(vehicle_id)->GetNumManualOrders(), jump_to);
+	return InsertConditionalOrder(vehicle_id, (ScriptOrder::OrderPosition)::Vehicle::Get(vehicle_id)->GetNumManualOrders(), jump_to);
 }
 
-/* static */ bool AIOrder::InsertOrder(VehicleID vehicle_id, OrderPosition order_position, TileIndex destination, AIOrder::AIOrderFlags order_flags)
+/* static */ bool ScriptOrder::InsertOrder(VehicleID vehicle_id, OrderPosition order_position, TileIndex destination, ScriptOrder::ScriptOrderFlags order_flags)
 {
 	/* IsValidVehicleOrder is not good enough because it does not allow appending. */
-	if (order_position == ORDER_CURRENT) order_position = AIOrder::ResolveOrderPosition(vehicle_id, order_position);
+	if (order_position == ORDER_CURRENT) order_position = ScriptOrder::ResolveOrderPosition(vehicle_id, order_position);
 
-	EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id));
+	EnforcePrecondition(false, ScriptVehicle::IsValidVehicle(vehicle_id));
 	EnforcePrecondition(false, order_position >= 0 && order_position <= ::Vehicle::Get(vehicle_id)->GetNumManualOrders());
 	EnforcePrecondition(false, AreOrderFlagsValid(destination, order_flags));
 
@@ -498,44 +498,44 @@
 
 	order.SetNonStopType((OrderNonStopFlags)GB(order_flags, 0, 2));
 
-	int order_pos = AIOrderPositionToRealOrderPosition(vehicle_id, order_position);
-	return AIObject::DoCommand(0, vehicle_id | (order_pos << 20), order.Pack(), CMD_INSERT_ORDER);
+	int order_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position);
+	return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), order.Pack(), CMD_INSERT_ORDER);
 }
 
-/* static */ bool AIOrder::InsertConditionalOrder(VehicleID vehicle_id, OrderPosition order_position, OrderPosition jump_to)
+/* static */ bool ScriptOrder::InsertConditionalOrder(VehicleID vehicle_id, OrderPosition order_position, OrderPosition jump_to)
 {
 	/* IsValidVehicleOrder is not good enough because it does not allow appending. */
-	if (order_position == ORDER_CURRENT) order_position = AIOrder::ResolveOrderPosition(vehicle_id, order_position);
+	if (order_position == ORDER_CURRENT) order_position = ScriptOrder::ResolveOrderPosition(vehicle_id, order_position);
 
-	EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id));
+	EnforcePrecondition(false, ScriptVehicle::IsValidVehicle(vehicle_id));
 	EnforcePrecondition(false, order_position >= 0 && order_position <= ::Vehicle::Get(vehicle_id)->GetNumManualOrders());
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, jump_to) && jump_to != ORDER_CURRENT);
 
 	Order order;
 	order.MakeConditional(jump_to);
 
-	int order_pos = AIOrderPositionToRealOrderPosition(vehicle_id, order_position);
-	return AIObject::DoCommand(0, vehicle_id | (order_pos << 20), order.Pack(), CMD_INSERT_ORDER);
+	int order_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position);
+	return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), order.Pack(), CMD_INSERT_ORDER);
 }
 
-/* static */ bool AIOrder::RemoveOrder(VehicleID vehicle_id, OrderPosition order_position)
+/* static */ bool ScriptOrder::RemoveOrder(VehicleID vehicle_id, OrderPosition order_position)
 {
-	order_position = AIOrder::ResolveOrderPosition(vehicle_id, order_position);
+	order_position = ScriptOrder::ResolveOrderPosition(vehicle_id, order_position);
 
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position));
 
-	int order_pos = AIOrderPositionToRealOrderPosition(vehicle_id, order_position);
-	return AIObject::DoCommand(0, vehicle_id, order_pos, CMD_DELETE_ORDER);
+	int order_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position);
+	return ScriptObject::DoCommand(0, vehicle_id, order_pos, CMD_DELETE_ORDER);
 }
 
-/* static */ bool AIOrder::SkipToOrder(VehicleID vehicle_id, OrderPosition next_order)
+/* static */ bool ScriptOrder::SkipToOrder(VehicleID vehicle_id, OrderPosition next_order)
 {
-	next_order = AIOrder::ResolveOrderPosition(vehicle_id, next_order);
+	next_order = ScriptOrder::ResolveOrderPosition(vehicle_id, next_order);
 
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, next_order));
 
-	int order_pos = AIOrderPositionToRealOrderPosition(vehicle_id, next_order);
-	return AIObject::DoCommand(0, vehicle_id, order_pos, CMD_SKIP_TO_ORDER);
+	int order_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, next_order);
+	return ScriptObject::DoCommand(0, vehicle_id, order_pos, CMD_SKIP_TO_ORDER);
 }
 
 /**
@@ -548,38 +548,38 @@
  */
 static void _DoCommandReturnSetOrderFlags(class AIInstance *instance)
 {
-	AIObject::SetLastCommandRes(AIOrder::_SetOrderFlags());
+	ScriptObject::SetLastCommandRes(ScriptOrder::_SetOrderFlags());
 	AIInstance::DoCommandReturn(instance);
 }
 
-/* static */ bool AIOrder::_SetOrderFlags()
+/* static */ bool ScriptOrder::_SetOrderFlags()
 {
 	/* Make sure we don't go into an infinite loop */
-	int retry = AIObject::GetCallbackVariable(3) - 1;
+	int retry = ScriptObject::GetCallbackVariable(3) - 1;
 	if (retry < 0) {
 		DEBUG(ai, 0, "Possible infinite loop in SetOrderFlags() detected");
 		return false;
 	}
-	AIObject::SetCallbackVariable(3, retry);
+	ScriptObject::SetCallbackVariable(3, retry);
 
-	VehicleID vehicle_id = (VehicleID)AIObject::GetCallbackVariable(0);
-	OrderPosition order_position = (OrderPosition)AIObject::GetCallbackVariable(1);
-	AIOrderFlags order_flags = (AIOrderFlags)AIObject::GetCallbackVariable(2);
+	VehicleID vehicle_id = (VehicleID)ScriptObject::GetCallbackVariable(0);
+	OrderPosition order_position = (OrderPosition)ScriptObject::GetCallbackVariable(1);
+	ScriptOrderFlags order_flags = (ScriptOrderFlags)ScriptObject::GetCallbackVariable(2);
 
-	order_position = AIOrder::ResolveOrderPosition(vehicle_id, order_position);
+	order_position = ScriptOrder::ResolveOrderPosition(vehicle_id, order_position);
 
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position));
 	EnforcePrecondition(false, AreOrderFlagsValid(GetOrderDestination(vehicle_id, order_position), order_flags));
 
 	const Order *order = ::ResolveOrder(vehicle_id, order_position);
-	int order_pos = AIOrderPositionToRealOrderPosition(vehicle_id, order_position);
+	int order_pos = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position);
 
-	AIOrderFlags current = GetOrderFlags(vehicle_id, order_position);
+	ScriptOrderFlags current = GetOrderFlags(vehicle_id, order_position);
 
 	EnforcePrecondition(false, (order_flags & AIOF_GOTO_NEAREST_DEPOT) == (current & AIOF_GOTO_NEAREST_DEPOT));
 
 	if ((current & AIOF_NON_STOP_FLAGS) != (order_flags & AIOF_NON_STOP_FLAGS)) {
-		return AIObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & AIOF_NON_STOP_FLAGS) << 4 | MOF_NON_STOP, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
+		return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & AIOF_NON_STOP_FLAGS) << 4 | MOF_NON_STOP, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
 	}
 
 	switch (order->GetType()) {
@@ -588,16 +588,16 @@
 				uint data = DA_ALWAYS_GO;
 				if (order_flags & AIOF_SERVICE_IF_NEEDED) data = DA_SERVICE;
 				if (order_flags & AIOF_STOP_IN_DEPOT) data = DA_STOP;
-				return AIObject::DoCommand(0, vehicle_id | (order_pos << 20), (data << 4) | MOF_DEPOT_ACTION, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
+				return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (data << 4) | MOF_DEPOT_ACTION, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
 			}
 			break;
 
 		case OT_GOTO_STATION:
 			if ((current & AIOF_UNLOAD_FLAGS) != (order_flags & AIOF_UNLOAD_FLAGS)) {
-				return AIObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & AIOF_UNLOAD_FLAGS) << 2 | MOF_UNLOAD, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
+				return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & AIOF_UNLOAD_FLAGS) << 2 | MOF_UNLOAD, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
 			}
 			if ((current & AIOF_LOAD_FLAGS) != (order_flags & AIOF_LOAD_FLAGS)) {
-				return AIObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & AIOF_LOAD_FLAGS) >> 1 | MOF_LOAD, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
+				return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & AIOF_LOAD_FLAGS) >> 1 | MOF_LOAD, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
 			}
 			break;
 
@@ -609,49 +609,49 @@
 	return true;
 }
 
-/* static */ bool AIOrder::SetOrderFlags(VehicleID vehicle_id, OrderPosition order_position, AIOrder::AIOrderFlags order_flags)
+/* static */ bool ScriptOrder::SetOrderFlags(VehicleID vehicle_id, OrderPosition order_position, ScriptOrder::ScriptOrderFlags order_flags)
 {
-	AIObject::SetCallbackVariable(0, vehicle_id);
-	AIObject::SetCallbackVariable(1, order_position);
-	AIObject::SetCallbackVariable(2, order_flags);
+	ScriptObject::SetCallbackVariable(0, vehicle_id);
+	ScriptObject::SetCallbackVariable(1, order_position);
+	ScriptObject::SetCallbackVariable(2, order_flags);
 	/* In case another client(s) change orders at the same time we could
 	 * end in an infinite loop. This stops that from happening ever. */
-	AIObject::SetCallbackVariable(3, 8);
-	return AIOrder::_SetOrderFlags();
+	ScriptObject::SetCallbackVariable(3, 8);
+	return ScriptOrder::_SetOrderFlags();
 }
 
-/* static */ bool AIOrder::MoveOrder(VehicleID vehicle_id, OrderPosition order_position_move, OrderPosition order_position_target)
+/* static */ bool ScriptOrder::MoveOrder(VehicleID vehicle_id, OrderPosition order_position_move, OrderPosition order_position_target)
 {
-	order_position_move   = AIOrder::ResolveOrderPosition(vehicle_id, order_position_move);
-	order_position_target = AIOrder::ResolveOrderPosition(vehicle_id, order_position_target);
+	order_position_move   = ScriptOrder::ResolveOrderPosition(vehicle_id, order_position_move);
+	order_position_target = ScriptOrder::ResolveOrderPosition(vehicle_id, order_position_target);
 
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position_move));
 	EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position_target));
 
-	int order_pos_move = AIOrderPositionToRealOrderPosition(vehicle_id, order_position_move);
-	int order_pos_target = AIOrderPositionToRealOrderPosition(vehicle_id, order_position_target);
-	return AIObject::DoCommand(0, vehicle_id, order_pos_move | (order_pos_target << 16), CMD_MOVE_ORDER);
+	int order_pos_move = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position_move);
+	int order_pos_target = ScriptOrderPositionToRealOrderPosition(vehicle_id, order_position_target);
+	return ScriptObject::DoCommand(0, vehicle_id, order_pos_move | (order_pos_target << 16), CMD_MOVE_ORDER);
 }
 
-/* static */ bool AIOrder::CopyOrders(VehicleID vehicle_id, VehicleID main_vehicle_id)
+/* static */ bool ScriptOrder::CopyOrders(VehicleID vehicle_id, VehicleID main_vehicle_id)
 {
-	EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id));
-	EnforcePrecondition(false, AIVehicle::IsValidVehicle(main_vehicle_id));
+	EnforcePrecondition(false, ScriptVehicle::IsValidVehicle(vehicle_id));
+	EnforcePrecondition(false, ScriptVehicle::IsValidVehicle(main_vehicle_id));
 
-	return AIObject::DoCommand(0, vehicle_id | CO_COPY << 30, main_vehicle_id, CMD_CLONE_ORDER);
+	return ScriptObject::DoCommand(0, vehicle_id | CO_COPY << 30, main_vehicle_id, CMD_CLONE_ORDER);
 }
 
-/* static */ bool AIOrder::ShareOrders(VehicleID vehicle_id, VehicleID main_vehicle_id)
+/* static */ bool ScriptOrder::ShareOrders(VehicleID vehicle_id, VehicleID main_vehicle_id)
 {
-	EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id));
-	EnforcePrecondition(false, AIVehicle::IsValidVehicle(main_vehicle_id));
+	EnforcePrecondition(false, ScriptVehicle::IsValidVehicle(vehicle_id));
+	EnforcePrecondition(false, ScriptVehicle::IsValidVehicle(main_vehicle_id));
 
-	return AIObject::DoCommand(0, vehicle_id | CO_SHARE << 30, main_vehicle_id, CMD_CLONE_ORDER);
+	return ScriptObject::DoCommand(0, vehicle_id | CO_SHARE << 30, main_vehicle_id, CMD_CLONE_ORDER);
 }
 
-/* static */ bool AIOrder::UnshareOrders(VehicleID vehicle_id)
+/* static */ bool ScriptOrder::UnshareOrders(VehicleID vehicle_id)
 {
-	EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id));
+	EnforcePrecondition(false, ScriptVehicle::IsValidVehicle(vehicle_id));
 
-	return AIObject::DoCommand(0, vehicle_id | CO_UNSHARE << 30, 0, CMD_CLONE_ORDER);
+	return ScriptObject::DoCommand(0, vehicle_id | CO_UNSHARE << 30, 0, CMD_CLONE_ORDER);
 }
--- a/src/script/api/script_order.hpp
+++ b/src/script/api/script_order.hpp
@@ -17,14 +17,14 @@
 /**
  * Class that handles all order related functions.
  */
-class AIOrder : public AIObject {
+class ScriptOrder : public ScriptObject {
 public:
 	/**
 	 * All order related error messages.
 	 */
 	enum ErrorMessages {
 		/** Base for all order related errors */
-		ERR_ORDER_BASE = AIError::ERR_CAT_ORDER << AIError::ERR_CAT_BIT_SIZE,
+		ERR_ORDER_BASE = ScriptError::ERR_CAT_ORDER << ScriptError::ERR_CAT_BIT_SIZE,
 
 		/** No more space for orders */
 		ERR_ORDER_TOO_MANY,                                  // [STR_ERROR_NO_MORE_SPACE_FOR_ORDERS]
@@ -36,7 +36,7 @@
 	/**
 	 * Flags that can be used to modify the behaviour of orders.
 	 */
-	enum AIOrderFlags {
+	enum ScriptOrderFlags {
 		/** Just go to the station/depot, stop unload if possible and load if needed. */
 		AIOF_NONE              = 0,
 
@@ -86,7 +86,7 @@
 		/* Order _is_ important, as it's based on OrderConditionVariable in order_type.h. */
 		OC_LOAD_PERCENTAGE,    ///< Skip based on the amount of load, value is in tons.
 		OC_RELIABILITY,        ///< Skip based on the reliability, value is percent (0..100).
-		OC_MAX_SPEED,          ///< Skip based on the maximum speed, value is in OpenTTD's internal speed unit, see AIEngine::GetMaxSpeed.
+		OC_MAX_SPEED,          ///< Skip based on the maximum speed, value is in OpenTTD's internal speed unit, see ScriptEngine::GetMaxSpeed.
 		OC_AGE,                ///< Skip based on the age, value is in years.
 		OC_REQUIRES_SERVICE,   ///< Skip when the vehicle requires service, no value.
 		OC_UNCONDITIONALLY,    ///< Always skip, no compare function, no value.
@@ -134,7 +134,7 @@
 	 * Checks whether the given order id is valid for the given vehicle.
 	 * @param vehicle_id The vehicle to check the order index for.
 	 * @param order_position The order index to check.
-	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
+	 * @pre ScriptVehicle::IsValidVehicle(vehicle_id).
 	 * @return True if and only if the order_position is valid for the given vehicle.
 	 */
 	static bool IsValidVehicleOrder(VehicleID vehicle_id, OrderPosition order_position);
@@ -199,7 +199,7 @@
 	/**
 	 * Checks whether the current order is part of the orderlist.
 	 * @param vehicle_id The vehicle to check.
-	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
+	 * @pre ScriptVehicle::IsValidVehicle(vehicle_id).
 	 * @return True if and only if the current order is part of the order list.
 	 * @note If the order is a non-'non-stop' order, and the vehicle is currently
 	 * (un)loading at a station that is not the final destination, this function
@@ -214,7 +214,7 @@
 	 *  given index does not exist it will return ORDER_INVALID.
 	 * @param vehicle_id The vehicle to check the order index for.
 	 * @param order_position The order index to resolve.
-	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
+	 * @pre ScriptVehicle::IsValidVehicle(vehicle_id).
 	 * @return The resolved order index.
 	 */
 	static OrderPosition ResolveOrderPosition(VehicleID vehicle_id, OrderPosition order_position);
@@ -225,7 +225,7 @@
 	 * @param order_flags The flags given to the order.
 	 * @return True if and only if the order_flags are valid for the given location.
 	 */
-	static bool AreOrderFlagsValid(TileIndex destination, AIOrderFlags order_flags);
+	static bool AreOrderFlagsValid(TileIndex destination, ScriptOrderFlags order_flags);
 
 	/**
 	 * Checks whether the given combination of condition and compare function is valid.
@@ -238,7 +238,7 @@
 	/**
 	 * Returns the number of orders for the given vehicle.
 	 * @param vehicle_id The vehicle to get the order count of.
-	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
+	 * @pre ScriptVehicle::IsValidVehicle(vehicle_id).
 	 * @return The number of orders for the given vehicle or a negative
 	 *   value when the vehicle does not exist.
 	 */
@@ -260,7 +260,7 @@
 	static TileIndex GetOrderDestination(VehicleID vehicle_id, OrderPosition order_position);
 
 	/**
-	 * Gets the AIOrderFlags of the given order for the given vehicle.
+	 * Gets the ScriptOrderFlags of the given order for the given vehicle.
 	 * @param vehicle_id The vehicle to get the destination for.
 	 * @param order_position The order to get the destination for.
 	 * @pre IsValidVehicleOrder(vehicle_id, order_position).
@@ -270,9 +270,9 @@
 	 *  current order as given by ResolveOrderPosition (the current index in the
 	 *  order list) as manual or autoservicing depot orders do not show up
 	 *  in the orderlist, but they can be the current order of a vehicle.
-	 * @return The AIOrderFlags of the order.
+	 * @return The ScriptOrderFlags of the order.
 	 */
-	static AIOrderFlags GetOrderFlags(VehicleID vehicle_id, OrderPosition order_position);
+	static ScriptOrderFlags GetOrderFlags(VehicleID vehicle_id, OrderPosition order_position);
 
 	/**
 	 * Gets the OrderPosition to jump to if the check succeeds of the given order for the given vehicle.
@@ -319,7 +319,7 @@
 	 * @param vehicle_id The vehicle to get the value for.
 	 * @param order_position The order to get the value for.
 	 * @pre IsValidVehicleOrder(vehicle_id, order_position).
-	 * @pre AIVehicle::GetVehicleType(vehicle_id) == AIVehicle::VT_RAIL.
+	 * @pre ScriptVehicle::GetVehicleType(vehicle_id) == ScriptVehicle::VT_RAIL.
 	 * @pre IsGotoStationOrder(vehicle_id, order_position).
 	 * @return The relative position where the train will stop inside a station.
 	 */
@@ -394,7 +394,7 @@
 	 * @param order_position The order to get the value for.
 	 * @param stop_location The relative position where a train will stop inside a station.
 	 * @pre IsValidVehicleOrder(vehicle_id, order_position).
-	 * @pre AIVehicle::GetVehicleType(vehicle_id) == AIVehicle::VT_RAIL.
+	 * @pre ScriptVehicle::GetVehicleType(vehicle_id) == ScriptVehicle::VT_RAIL.
 	 * @pre IsGotoStationOrder(vehicle_id, order_position).
 	 * @pre stop_location >= STOPLOCATION_NEAR && stop_location <= STOPLOCATION_FAR
 	 * @return Whether the order has been/can be changed.
@@ -408,7 +408,7 @@
 	 * @param refit_cargo The cargo to refit to. The refit can be cleared by passing CT_NO_REFIT.
 	 * @pre IsValidVehicleOrder(vehicle_id, order_position).
 	 * @pre IsGotoStationOrder(vehicle_id, order_position) || (IsGotoDepotOrder(vehicle_id, order_position) && refit_cargo != CT_AUTO_REFIT).
-	 * @pre AICargo::IsValidCargo(refit_cargo) || refit_cargo == CT_AUTO_REFIT || refit_cargo == CT_NO_REFIT
+	 * @pre ScriptCargo::IsValidCargo(refit_cargo) || refit_cargo == CT_AUTO_REFIT || refit_cargo == CT_NO_REFIT
 	 * @return Whether the order has been/can be changed.
 	 */
 	static bool SetOrderRefit(VehicleID vehicle_id, OrderPosition order_position, CargoID refit_cargo);
@@ -418,23 +418,23 @@
 	 * @param vehicle_id The vehicle to append the order to.
 	 * @param destination The destination of the order.
 	 * @param order_flags The flags given to the order.
-	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
+	 * @pre ScriptVehicle::IsValidVehicle(vehicle_id).
 	 * @pre AreOrderFlagsValid(destination, order_flags).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIOrder::ERR_ORDER_TOO_MANY
-	 * @exception AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptOrder::ERR_ORDER_TOO_MANY
+	 * @exception ScriptOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION
 	 * @return True if and only if the order was appended.
 	 */
-	static bool AppendOrder(VehicleID vehicle_id, TileIndex destination, AIOrderFlags order_flags);
+	static bool AppendOrder(VehicleID vehicle_id, TileIndex destination, ScriptOrderFlags order_flags);
 
 	/**
 	 * Appends a conditional order to the end of the vehicle's order list.
 	 * @param vehicle_id The vehicle to append the order to.
 	 * @param jump_to The OrderPosition to jump to if the condition is true.
-	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
+	 * @pre ScriptVehicle::IsValidVehicle(vehicle_id).
 	 * @pre IsValidVehicleOrder(vehicle_id, jump_to).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIOrder::ERR_ORDER_TOO_MANY
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptOrder::ERR_ORDER_TOO_MANY
 	 * @return True if and only if the order was appended.
 	 */
 	static bool AppendConditionalOrder(VehicleID vehicle_id, OrderPosition jump_to);
@@ -447,12 +447,12 @@
 	 * @param order_flags The flags given to the order.
 	 * @pre IsValidVehicleOrder(vehicle_id, order_position).
 	 * @pre AreOrderFlagsValid(destination, order_flags).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIOrder::ERR_ORDER_TOO_MANY
-	 * @exception AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptOrder::ERR_ORDER_TOO_MANY
+	 * @exception ScriptOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION
 	 * @return True if and only if the order was inserted.
 	 */
-	static bool InsertOrder(VehicleID vehicle_id, OrderPosition order_position, TileIndex destination, AIOrderFlags order_flags);
+	static bool InsertOrder(VehicleID vehicle_id, OrderPosition order_position, TileIndex destination, ScriptOrderFlags order_flags);
 
 	/**
 	 * Appends a conditional order before the given order_position into the vehicle's order list.
@@ -461,8 +461,8 @@
 	 * @param jump_to The OrderPosition to jump to if the condition is true.
 	 * @pre IsValidVehicleOrder(vehicle_id, order_position).
 	 * @pre IsValidVehicleOrder(vehicle_id, jump_to).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIOrder::ERR_ORDER_TOO_MANY
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptOrder::ERR_ORDER_TOO_MANY
 	 * @return True if and only if the order was inserted.
 	 */
 	static bool InsertConditionalOrder(VehicleID vehicle_id, OrderPosition order_position, OrderPosition jump_to);
@@ -472,7 +472,7 @@
 	 * @param vehicle_id The vehicle to remove the order from.
 	 * @param order_position The order to remove from the order list.
 	 * @pre IsValidVehicleOrder(vehicle_id, order_position).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
 	 * @return True if and only if the order was removed.
 	 */
 	static bool RemoveOrder(VehicleID vehicle_id, OrderPosition order_position);
@@ -492,10 +492,10 @@
 	 * @pre IsValidVehicleOrder(vehicle_id, order_position).
 	 * @pre AreOrderFlagsValid(GetOrderDestination(vehicle_id, order_position), order_flags).
 	 * @pre (order_flags & AIOF_GOTO_NEAREST_DEPOT) == (GetOrderFlags(vehicle_id, order_position) & AIOF_GOTO_NEAREST_DEPOT).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
 	 * @return True if and only if the order was changed.
 	 */
-	static bool SetOrderFlags(VehicleID vehicle_id, OrderPosition order_position, AIOrderFlags order_flags);
+	static bool SetOrderFlags(VehicleID vehicle_id, OrderPosition order_position, ScriptOrderFlags order_flags);
 
 	/**
 	 * Move an order inside the orderlist
@@ -504,7 +504,7 @@
 	 * @param order_position_target The target order
 	 * @pre IsValidVehicleOrder(vehicle_id, order_position_move).
 	 * @pre IsValidVehicleOrder(vehicle_id, order_position_target).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
 	 * @return True if and only if the order was moved.
 	 * @note If the order is moved to a lower place (e.g. from 7 to 2)
 	 *  the target order is moved upwards (e.g. 3). If the order is moved
@@ -518,7 +518,7 @@
 	 * @param vehicle_id The vehicle that should skip some orders.
 	 * @param next_order The order the vehicle should skip to.
 	 * @pre IsValidVehicleOrder(vehicle_id, next_order).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
 	 * @return True if and only the current order was changed.
 	 */
 	static bool SkipToOrder(VehicleID vehicle_id, OrderPosition next_order);
@@ -528,10 +528,10 @@
 	 *  are going to be the orders of the changed vehicle.
 	 * @param vehicle_id The vehicle to copy the orders to.
 	 * @param main_vehicle_id The vehicle to copy the orders from.
-	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
-	 * @pre AIVehicle::IsValidVehicle(main_vehicle_id).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIOrder::ERR_ORDER_TOO_MANY
+	 * @pre ScriptVehicle::IsValidVehicle(vehicle_id).
+	 * @pre ScriptVehicle::IsValidVehicle(main_vehicle_id).
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptOrder::ERR_ORDER_TOO_MANY
 	 * @return True if and only if the copying succeeded.
 	 */
 	static bool CopyOrders(VehicleID vehicle_id, VehicleID main_vehicle_id);
@@ -541,9 +541,9 @@
 	 * vehicle are going to be the orders of the changed vehicle.
 	 * @param vehicle_id The vehicle to add to the shared order list.
 	 * @param main_vehicle_id The vehicle to share the orders with.
-	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
-	 * @pre AIVehicle::IsValidVehicle(main_vehicle_id).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @pre ScriptVehicle::IsValidVehicle(vehicle_id).
+	 * @pre ScriptVehicle::IsValidVehicle(main_vehicle_id).
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
 	 * @return True if and only if the sharing succeeded.
 	 */
 	static bool ShareOrders(VehicleID vehicle_id, VehicleID main_vehicle_id);
@@ -551,11 +551,11 @@
 	/**
 	 * Removes the given vehicle from a shared orders list.
 	 * @param vehicle_id The vehicle to remove from the shared order list.
-	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
+	 * @pre ScriptVehicle::IsValidVehicle(vehicle_id).
 	 * @return True if and only if the unsharing succeeded.
 	 */
 	static bool UnshareOrders(VehicleID vehicle_id);
 };
-DECLARE_ENUM_AS_BIT_SET(AIOrder::AIOrderFlags)
+DECLARE_ENUM_AS_BIT_SET(ScriptOrder::ScriptOrderFlags)
 
 #endif /* SCRIPT_ORDER_HPP */
--- a/src/script/api/script_rail.cpp
+++ b/src/script/api/script_rail.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_rail.cpp Implementation of AIRail. */
+/** @file script_rail.cpp Implementation of ScriptRail. */
 
 #include "../../stdafx.h"
 #include "script_rail.hpp"
@@ -23,7 +23,7 @@
 #include "../../newgrf_station.h"
 #include "../../strings_func.h"
 
-/* static */ char *AIRail::GetName(RailType rail_type)
+/* static */ char *ScriptRail::GetName(RailType rail_type)
 {
 	if (!IsRailTypeAvailable(rail_type)) return NULL;
 
@@ -34,7 +34,7 @@
 	return railtype_name;
 }
 
-/* static */ bool AIRail::IsRailTile(TileIndex tile)
+/* static */ bool ScriptRail::IsRailTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
@@ -42,100 +42,100 @@
 			(::HasStationTileRail(tile) && !::IsStationTileBlocked(tile)) || ::IsLevelCrossingTile(tile);
 }
 
-/* static */ bool AIRail::IsLevelCrossingTile(TileIndex tile)
+/* static */ bool ScriptRail::IsLevelCrossingTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsLevelCrossingTile(tile);
 }
 
-/* static */ bool AIRail::IsRailDepotTile(TileIndex tile)
+/* static */ bool ScriptRail::IsRailDepotTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsRailDepotTile(tile);
 }
 
-/* static */ bool AIRail::IsRailStationTile(TileIndex tile)
+/* static */ bool ScriptRail::IsRailStationTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsRailStationTile(tile);
 }
 
-/* static */ bool AIRail::IsRailWaypointTile(TileIndex tile)
+/* static */ bool ScriptRail::IsRailWaypointTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsRailWaypointTile(tile);
 }
 
-/* static */ bool AIRail::IsRailTypeAvailable(RailType rail_type)
+/* static */ bool ScriptRail::IsRailTypeAvailable(RailType rail_type)
 {
 	if ((::RailType)rail_type < RAILTYPE_BEGIN || (::RailType)rail_type >= RAILTYPE_END) return false;
 
 	return ::HasRailtypeAvail(_current_company, (::RailType)rail_type);
 }
 
-/* static */ AIRail::RailType AIRail::GetCurrentRailType()
+/* static */ ScriptRail::RailType ScriptRail::GetCurrentRailType()
 {
-	return (RailType)AIObject::GetRailType();
+	return (RailType)ScriptObject::GetRailType();
 }
 
-/* static */ void AIRail::SetCurrentRailType(RailType rail_type)
+/* static */ void ScriptRail::SetCurrentRailType(RailType rail_type)
 {
 	if (!IsRailTypeAvailable(rail_type)) return;
 
-	AIObject::SetRailType((::RailType)rail_type);
+	ScriptObject::SetRailType((::RailType)rail_type);
 }
 
-/* static */ bool AIRail::TrainCanRunOnRail(AIRail::RailType engine_rail_type, AIRail::RailType track_rail_type)
+/* static */ bool ScriptRail::TrainCanRunOnRail(ScriptRail::RailType engine_rail_type, ScriptRail::RailType track_rail_type)
 {
-	if (!AIRail::IsRailTypeAvailable(engine_rail_type)) return false;
-	if (!AIRail::IsRailTypeAvailable(track_rail_type)) return false;
+	if (!ScriptRail::IsRailTypeAvailable(engine_rail_type)) return false;
+	if (!ScriptRail::IsRailTypeAvailable(track_rail_type)) return false;
 
 	return ::IsCompatibleRail((::RailType)engine_rail_type, (::RailType)track_rail_type);
 }
 
-/* static */ bool AIRail::TrainHasPowerOnRail(AIRail::RailType engine_rail_type, AIRail::RailType track_rail_type)
+/* static */ bool ScriptRail::TrainHasPowerOnRail(ScriptRail::RailType engine_rail_type, ScriptRail::RailType track_rail_type)
 {\
-	if (!AIRail::IsRailTypeAvailable(engine_rail_type)) return false;
-	if (!AIRail::IsRailTypeAvailable(track_rail_type)) return false;
+	if (!ScriptRail::IsRailTypeAvailable(engine_rail_type)) return false;
+	if (!ScriptRail::IsRailTypeAvailable(track_rail_type)) return false;
 
 	return ::HasPowerOnRail((::RailType)engine_rail_type, (::RailType)track_rail_type);
 }
 
-/* static */ AIRail::RailType AIRail::GetRailType(TileIndex tile)
+/* static */ ScriptRail::RailType ScriptRail::GetRailType(TileIndex tile)
 {
-	if (!AITile::HasTransportType(tile, AITile::TRANSPORT_RAIL)) return RAILTYPE_INVALID;
+	if (!ScriptTile::HasTransportType(tile, ScriptTile::TRANSPORT_RAIL)) return RAILTYPE_INVALID;
 
 	return (RailType)::GetRailType(tile);
 }
 
-/* static */ bool AIRail::ConvertRailType(TileIndex start_tile, TileIndex end_tile, AIRail::RailType convert_to)
+/* static */ bool ScriptRail::ConvertRailType(TileIndex start_tile, TileIndex end_tile, ScriptRail::RailType convert_to)
 {
 	EnforcePrecondition(false, ::IsValidTile(start_tile));
 	EnforcePrecondition(false, ::IsValidTile(end_tile));
 	EnforcePrecondition(false, IsRailTypeAvailable(convert_to));
 
-	return AIObject::DoCommand(start_tile, end_tile, convert_to, CMD_CONVERT_RAIL);
+	return ScriptObject::DoCommand(start_tile, end_tile, convert_to, CMD_CONVERT_RAIL);
 }
 
-/* static */ TileIndex AIRail::GetRailDepotFrontTile(TileIndex depot)
+/* static */ TileIndex ScriptRail::GetRailDepotFrontTile(TileIndex depot)
 {
 	if (!IsRailDepotTile(depot)) return INVALID_TILE;
 
 	return depot + ::TileOffsByDiagDir(::GetRailDepotDirection(depot));
 }
 
-/* static */ AIRail::RailTrack AIRail::GetRailStationDirection(TileIndex tile)
+/* static */ ScriptRail::RailTrack ScriptRail::GetRailStationDirection(TileIndex tile)
 {
 	if (!IsRailStationTile(tile)) return RAILTRACK_INVALID;
 
 	return (RailTrack)::GetRailStationTrackBits(tile);
 }
 
-/* static */ bool AIRail::BuildRailDepot(TileIndex tile, TileIndex front)
+/* static */ bool ScriptRail::BuildRailDepot(TileIndex tile, TileIndex front)
 {
 	EnforcePrecondition(false, tile != front);
 	EnforcePrecondition(false, ::IsValidTile(tile));
@@ -145,43 +145,43 @@
 
 	uint entrance_dir = (::TileX(tile) == ::TileX(front)) ? (::TileY(tile) < ::TileY(front) ? 1 : 3) : (::TileX(tile) < ::TileX(front) ? 2 : 0);
 
-	return AIObject::DoCommand(tile, AIObject::GetRailType(), entrance_dir, CMD_BUILD_TRAIN_DEPOT);
+	return ScriptObject::DoCommand(tile, ScriptObject::GetRailType(), entrance_dir, CMD_BUILD_TRAIN_DEPOT);
 }
 
-/* static */ bool AIRail::BuildRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id)
+/* static */ bool ScriptRail::BuildRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, direction == RAILTRACK_NW_SE || direction == RAILTRACK_NE_SW);
 	EnforcePrecondition(false, num_platforms > 0 && num_platforms <= 0xFF);
 	EnforcePrecondition(false, platform_length > 0 && platform_length <= 0xFF);
 	EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
-	EnforcePrecondition(false, station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id));
+	EnforcePrecondition(false, station_id == ScriptStation::STATION_NEW || station_id == ScriptStation::STATION_JOIN_ADJACENT || ScriptStation::IsValidStation(station_id));
 
 	uint32 p1 = GetCurrentRailType() | (platform_length << 16) | (num_platforms << 8);
 	if (direction == RAILTRACK_NW_SE) p1 |= (1 << 4);
-	if (station_id != AIStation::STATION_JOIN_ADJACENT) p1 |= (1 << 24);
-	return AIObject::DoCommand(tile, p1, (AIStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16, CMD_BUILD_RAIL_STATION);
+	if (station_id != ScriptStation::STATION_JOIN_ADJACENT) p1 |= (1 << 24);
+	return ScriptObject::DoCommand(tile, p1, (ScriptStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16, CMD_BUILD_RAIL_STATION);
 }
 
-/* static */ bool AIRail::BuildNewGRFRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id, CargoID cargo_id, IndustryType source_industry, IndustryType goal_industry, int distance, bool source_station)
+/* static */ bool ScriptRail::BuildNewGRFRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id, CargoID cargo_id, IndustryType source_industry, IndustryType goal_industry, int distance, bool source_station)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, direction == RAILTRACK_NW_SE || direction == RAILTRACK_NE_SW);
 	EnforcePrecondition(false, num_platforms > 0 && num_platforms <= 0xFF);
 	EnforcePrecondition(false, platform_length > 0 && platform_length <= 0xFF);
 	EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
-	EnforcePrecondition(false, station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id));
-	EnforcePrecondition(false, AICargo::IsValidCargo(cargo_id));
-	EnforcePrecondition(false, source_industry == AIIndustryType::INDUSTRYTYPE_UNKNOWN || source_industry == AIIndustryType::INDUSTRYTYPE_TOWN || AIIndustryType::IsValidIndustryType(source_industry));
-	EnforcePrecondition(false, goal_industry   == AIIndustryType::INDUSTRYTYPE_UNKNOWN || goal_industry   == AIIndustryType::INDUSTRYTYPE_TOWN || AIIndustryType::IsValidIndustryType(goal_industry));
+	EnforcePrecondition(false, station_id == ScriptStation::STATION_NEW || station_id == ScriptStation::STATION_JOIN_ADJACENT || ScriptStation::IsValidStation(station_id));
+	EnforcePrecondition(false, ScriptCargo::IsValidCargo(cargo_id));
+	EnforcePrecondition(false, source_industry == ScriptIndustryType::INDUSTRYTYPE_UNKNOWN || source_industry == ScriptIndustryType::INDUSTRYTYPE_TOWN || ScriptIndustryType::IsValidIndustryType(source_industry));
+	EnforcePrecondition(false, goal_industry   == ScriptIndustryType::INDUSTRYTYPE_UNKNOWN || goal_industry   == ScriptIndustryType::INDUSTRYTYPE_TOWN || ScriptIndustryType::IsValidIndustryType(goal_industry));
 
 	uint32 p1 = GetCurrentRailType() | (platform_length << 16) | (num_platforms << 8);
 	if (direction == RAILTRACK_NW_SE) p1 |= 1 << 4;
-	if (station_id != AIStation::STATION_JOIN_ADJACENT) p1 |= (1 << 24);
+	if (station_id != ScriptStation::STATION_JOIN_ADJACENT) p1 |= (1 << 24);
 
 	const GRFFile *file;
 	uint16 res = GetAiPurchaseCallbackResult(GSF_STATIONS, cargo_id, 0, source_industry, goal_industry, min(255, distance / 2), AICE_STATION_GET_STATION_ID, source_station ? 0 : 1, min(15, num_platforms) << 4 | min(15, platform_length), &file);
-	uint32 p2 = (AIStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16;
+	uint32 p2 = (ScriptStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16;
 	if (res != CALLBACK_FAILED) {
 		int index = 0;
 		const StationSpec *spec = StationClass::GetByGrf(file->grfid, res, &index);
@@ -192,36 +192,36 @@
 		}
 
 	}
-	return AIObject::DoCommand(tile, p1, p2, CMD_BUILD_RAIL_STATION);
+	return ScriptObject::DoCommand(tile, p1, p2, CMD_BUILD_RAIL_STATION);
 }
 
-/* static */ bool AIRail::BuildRailWaypoint(TileIndex tile)
+/* static */ bool ScriptRail::BuildRailWaypoint(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, IsRailTile(tile));
 	EnforcePrecondition(false, GetRailTracks(tile) == RAILTRACK_NE_SW || GetRailTracks(tile) == RAILTRACK_NW_SE);
 	EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
 
-	return AIObject::DoCommand(tile, GetCurrentRailType() | (GetRailTracks(tile) == RAILTRACK_NE_SW ? AXIS_X : AXIS_Y) << 4 | 1 << 8 | 1 << 16, STAT_CLASS_WAYP | INVALID_STATION << 16, CMD_BUILD_RAIL_WAYPOINT);
+	return ScriptObject::DoCommand(tile, GetCurrentRailType() | (GetRailTracks(tile) == RAILTRACK_NE_SW ? AXIS_X : AXIS_Y) << 4 | 1 << 8 | 1 << 16, STAT_CLASS_WAYP | INVALID_STATION << 16, CMD_BUILD_RAIL_WAYPOINT);
 }
 
-/* static */ bool AIRail::RemoveRailWaypointTileRectangle(TileIndex tile, TileIndex tile2, bool keep_rail)
+/* static */ bool ScriptRail::RemoveRailWaypointTileRectangle(TileIndex tile, TileIndex tile2, bool keep_rail)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, ::IsValidTile(tile2));
 
-	return AIObject::DoCommand(tile, tile2, keep_rail ? 1 : 0, CMD_REMOVE_FROM_RAIL_WAYPOINT);
+	return ScriptObject::DoCommand(tile, tile2, keep_rail ? 1 : 0, CMD_REMOVE_FROM_RAIL_WAYPOINT);
 }
 
-/* static */ bool AIRail::RemoveRailStationTileRectangle(TileIndex tile, TileIndex tile2, bool keep_rail)
+/* static */ bool ScriptRail::RemoveRailStationTileRectangle(TileIndex tile, TileIndex tile2, bool keep_rail)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, ::IsValidTile(tile2));
 
-	return AIObject::DoCommand(tile, tile2, keep_rail ? 1 : 0, CMD_REMOVE_FROM_RAIL_STATION);
+	return ScriptObject::DoCommand(tile, tile2, keep_rail ? 1 : 0, CMD_REMOVE_FROM_RAIL_STATION);
 }
 
-/* static */ uint AIRail::GetRailTracks(TileIndex tile)
+/* static */ uint ScriptRail::GetRailTracks(TileIndex tile)
 {
 	if (!IsRailTile(tile)) return RAILTRACK_INVALID;
 
@@ -231,7 +231,7 @@
 	return ::GetTrackBits(tile);
 }
 
-/* static */ bool AIRail::BuildRailTrack(TileIndex tile, RailTrack rail_track)
+/* static */ bool ScriptRail::BuildRailTrack(TileIndex tile, RailTrack rail_track)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, rail_track != 0);
@@ -239,23 +239,23 @@
 	EnforcePrecondition(false, KillFirstBit((uint)rail_track) == 0);
 	EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
 
-	return AIObject::DoCommand(tile, tile, GetCurrentRailType() | (FindFirstTrack((::TrackBits)rail_track) << 4), CMD_BUILD_RAILROAD_TRACK);
+	return ScriptObject::DoCommand(tile, tile, GetCurrentRailType() | (FindFirstTrack((::TrackBits)rail_track) << 4), CMD_BUILD_RAILROAD_TRACK);
 }
 
-/* static */ bool AIRail::RemoveRailTrack(TileIndex tile, RailTrack rail_track)
+/* static */ bool ScriptRail::RemoveRailTrack(TileIndex tile, RailTrack rail_track)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, ::IsPlainRailTile(tile) || ::IsLevelCrossingTile(tile));
 	EnforcePrecondition(false, GetRailTracks(tile) & rail_track);
 	EnforcePrecondition(false, KillFirstBit((uint)rail_track) == 0);
 
-	return AIObject::DoCommand(tile, tile, GetCurrentRailType() | (FindFirstTrack((::TrackBits)rail_track) << 4), CMD_REMOVE_RAILROAD_TRACK);
+	return ScriptObject::DoCommand(tile, tile, GetCurrentRailType() | (FindFirstTrack((::TrackBits)rail_track) << 4), CMD_REMOVE_RAILROAD_TRACK);
 }
 
-/* static */ bool AIRail::AreTilesConnected(TileIndex from, TileIndex tile, TileIndex to)
+/* static */ bool ScriptRail::AreTilesConnected(TileIndex from, TileIndex tile, TileIndex to)
 {
 	if (!IsRailTile(tile)) return false;
-	if (from == to || AIMap::DistanceManhattan(from, tile) != 1 || AIMap::DistanceManhattan(tile, to) != 1) return false;
+	if (from == to || ScriptMap::DistanceManhattan(from, tile) != 1 || ScriptMap::DistanceManhattan(tile, to) != 1) return false;
 
 	if (to < from) ::Swap(from, to);
 
@@ -280,7 +280,7 @@
 static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
 {
 	int diag_offset = abs(abs((int)::TileX(*to) - (int)::TileX(tile)) - abs((int)::TileY(*to) - (int)::TileY(tile)));
-	uint32 p2 = AIRail::GetCurrentRailType();
+	uint32 p2 = ScriptRail::GetCurrentRailType();
 	if (::TileY(from) == ::TileY(*to)) {
 		p2 |= (TRACK_X << 4);
 		*to -= Clamp((int)::TileX(*to) - (int)::TileX(tile), -1, 1);
@@ -335,7 +335,7 @@
 	return p2;
 }
 
-/* static */ bool AIRail::BuildRail(TileIndex from, TileIndex tile, TileIndex to)
+/* static */ bool ScriptRail::BuildRail(TileIndex from, TileIndex tile, TileIndex to)
 {
 	EnforcePrecondition(false, ::IsValidTile(from));
 	EnforcePrecondition(false, ::IsValidTile(tile));
@@ -349,10 +349,10 @@
 			(::TileY(from) == ::TileY(tile) && ::TileY(tile) == ::TileY(to)));
 
 	uint32 p2 = SimulateDrag(from, tile, &to) | 1 << 8;
-	return AIObject::DoCommand(tile, to, p2, CMD_BUILD_RAILROAD_TRACK);
+	return ScriptObject::DoCommand(tile, to, p2, CMD_BUILD_RAILROAD_TRACK);
 }
 
-/* static */ bool AIRail::RemoveRail(TileIndex from, TileIndex tile, TileIndex to)
+/* static */ bool ScriptRail::RemoveRail(TileIndex from, TileIndex tile, TileIndex to)
 {
 	EnforcePrecondition(false, ::IsValidTile(from));
 	EnforcePrecondition(false, ::IsValidTile(tile));
@@ -366,14 +366,14 @@
 
 	if (!IsRailTypeAvailable(GetCurrentRailType())) SetCurrentRailType(GetRailType(tile));
 	uint32 p2 = SimulateDrag(from, tile, &to);
-	return AIObject::DoCommand(tile, to, p2, CMD_REMOVE_RAILROAD_TRACK);
+	return ScriptObject::DoCommand(tile, to, p2, CMD_REMOVE_RAILROAD_TRACK);
 }
 
 /**
  * Contains information about the trackdir that belongs to a track when entering
  *   from a specific direction.
  */
-struct AIRailSignalData {
+struct ScriptRailSignalData {
 	Track track;        ///< The track that will be taken to travel.
 	Trackdir trackdir;  ///< The Trackdir belonging to that track.
 	uint signal_cycles; ///< How many times the signal should be cycled in order to build it in the correct direction.
@@ -387,7 +387,7 @@
  *   TileIndex of the previous and current tile, where (-)MapSizeX is replaced with -2 / 2 and
  *   2 it added.
  */
-static const AIRailSignalData _possible_trackdirs[5][NUM_TRACK_DIRECTIONS] = {
+static const ScriptRailSignalData _possible_trackdirs[5][NUM_TRACK_DIRECTIONS] = {
 	{{TRACK_UPPER,   TRACKDIR_UPPER_E, 0}, {TRACK_Y,       TRACKDIR_Y_SE,    0}, {TRACK_LEFT,    TRACKDIR_LEFT_S,  1}},
 	{{TRACK_RIGHT,   TRACKDIR_RIGHT_S, 1}, {TRACK_X,       TRACKDIR_X_SW,    1}, {TRACK_UPPER,   TRACKDIR_UPPER_W, 1}},
 	{{INVALID_TRACK, INVALID_TRACKDIR, 0}, {INVALID_TRACK, INVALID_TRACKDIR, 0}, {INVALID_TRACK, INVALID_TRACKDIR, 0}},
@@ -395,9 +395,9 @@
 	{{TRACK_RIGHT,   TRACKDIR_RIGHT_N, 0}, {TRACK_Y,       TRACKDIR_Y_NW,    1}, {TRACK_LOWER,   TRACKDIR_LOWER_W, 1}}
 };
 
-/* static */ AIRail::SignalType AIRail::GetSignalType(TileIndex tile, TileIndex front)
+/* static */ ScriptRail::SignalType ScriptRail::GetSignalType(TileIndex tile, TileIndex front)
 {
-	if (AIMap::DistanceManhattan(tile, front) != 1) return SIGNALTYPE_NONE;
+	if (ScriptMap::DistanceManhattan(tile, front) != 1) return SIGNALTYPE_NONE;
 	if (!::IsTileType(tile, MP_RAILWAY) || !::HasSignals(tile)) return SIGNALTYPE_NONE;
 
 	int data_index = 2 + (::TileX(front) - ::TileX(tile)) + 2 * (::TileY(front) - ::TileY(tile));
@@ -420,14 +420,14 @@
  */
 static bool IsValidSignalType(int signal_type)
 {
-	if (signal_type < AIRail::SIGNALTYPE_NORMAL || signal_type > AIRail::SIGNALTYPE_COMBO_TWOWAY) return false;
-	if (signal_type > AIRail::SIGNALTYPE_PBS_ONEWAY && signal_type < AIRail::SIGNALTYPE_NORMAL_TWOWAY) return false;
+	if (signal_type < ScriptRail::SIGNALTYPE_NORMAL || signal_type > ScriptRail::SIGNALTYPE_COMBO_TWOWAY) return false;
+	if (signal_type > ScriptRail::SIGNALTYPE_PBS_ONEWAY && signal_type < ScriptRail::SIGNALTYPE_NORMAL_TWOWAY) return false;
 	return true;
 }
 
-/* static */ bool AIRail::BuildSignal(TileIndex tile, TileIndex front, SignalType signal)
+/* static */ bool ScriptRail::BuildSignal(TileIndex tile, TileIndex front, SignalType signal)
 {
-	EnforcePrecondition(false, AIMap::DistanceManhattan(tile, front) == 1)
+	EnforcePrecondition(false, ScriptMap::DistanceManhattan(tile, front) == 1)
 	EnforcePrecondition(false, ::IsPlainRailTile(tile));
 	EnforcePrecondition(false, ::IsValidSignalType(signal));
 
@@ -451,12 +451,12 @@
 	}
 	p1 |= ((signal >= SIGNALTYPE_TWOWAY ? signal ^ SIGNALTYPE_TWOWAY : signal) << 5);
 
-	return AIObject::DoCommand(tile, p1, 0, CMD_BUILD_SIGNALS);
+	return ScriptObject::DoCommand(tile, p1, 0, CMD_BUILD_SIGNALS);
 }
 
-/* static */ bool AIRail::RemoveSignal(TileIndex tile, TileIndex front)
+/* static */ bool ScriptRail::RemoveSignal(TileIndex tile, TileIndex front)
 {
-	EnforcePrecondition(false, AIMap::DistanceManhattan(tile, front) == 1)
+	EnforcePrecondition(false, ScriptMap::DistanceManhattan(tile, front) == 1)
 	EnforcePrecondition(false, GetSignalType(tile, front) != SIGNALTYPE_NONE);
 
 	Track track = INVALID_TRACK;
@@ -469,12 +469,12 @@
 	}
 	EnforcePrecondition(false, track != INVALID_TRACK);
 
-	return AIObject::DoCommand(tile, track, 0, CMD_REMOVE_SIGNALS);
+	return ScriptObject::DoCommand(tile, track, 0, CMD_REMOVE_SIGNALS);
 }
 
-/* static */ Money AIRail::GetBuildCost(RailType railtype, BuildType build_type)
+/* static */ Money ScriptRail::GetBuildCost(RailType railtype, BuildType build_type)
 {
-	if (!AIRail::IsRailTypeAvailable(railtype)) return -1;
+	if (!ScriptRail::IsRailTypeAvailable(railtype)) return -1;
 
 	switch (build_type) {
 		case BT_TRACK:    return ::RailBuildCost((::RailType)railtype);
@@ -486,9 +486,9 @@
 	}
 }
 
-/* static */ int32 AIRail::GetMaxSpeed(RailType railtype)
+/* static */ int32 ScriptRail::GetMaxSpeed(RailType railtype)
 {
-	if (!AIRail::IsRailTypeAvailable(railtype)) return -1;
+	if (!ScriptRail::IsRailTypeAvailable(railtype)) return -1;
 
 	return ::GetRailTypeInfo((::RailType)railtype)->max_speed;
 }
--- a/src/script/api/script_rail.hpp
+++ b/src/script/api/script_rail.hpp
@@ -17,14 +17,14 @@
 /**
  * Class that handles all rail related functions.
  */
-class AIRail : public AIObject {
+class ScriptRail : public ScriptObject {
 public:
 	/**
 	 * All rail related error messages.
 	 */
 	enum ErrorMessages {
 		/** Base for rail building / maintaining errors */
-		ERR_RAIL_BASE = AIError::ERR_CAT_RAIL << AIError::ERR_CAT_BIT_SIZE,
+		ERR_RAIL_BASE = ScriptError::ERR_CAT_RAIL << ScriptError::ERR_CAT_BIT_SIZE,
 
 		/** One-way roads cannot have crossings */
 		ERR_CROSSING_ON_ONEWAY_ROAD,       // [STR_ERROR_CROSSING_ON_ONEWAY_ROAD]
@@ -105,7 +105,7 @@
 	 *  used to traverse a tile. This excludes rail depots but includes
 	 *  stations and waypoints.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has rail.
 	 */
 	static bool IsRailTile(TileIndex tile);
@@ -120,7 +120,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a rail depot.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has a rail depot.
 	 */
 	static bool IsRailDepotTile(TileIndex tile);
@@ -128,7 +128,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a rail station.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has a rail station.
 	 */
 	static bool IsRailStationTile(TileIndex tile);
@@ -136,7 +136,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a rail waypoint.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has a rail waypoint.
 	 */
 	static bool IsRailWaypointTile(TileIndex tile);
@@ -149,13 +149,13 @@
 	static bool IsRailTypeAvailable(RailType rail_type);
 
 	/**
-	 * Get the current RailType set for all AIRail functions.
+	 * Get the current RailType set for all ScriptRail functions.
 	 * @return The RailType currently set.
 	 */
 	static RailType GetCurrentRailType();
 
 	/**
-	 * Set the RailType for all further AIRail functions.
+	 * Set the RailType for all further ScriptRail functions.
 	 * @param rail_type The RailType to set.
 	 */
 	static void SetCurrentRailType(RailType rail_type);
@@ -164,28 +164,28 @@
 	 * Check if a train build for a rail type can run on another rail type.
 	 * @param engine_rail_type The rail type the train is build for.
 	 * @param track_rail_type The type you want to check.
-	 * @pre AIRail::IsRailTypeAvailable(engine_rail_type).
-	 * @pre AIRail::IsRailTypeAvailable(track_rail_type).
+	 * @pre ScriptRail::IsRailTypeAvailable(engine_rail_type).
+	 * @pre ScriptRail::IsRailTypeAvailable(track_rail_type).
 	 * @return Whether a train build for 'engine_rail_type' can run on 'track_rail_type'.
 	 * @note Even if a train can run on a RailType that doesn't mean that it'll be
 	 *   able to power the train. Use TrainHasPowerOnRail for that.
 	 */
-	static bool TrainCanRunOnRail(AIRail::RailType engine_rail_type, AIRail::RailType track_rail_type);
+	static bool TrainCanRunOnRail(ScriptRail::RailType engine_rail_type, ScriptRail::RailType track_rail_type);
 
 	/**
 	 * Check if a train build for a rail type has power on another rail type.
 	 * @param engine_rail_type The rail type the train is build for.
 	 * @param track_rail_type The type you want to check.
-	 * @pre AIRail::IsRailTypeAvailable(engine_rail_type).
-	 * @pre AIRail::IsRailTypeAvailable(track_rail_type).
+	 * @pre ScriptRail::IsRailTypeAvailable(engine_rail_type).
+	 * @pre ScriptRail::IsRailTypeAvailable(track_rail_type).
 	 * @return Whether a train build for 'engine_rail_type' has power on 'track_rail_type'.
 	 */
-	static bool TrainHasPowerOnRail(AIRail::RailType engine_rail_type, AIRail::RailType track_rail_type);
+	static bool TrainHasPowerOnRail(ScriptRail::RailType engine_rail_type, ScriptRail::RailType track_rail_type);
 
 	/**
 	 * Get the RailType that is used on a tile.
 	 * @param tile The tile to check.
-	 * @pre AITile::HasTransportType(tile, AITile.TRANSPORT_RAIL).
+	 * @pre ScriptTile::HasTransportType(tile, ScriptTile.TRANSPORT_RAIL).
 	 * @return The RailType that is used on a tile.
 	 */
 	static RailType GetRailType(TileIndex tile);
@@ -195,13 +195,13 @@
 	 * @param start_tile One corner of the rectangle.
 	 * @param end_tile The opposite corner of the rectangle.
 	 * @param convert_to The RailType you want to convert the rails to.
-	 * @pre AIMap::IsValidTile(start_tile).
-	 * @pre AIMap::IsValidTile(end_tile).
+	 * @pre ScriptMap::IsValidTile(start_tile).
+	 * @pre ScriptMap::IsValidTile(end_tile).
 	 * @pre IsRailTypeAvailable(convert_to).
-	 * @exception AIRail::ERR_UNSUITABLE_TRACK
+	 * @exception ScriptRail::ERR_UNSUITABLE_TRACK
 	 * @return Whether at least some rail has been converted successfully.
 	 */
-	static bool ConvertRailType(TileIndex start_tile, TileIndex end_tile, AIRail::RailType convert_to);
+	static bool ConvertRailType(TileIndex start_tile, TileIndex end_tile, ScriptRail::RailType convert_to);
 
 	/**
 	 * Gets the tile in front of a rail depot.
@@ -223,12 +223,12 @@
 	 * Builds a rail depot.
 	 * @param tile Place to build the depot.
 	 * @param front The tile exactly in front of the depot.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @pre AIMap::IsValidTile(front).
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(front).
 	 * @pre 'tile' is not equal to 'front', but in a straight line of it.
 	 * @pre IsRailTypeAvailable(GetCurrentRailType()).
-	 * @exception AIError::ERR_FLAT_LAND_REQUIRED
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_FLAT_LAND_REQUIRED
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
 	 * @return Whether the rail depot has been/can be build or not.
 	 */
 	static bool BuildRailDepot(TileIndex tile, TileIndex front);
@@ -239,19 +239,19 @@
 	 * @param direction The direction to build the station.
 	 * @param num_platforms The number of platforms to build.
 	 * @param platform_length The length of each platform.
-	 * @param station_id The station to join, AIStation::STATION_NEW or AIStation::STATION_JOIN_ADJACENT.
+	 * @param station_id The station to join, ScriptStation::STATION_NEW or ScriptStation::STATION_JOIN_ADJACENT.
 	 * @pre IsRailTypeAvailable(GetCurrentRailType()).
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre direction == RAILTRACK_NW_SE || direction == RAILTRACK_NE_SW.
 	 * @pre num_platforms > 0 && num_platforms <= 255.
 	 * @pre platform_length > 0 && platform_length <= 255.
-	 * @pre station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_FLAT_LAND_REQUIRED
-	 * @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
-	 * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
-	 * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
+	 * @pre station_id == ScriptStation::STATION_NEW || station_id == ScriptStation::STATION_JOIN_ADJACENT || ScriptStation::IsValidStation(station_id).
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_FLAT_LAND_REQUIRED
+	 * @exception ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
+	 * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS
+	 * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
 	 * @return Whether the station has been/can be build or not.
 	 */
 	static bool BuildRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id);
@@ -264,27 +264,27 @@
 	 * @param direction The direction to build the station.
 	 * @param num_platforms The number of platforms to build.
 	 * @param platform_length The length of each platform.
-	 * @param station_id The station to join, AIStation::STATION_NEW or AIStation::STATION_JOIN_ADJACENT.
+	 * @param station_id The station to join, ScriptStation::STATION_NEW or ScriptStation::STATION_JOIN_ADJACENT.
 	 * @param cargo_id The CargoID of the cargo that will be transported from / to this station.
-	 * @param source_industry The IndustryType of the industry you'll transport goods from, AIIndustryType::INDUSTRYTYPE_UNKNOWN or AIIndustryType::INDUSTRYTYPE_TOWN.
-	 * @param goal_industry The IndustryType of the industry you'll transport goods to, AIIndustryType::INDUSTRYTYPE_UNKNOWN or AIIndustryType::INDUSTRYTYPE_TOWN.
+	 * @param source_industry The IndustryType of the industry you'll transport goods from, ScriptIndustryType::INDUSTRYTYPE_UNKNOWN or ScriptIndustryType::INDUSTRYTYPE_TOWN.
+	 * @param goal_industry The IndustryType of the industry you'll transport goods to, ScriptIndustryType::INDUSTRYTYPE_UNKNOWN or ScriptIndustryType::INDUSTRYTYPE_TOWN.
 	 * @param distance The manhattan distance you'll transport the cargo over.
 	 * @param source_station True if this is the source station, false otherwise.
 	 * @pre IsRailTypeAvailable(GetCurrentRailType()).
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre direction == RAILTRACK_NW_SE || direction == RAILTRACK_NE_SW.
 	 * @pre num_platforms > 0 && num_platforms <= 255.
 	 * @pre platform_length > 0 && platform_length <= 255.
-	 * @pre station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id).
-	 * @pre AICargo::IsValidCargo(cargo_type)
-	 * @pre source_industry == AIIndustryType::INDUSTRYTYPE_UNKNOWN || source_industry == AIIndustryType::INDUSTRYTYPE_TOWN || AIIndustryType::IsValidIndustryType(source_industry).
-	 * @pre goal_industry == AIIndustryType::INDUSTRYTYPE_UNKNOWN || goal_industry == AIIndustryType::INDUSTRYTYPE_TOWN || AIIndustryType::IsValidIndustryType(goal_industry).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_FLAT_LAND_REQUIRED
-	 * @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
-	 * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
-	 * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
+	 * @pre station_id == ScriptStation::STATION_NEW || station_id == ScriptStation::STATION_JOIN_ADJACENT || ScriptStation::IsValidStation(station_id).
+	 * @pre ScriptCargo::IsValidCargo(cargo_type)
+	 * @pre source_industry == ScriptIndustryType::INDUSTRYTYPE_UNKNOWN || source_industry == ScriptIndustryType::INDUSTRYTYPE_TOWN || ScriptIndustryType::IsValidIndustryType(source_industry).
+	 * @pre goal_industry == ScriptIndustryType::INDUSTRYTYPE_UNKNOWN || goal_industry == ScriptIndustryType::INDUSTRYTYPE_TOWN || ScriptIndustryType::IsValidIndustryType(goal_industry).
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_FLAT_LAND_REQUIRED
+	 * @exception ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
+	 * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS
+	 * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
 	 * @return Whether the station has been/can be build or not.
 	 */
 	static bool BuildNewGRFRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id, CargoID cargo_id, IndustryType source_industry, IndustryType goal_industry, int distance, bool source_station);
@@ -292,11 +292,11 @@
 	/**
 	 * Build a rail waypoint.
 	 * @param tile Place to build the waypoint.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre IsRailTile(tile).
 	 * @pre GetRailTracks(tile) == RAILTRACK_NE_SW || GetRailTracks(tile) == RAILTRACK_NW_SE.
 	 * @pre IsRailTypeAvailable(GetCurrentRailType()).
-	 * @exception AIError::ERR_FLAT_LAND_REQUIRED
+	 * @exception ScriptError::ERR_FLAT_LAND_REQUIRED
 	 * @return Whether the rail waypoint has been/can be build or not.
 	 */
 	static bool BuildRailWaypoint(TileIndex tile);
@@ -336,13 +336,13 @@
 	 * Build rail on the given tile.
 	 * @param tile The tile to build on.
 	 * @param rail_track The RailTrack to build.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre IsRailTypeAvailable(GetCurrentRailType()).
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_LAND_SLOPED_WRONG
-	 * @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
-	 * @exception AIRail::ERR_CROSSING_ON_ONEWAY_ROAD
-	 * @exception AIError::ERR_ALREADY_BUILT
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_LAND_SLOPED_WRONG
+	 * @exception ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS
+	 * @exception ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD
+	 * @exception ScriptError::ERR_ALREADY_BUILT
 	 * @return Whether the rail has been/can be build or not.
 	 * @note You can only build a single track with this function so do not
 	 *   use the values from RailTrack as bitmask.
@@ -353,7 +353,7 @@
 	 * Remove rail on the given tile.
 	 * @param tile The tile to remove rail from.
 	 * @param rail_track The RailTrack to remove.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre (GetRailTracks(tile) & rail_track) != 0.
 	 * @return Whether the rail has been/can be removed or not.
 	 * @note You can only remove a single track with this function so do not
@@ -367,8 +367,8 @@
 	 * @param tile The tile that is checked.
 	 * @param to The second tile to connect.
 	 * @pre from != to.
-	 * @pre AIMap::DistanceManhattan(from, tile) == 1.
-	 * @pre AIMap::DistanceManhattan(to, tile) == 1.
+	 * @pre ScriptMap::DistanceManhattan(from, tile) == 1.
+	 * @pre ScriptMap::DistanceManhattan(to, tile) == 1.
 	 * @return True if 'tile' connects 'from' and 'to'.
 	 */
 	static bool AreTilesConnected(TileIndex from, TileIndex tile, TileIndex to);
@@ -379,18 +379,18 @@
 	 * @param tile The first tile to build on.
 	 * @param to The tile just after the last tile to build on.
 	 * @pre from != to.
-	 * @pre AIMap::DistanceManhattan(from, tile) == 1.
-	 * @pre AIMap::DistanceManhattan(to, tile) >= 1.
-	 * @pre (abs(abs(AIMap::GetTileX(to) - AIMap::GetTileX(tile)) -
-	 *          abs(AIMap::GetTileY(to) - AIMap::GetTileY(tile))) <= 1) ||
-	 *      (AIMap::GetTileX(from) == AIMap::GetTileX(tile) && AIMap::GetTileX(tile) == AIMap::GetTileX(to)) ||
-	 *      (AIMap::GetTileY(from) == AIMap::GetTileY(tile) && AIMap::GetTileY(tile) == AIMap::GetTileY(to)).
+	 * @pre ScriptMap::DistanceManhattan(from, tile) == 1.
+	 * @pre ScriptMap::DistanceManhattan(to, tile) >= 1.
+	 * @pre (abs(abs(ScriptMap::GetTileX(to) - ScriptMap::GetTileX(tile)) -
+	 *          abs(ScriptMap::GetTileY(to) - ScriptMap::GetTileY(tile))) <= 1) ||
+	 *      (ScriptMap::GetTileX(from) == ScriptMap::GetTileX(tile) && ScriptMap::GetTileX(tile) == ScriptMap::GetTileX(to)) ||
+	 *      (ScriptMap::GetTileY(from) == ScriptMap::GetTileY(tile) && ScriptMap::GetTileY(tile) == ScriptMap::GetTileY(to)).
 	 * @pre IsRailTypeAvailable(GetCurrentRailType()).
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_LAND_SLOPED_WRONG
-	 * @exception AIRail::ERR_CROSSING_ON_ONEWAY_ROAD
-	 * @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
-	 * @exception AIError::ERR_ALREADY_BUILT
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_LAND_SLOPED_WRONG
+	 * @exception ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD
+	 * @exception ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS
+	 * @exception ScriptError::ERR_ALREADY_BUILT
 	 * @note Construction will fail if an obstacle is found between the start and end tiles.
 	 * @return Whether the rail has been/can be build or not.
 	 */
@@ -402,19 +402,19 @@
 	 * @param tile The first tile to remove rail from.
 	 * @param to The tile just after the last tile to remove rail from.
 	 * @pre from != to.
-	 * @pre AIMap::DistanceManhattan(from, tile) == 1.
-	 * @pre AIMap::DistanceManhattan(to, tile) >= 1.
-	 * @pre (abs(abs(AIMap::GetTileX(to) - AIMap::GetTileX(tile)) -
-	 *          abs(AIMap::GetTileY(to) - AIMap::GetTileY(tile))) <= 1) ||
-	 *      (AIMap::GetTileX(from) == AIMap::GetTileX(tile) && AIMap::GetTileX(tile) == AIMap::GetTileX(to)) ||
-	 *      (AIMap::GetTileY(from) == AIMap::GetTileY(tile) && AIMap::GetTileY(tile) == AIMap::GetTileY(to)).
+	 * @pre ScriptMap::DistanceManhattan(from, tile) == 1.
+	 * @pre ScriptMap::DistanceManhattan(to, tile) >= 1.
+	 * @pre (abs(abs(ScriptMap::GetTileX(to) - ScriptMap::GetTileX(tile)) -
+	 *          abs(ScriptMap::GetTileY(to) - ScriptMap::GetTileY(tile))) <= 1) ||
+	 *      (ScriptMap::GetTileX(from) == ScriptMap::GetTileX(tile) && ScriptMap::GetTileX(tile) == ScriptMap::GetTileX(to)) ||
+	 *      (ScriptMap::GetTileY(from) == ScriptMap::GetTileY(tile) && ScriptMap::GetTileY(tile) == ScriptMap::GetTileY(to)).
 	 * @return Whether the rail has been/can be removed or not.
 	 */
 	static bool RemoveRail(TileIndex from, TileIndex tile, TileIndex to);
 
 	/**
 	 * Get the SignalType of the signal on a tile or SIGNALTYPE_NONE if there is no signal.
-	 * @pre AIMap::DistanceManhattan(tile, front) == 1.
+	 * @pre ScriptMap::DistanceManhattan(tile, front) == 1.
 	 * @param tile The tile that might have a signal.
 	 * @param front The tile in front of 'tile'.
 	 * @return The SignalType of the signal on 'tile' facing to 'front'.
@@ -426,9 +426,9 @@
 	 * @param tile The tile to build on.
 	 * @param front The tile in front of the signal.
 	 * @param signal The SignalType to build.
-	 * @pre AIMap::DistanceManhattan(tile, front) == 1.
+	 * @pre ScriptMap::DistanceManhattan(tile, front) == 1.
 	 * @pre IsRailTile(tile) && !IsRailStationTile(tile) && !IsRailWaypointTile(tile).
-	 * @exception AIRail::ERR_UNSUITABLE_TRACK
+	 * @exception ScriptRail::ERR_UNSUITABLE_TRACK
 	 * @return Whether the signal has been/can be build or not.
 	 */
 	static bool BuildSignal(TileIndex tile, TileIndex front, SignalType signal);
@@ -437,7 +437,7 @@
 	 * Remove a signal.
 	 * @param tile The tile to remove the signal from.
 	 * @param front The tile in front of the signal.
-	 * @pre AIMap::DistanceManhattan(tile, front) == 1.
+	 * @pre ScriptMap::DistanceManhattan(tile, front) == 1.
 	 * @pre GetSignalType(tile, front) != SIGNALTYPE_NONE.
 	 * @return Whether the signal has been/can be removed or not.
 	 */
--- a/src/script/api/script_railtypelist.cpp
+++ b/src/script/api/script_railtypelist.cpp
@@ -7,14 +7,14 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_railtypelist.cpp Implementation of AIRailTypeList and friends. */
+/** @file script_railtypelist.cpp Implementation of ScriptRailTypeList and friends. */
 
 #include "../../stdafx.h"
 #include "script_railtypelist.hpp"
 #include "../../rail.h"
 #include "../../company_func.h"
 
-AIRailTypeList::AIRailTypeList()
+ScriptRailTypeList::ScriptRailTypeList()
 {
 	for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
 		if (::HasRailtypeAvail(_current_company, rt)) this->AddItem(rt);
--- a/src/script/api/script_railtypelist.hpp
+++ b/src/script/api/script_railtypelist.hpp
@@ -16,11 +16,11 @@
 
 /**
  * Creates a list of all available railtypes.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIRailTypeList : public AIList {
+class ScriptRailTypeList : public ScriptList {
 public:
-	AIRailTypeList();
+	ScriptRailTypeList();
 };
 
 #endif /* SCRIPT_RAILTYPELIST_HPP */
--- a/src/script/api/script_road.cpp
+++ b/src/script/api/script_road.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_road.cpp Implementation of AIRoad. */
+/** @file script_road.cpp Implementation of ScriptRoad. */
 
 #include "../../stdafx.h"
 #include "script_map.hpp"
@@ -17,12 +17,12 @@
 #include "../../company_func.h"
 #include "../../script/squirrel_helper_type.hpp"
 
-/* static */ AIRoad::RoadVehicleType AIRoad::GetRoadVehicleTypeForCargo(CargoID cargo_type)
+/* static */ ScriptRoad::RoadVehicleType ScriptRoad::GetRoadVehicleTypeForCargo(CargoID cargo_type)
 {
-	return AICargo::HasCargoClass(cargo_type, AICargo::CC_PASSENGERS) ? ROADVEHTYPE_BUS : ROADVEHTYPE_TRUCK;
+	return ScriptCargo::HasCargoClass(cargo_type, ScriptCargo::CC_PASSENGERS) ? ROADVEHTYPE_BUS : ROADVEHTYPE_TRUCK;
 }
 
-/* static */ bool AIRoad::IsRoadTile(TileIndex tile)
+/* static */ bool ScriptRoad::IsRoadTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
@@ -30,7 +30,7 @@
 			IsDriveThroughRoadStationTile(tile);
 }
 
-/* static */ bool AIRoad::IsRoadDepotTile(TileIndex tile)
+/* static */ bool ScriptRoad::IsRoadDepotTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
@@ -38,45 +38,45 @@
 			(::RoadTypeToRoadTypes((::RoadType)GetCurrentRoadType()) & ::GetRoadTypes(tile)) != 0;
 }
 
-/* static */ bool AIRoad::IsRoadStationTile(TileIndex tile)
+/* static */ bool ScriptRoad::IsRoadStationTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsRoadStopTile(tile) && (::RoadTypeToRoadTypes((::RoadType)GetCurrentRoadType()) & ::GetRoadTypes(tile)) != 0;
 }
 
-/* static */ bool AIRoad::IsDriveThroughRoadStationTile(TileIndex tile)
+/* static */ bool ScriptRoad::IsDriveThroughRoadStationTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsDriveThroughStopTile(tile) && (::RoadTypeToRoadTypes((::RoadType)GetCurrentRoadType()) & ::GetRoadTypes(tile)) != 0;
 }
 
-/* static */ bool AIRoad::IsRoadTypeAvailable(RoadType road_type)
+/* static */ bool ScriptRoad::IsRoadTypeAvailable(RoadType road_type)
 {
 	return ::HasRoadTypesAvail(_current_company, ::RoadTypeToRoadTypes((::RoadType)road_type));
 }
 
-/* static */ AIRoad::RoadType AIRoad::GetCurrentRoadType()
+/* static */ ScriptRoad::RoadType ScriptRoad::GetCurrentRoadType()
 {
-	return (RoadType)AIObject::GetRoadType();
+	return (RoadType)ScriptObject::GetRoadType();
 }
 
-/* static */ void AIRoad::SetCurrentRoadType(RoadType road_type)
+/* static */ void ScriptRoad::SetCurrentRoadType(RoadType road_type)
 {
 	if (!IsRoadTypeAvailable(road_type)) return;
 
-	AIObject::SetRoadType((::RoadType)road_type);
+	ScriptObject::SetRoadType((::RoadType)road_type);
 }
 
-/* static */ bool AIRoad::HasRoadType(TileIndex tile, RoadType road_type)
+/* static */ bool ScriptRoad::HasRoadType(TileIndex tile, RoadType road_type)
 {
-	if (!AIMap::IsValidTile(tile)) return false;
+	if (!ScriptMap::IsValidTile(tile)) return false;
 	if (!IsRoadTypeAvailable(road_type)) return false;
 	return ::GetAnyRoadBits(tile, (::RoadType)road_type, false) != ROAD_NONE;
 }
 
-/* static */ bool AIRoad::AreRoadTilesConnected(TileIndex t1, TileIndex t2)
+/* static */ bool ScriptRoad::AreRoadTilesConnected(TileIndex t1, TileIndex t2)
 {
 	if (!::IsValidTile(t1)) return false;
 	if (!::IsValidTile(t2)) return false;
@@ -85,8 +85,8 @@
 	/* Tiles not neighbouring */
 	if ((abs((int)::TileX(t1) - (int)::TileX(t2)) + abs((int)::TileY(t1) - (int)::TileY(t2))) != 1) return false;
 
-	RoadBits r1 = ::GetAnyRoadBits(t1, AIObject::GetRoadType());
-	RoadBits r2 = ::GetAnyRoadBits(t2, AIObject::GetRoadType());
+	RoadBits r1 = ::GetAnyRoadBits(t1, ScriptObject::GetRoadType());
+	RoadBits r2 = ::GetAnyRoadBits(t2, ScriptObject::GetRoadType());
 
 	uint dir_1 = (::TileX(t1) == ::TileX(t2)) ? (::TileY(t1) < ::TileY(t2) ? 2 : 0) : (::TileX(t1) < ::TileX(t2) ? 1 : 3);
 	uint dir_2 = 2 ^ dir_1;
@@ -96,7 +96,7 @@
 	return HasBit(r1, dir_1) && HasBit(r2, dir_2) && drd2 != DRD_BOTH && drd2 != (dir_1 > dir_2 ? DRD_SOUTHBOUND : DRD_NORTHBOUND);
 }
 
-/* Helper functions for AIRoad::CanBuildConnectedRoadParts(). */
+/* Helper functions for ScriptRoad::CanBuildConnectedRoadParts(). */
 
 /**
  * Check whether the given existing bits the start and end part can be build.
@@ -341,7 +341,7 @@
 		return false;
 }
 
-/* static */ int32 AIRoad::CanBuildConnectedRoadParts(AITile::Slope slope_, Array *existing, TileIndex start_, TileIndex end_)
+/* static */ int32 ScriptRoad::CanBuildConnectedRoadParts(ScriptTile::Slope slope_, Array *existing, TileIndex start_, TileIndex end_)
 {
 	::Slope slope = (::Slope)slope_;
 	int32 start = start_;
@@ -362,7 +362,7 @@
 	return _settings_game.construction.build_on_slopes ? LookupWithBuildOnSlopes(slope, existing, start, end) : LookupWithoutBuildOnSlopes(slope, existing, start, end);
 }
 
-/* static */ int32 AIRoad::CanBuildConnectedRoadPartsHere(TileIndex tile, TileIndex start, TileIndex end)
+/* static */ int32 ScriptRoad::CanBuildConnectedRoadPartsHere(TileIndex tile, TileIndex start, TileIndex end)
 {
 	if (!::IsValidTile(tile) || !::IsValidTile(start) || !::IsValidTile(end)) return -1;
 	if (::DistanceManhattan(tile, start) != 1 || ::DistanceManhattan(tile, end) != 1) return -1;
@@ -382,7 +382,7 @@
 		if (HasBit(rb, i)) existing->array[existing->size++] = neighbours[i];
 	}
 
-	return AIRoad::CanBuildConnectedRoadParts(AITile::GetSlope(tile), existing, start - tile, end - tile);
+	return ScriptRoad::CanBuildConnectedRoadParts(ScriptTile::GetSlope(tile), existing, start - tile, end - tile);
 }
 
 /**
@@ -413,7 +413,7 @@
 	}
 }
 
-/* static */ int32 AIRoad::GetNeighbourRoadCount(TileIndex tile)
+/* static */ int32 ScriptRoad::GetNeighbourRoadCount(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 	if (!IsRoadTypeAvailable(GetCurrentRoadType())) return false;
@@ -429,60 +429,60 @@
 	return neighbour;
 }
 
-/* static */ TileIndex AIRoad::GetRoadDepotFrontTile(TileIndex depot)
+/* static */ TileIndex ScriptRoad::GetRoadDepotFrontTile(TileIndex depot)
 {
 	if (!IsRoadDepotTile(depot)) return INVALID_TILE;
 
 	return depot + ::TileOffsByDiagDir(::GetRoadDepotDirection(depot));
 }
 
-/* static */ TileIndex AIRoad::GetRoadStationFrontTile(TileIndex station)
+/* static */ TileIndex ScriptRoad::GetRoadStationFrontTile(TileIndex station)
 {
 	if (!IsRoadStationTile(station)) return INVALID_TILE;
 
 	return station + ::TileOffsByDiagDir(::GetRoadStopDir(station));
 }
 
-/* static */ TileIndex AIRoad::GetDriveThroughBackTile(TileIndex station)
+/* static */ TileIndex ScriptRoad::GetDriveThroughBackTile(TileIndex station)
 {
 	if (!IsDriveThroughRoadStationTile(station)) return INVALID_TILE;
 
 	return station + ::TileOffsByDiagDir(::ReverseDiagDir(::GetRoadStopDir(station)));
 }
 
-/* static */ bool AIRoad::_BuildRoadInternal(TileIndex start, TileIndex end, bool one_way, bool full)
+/* static */ bool ScriptRoad::_BuildRoadInternal(TileIndex start, TileIndex end, bool one_way, bool full)
 {
 	EnforcePrecondition(false, start != end);
 	EnforcePrecondition(false, ::IsValidTile(start));
 	EnforcePrecondition(false, ::IsValidTile(end));
 	EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
-	EnforcePrecondition(false, !one_way || AIObject::GetRoadType() == ::ROADTYPE_ROAD);
+	EnforcePrecondition(false, !one_way || ScriptObject::GetRoadType() == ::ROADTYPE_ROAD);
 	EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
 
-	return AIObject::DoCommand(start, end, (::TileY(start) != ::TileY(end) ? 4 : 0) | (((start < end) == !full) ? 1 : 2) | (AIObject::GetRoadType() << 3) | ((one_way ? 1 : 0) << 5) | 1 << 6, CMD_BUILD_LONG_ROAD);
+	return ScriptObject::DoCommand(start, end, (::TileY(start) != ::TileY(end) ? 4 : 0) | (((start < end) == !full) ? 1 : 2) | (ScriptObject::GetRoadType() << 3) | ((one_way ? 1 : 0) << 5) | 1 << 6, CMD_BUILD_LONG_ROAD);
 }
 
-/* static */ bool AIRoad::BuildRoad(TileIndex start, TileIndex end)
+/* static */ bool ScriptRoad::BuildRoad(TileIndex start, TileIndex end)
 {
 	return _BuildRoadInternal(start, end, false, false);
 }
 
-/* static */ bool AIRoad::BuildOneWayRoad(TileIndex start, TileIndex end)
+/* static */ bool ScriptRoad::BuildOneWayRoad(TileIndex start, TileIndex end)
 {
 	return _BuildRoadInternal(start, end, true, false);
 }
 
-/* static */ bool AIRoad::BuildRoadFull(TileIndex start, TileIndex end)
+/* static */ bool ScriptRoad::BuildRoadFull(TileIndex start, TileIndex end)
 {
 	return _BuildRoadInternal(start, end, false, true);
 }
 
-/* static */ bool AIRoad::BuildOneWayRoadFull(TileIndex start, TileIndex end)
+/* static */ bool ScriptRoad::BuildOneWayRoadFull(TileIndex start, TileIndex end)
 {
 	return _BuildRoadInternal(start, end, true, true);
 }
 
-/* static */ bool AIRoad::BuildRoadDepot(TileIndex tile, TileIndex front)
+/* static */ bool ScriptRoad::BuildRoadDepot(TileIndex tile, TileIndex front)
 {
 	EnforcePrecondition(false, tile != front);
 	EnforcePrecondition(false, ::IsValidTile(tile));
@@ -492,16 +492,16 @@
 
 	uint entrance_dir = (::TileX(tile) == ::TileX(front)) ? (::TileY(tile) < ::TileY(front) ? 1 : 3) : (::TileX(tile) < ::TileX(front) ? 2 : 0);
 
-	return AIObject::DoCommand(tile, entrance_dir | (AIObject::GetRoadType() << 2), 0, CMD_BUILD_ROAD_DEPOT);
+	return ScriptObject::DoCommand(tile, entrance_dir | (ScriptObject::GetRoadType() << 2), 0, CMD_BUILD_ROAD_DEPOT);
 }
 
-/* static */ bool AIRoad::_BuildRoadStationInternal(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, bool drive_through, StationID station_id)
+/* static */ bool ScriptRoad::_BuildRoadStationInternal(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, bool drive_through, StationID station_id)
 {
 	EnforcePrecondition(false, tile != front);
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, ::IsValidTile(front));
 	EnforcePrecondition(false, ::TileX(tile) == ::TileX(front) || ::TileY(tile) == ::TileY(front));
-	EnforcePrecondition(false, station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id));
+	EnforcePrecondition(false, station_id == ScriptStation::STATION_NEW || station_id == ScriptStation::STATION_JOIN_ADJACENT || ScriptStation::IsValidStation(station_id));
 	EnforcePrecondition(false, road_veh_type == ROADVEHTYPE_BUS || road_veh_type == ROADVEHTYPE_TRUCK);
 	EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
 
@@ -512,66 +512,66 @@
 		entrance_dir = (::TileX(tile) == ::TileX(front)) ? (::TileY(tile) < ::TileY(front) ? 1 : 3) : (::TileX(tile) < ::TileX(front) ? 2 : 0);
 	}
 
-	uint p2 = station_id == AIStation::STATION_JOIN_ADJACENT ? 0 : 32;
+	uint p2 = station_id == ScriptStation::STATION_JOIN_ADJACENT ? 0 : 32;
 	p2 |= drive_through ? 2 : 0;
 	p2 |= road_veh_type == ROADVEHTYPE_TRUCK ? 1 : 0;
-	p2 |= ::RoadTypeToRoadTypes(AIObject::GetRoadType()) << 2;
+	p2 |= ::RoadTypeToRoadTypes(ScriptObject::GetRoadType()) << 2;
 	p2 |= entrance_dir << 6;
-	p2 |= (AIStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16;
-	return AIObject::DoCommand(tile, 1 | 1 << 8, p2, CMD_BUILD_ROAD_STOP);
+	p2 |= (ScriptStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16;
+	return ScriptObject::DoCommand(tile, 1 | 1 << 8, p2, CMD_BUILD_ROAD_STOP);
 }
 
-/* static */ bool AIRoad::BuildRoadStation(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id)
+/* static */ bool ScriptRoad::BuildRoadStation(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id)
 {
 	return _BuildRoadStationInternal(tile, front, road_veh_type, false, station_id);
 }
 
-/* static */ bool AIRoad::BuildDriveThroughRoadStation(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id)
+/* static */ bool ScriptRoad::BuildDriveThroughRoadStation(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id)
 {
 	return _BuildRoadStationInternal(tile, front, road_veh_type, true, station_id);
 }
 
-/* static */ bool AIRoad::RemoveRoad(TileIndex start, TileIndex end)
+/* static */ bool ScriptRoad::RemoveRoad(TileIndex start, TileIndex end)
 {
 	EnforcePrecondition(false, ::IsValidTile(start));
 	EnforcePrecondition(false, ::IsValidTile(end));
 	EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
 	EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
 
-	return AIObject::DoCommand(start, end, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 1 : 2) | (AIObject::GetRoadType() << 3), CMD_REMOVE_LONG_ROAD);
+	return ScriptObject::DoCommand(start, end, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 1 : 2) | (ScriptObject::GetRoadType() << 3), CMD_REMOVE_LONG_ROAD);
 }
 
-/* static */ bool AIRoad::RemoveRoadFull(TileIndex start, TileIndex end)
+/* static */ bool ScriptRoad::RemoveRoadFull(TileIndex start, TileIndex end)
 {
 	EnforcePrecondition(false, ::IsValidTile(start));
 	EnforcePrecondition(false, ::IsValidTile(end));
 	EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
 	EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
 
-	return AIObject::DoCommand(start, end, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 2 : 1) | (AIObject::GetRoadType() << 3), CMD_REMOVE_LONG_ROAD);
+	return ScriptObject::DoCommand(start, end, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 2 : 1) | (ScriptObject::GetRoadType() << 3), CMD_REMOVE_LONG_ROAD);
 }
 
-/* static */ bool AIRoad::RemoveRoadDepot(TileIndex tile)
+/* static */ bool ScriptRoad::RemoveRoadDepot(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, IsTileType(tile, MP_ROAD))
 	EnforcePrecondition(false, GetRoadTileType(tile) == ROAD_TILE_DEPOT);
 
-	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
+	return ScriptObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
 }
 
-/* static */ bool AIRoad::RemoveRoadStation(TileIndex tile)
+/* static */ bool ScriptRoad::RemoveRoadStation(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, IsTileType(tile, MP_STATION));
 	EnforcePrecondition(false, IsRoadStop(tile));
 
-	return AIObject::DoCommand(tile, 1 | 1 << 8, GetRoadStopType(tile), CMD_REMOVE_ROAD_STOP);
+	return ScriptObject::DoCommand(tile, 1 | 1 << 8, GetRoadStopType(tile), CMD_REMOVE_ROAD_STOP);
 }
 
-/* static */ Money AIRoad::GetBuildCost(RoadType roadtype, BuildType build_type)
+/* static */ Money ScriptRoad::GetBuildCost(RoadType roadtype, BuildType build_type)
 {
-	if (!AIRoad::IsRoadTypeAvailable(roadtype)) return -1;
+	if (!ScriptRoad::IsRoadTypeAvailable(roadtype)) return -1;
 
 	switch (build_type) {
 		case BT_ROAD:       return ::GetPrice(PR_BUILD_ROAD, 1, NULL);
--- a/src/script/api/script_road.hpp
+++ b/src/script/api/script_road.hpp
@@ -17,14 +17,14 @@
 /**
  * Class that handles all road related functions.
  */
-class AIRoad : public AIObject {
+class ScriptRoad : public ScriptObject {
 public:
 	/**
 	 * All road related error messages.
 	 */
 	enum ErrorMessages {
 		/** Base for road building / maintaining errors */
-		ERR_ROAD_BASE = AIError::ERR_CAT_ROAD << AIError::ERR_CAT_BIT_SIZE,
+		ERR_ROAD_BASE = ScriptError::ERR_CAT_ROAD << ScriptError::ERR_CAT_BIT_SIZE,
 
 		/** Road works are in progress */
 		ERR_ROAD_WORKS_IN_PROGRESS,                   // [STR_ERROR_ROAD_WORKS_IN_PROGRESS]
@@ -72,7 +72,7 @@
 	/**
 	 * Determines whether a busstop or a truckstop is needed to transport a certain cargo.
 	 * @param cargo_type The cargo to test.
-	 * @pre AICargo::IsValidCargo(cargo_type).
+	 * @pre ScriptCargo::IsValidCargo(cargo_type).
 	 * @return The road vehicle type needed to transport the cargo.
 	 */
 	static RoadVehicleType GetRoadVehicleTypeForCargo(CargoID cargo_type);
@@ -82,7 +82,7 @@
 	 *  used to traverse a tile. This excludes road depots and 'normal' road
 	 *  stations, but includes drive through stations.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has road.
 	 */
 	static bool IsRoadTile(TileIndex tile);
@@ -90,7 +90,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a road depot.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has a road depot.
 	 */
 	static bool IsRoadDepotTile(TileIndex tile);
@@ -98,7 +98,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a road station.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has a road station.
 	 */
 	static bool IsRoadStationTile(TileIndex tile);
@@ -107,7 +107,7 @@
 	 * Checks whether the given tile is actually a tile with a drive through
 	 *  road station.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile has a drive through road station.
 	 */
 	static bool IsDriveThroughRoadStationTile(TileIndex tile);
@@ -120,13 +120,13 @@
 	static bool IsRoadTypeAvailable(RoadType road_type);
 
 	/**
-	 * Get the current RoadType set for all AIRoad functions.
+	 * Get the current RoadType set for all ScriptRoad functions.
 	 * @return The RoadType currently set.
 	 */
 	static RoadType GetCurrentRoadType();
 
 	/**
-	 * Set the RoadType for all further AIRoad functions.
+	 * Set the RoadType for all further ScriptRoad functions.
 	 * @param road_type The RoadType to set.
 	 */
 	static void SetCurrentRoadType(RoadType road_type);
@@ -135,7 +135,7 @@
 	 * Check if a given tile has RoadType.
 	 * @param tile The tile to check.
 	 * @param road_type The RoadType to check for.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre IsRoadTypeAvailable(road_type).
 	 * @return True if the tile contains a RoadType object.
 	 */
@@ -148,8 +148,8 @@
 	 * @param tile_from The source tile.
 	 * @param tile_to The destination tile.
 	 * @pre IsRoadTypeAvailable(GetCurrentRoadType()).
-	 * @pre AIMap::IsValidTile(tile_from).
-	 * @pre AIMap::IsValidTile(tile_to).
+	 * @pre ScriptMap::IsValidTile(tile_from).
+	 * @pre ScriptMap::IsValidTile(tile_to).
 	 * @pre 'tile_from' and 'tile_to' are directly neighbouring tiles.
 	 * @return True if and only if a road vehicle can go from tile_from to tile_to.
 	 */
@@ -162,19 +162,19 @@
 	 *  it needs the slope and existing road parts of the tile as information.
 	 * @param slope The slope of the tile to examine.
 	 * @param existing An array with the existing neighbours in the same format
-	 *                 as "start" and "end", e.g. AIMap.GetTileIndex(0, 1).
+	 *                 as "start" and "end", e.g. ScriptMap.GetTileIndex(0, 1).
 	 *                 As a result of this all values of the existing array
 	 *                 must be of type integer.
 	 * @param start The tile from where the 'tile to be considered' will be
 	 *              entered. This is a relative tile, so valid parameters are:
-	 *              AIMap.GetTileIndex(0, 1), AIMap.GetTileIndex(0, -1),
-	 *              AIMap.GetTileIndex(1, 0) and AIMap.GetTileIndex(-1, 0).
+	 *              ScriptMap.GetTileIndex(0, 1), ScriptMap.GetTileIndex(0, -1),
+	 *              ScriptMap.GetTileIndex(1, 0) and ScriptMap.GetTileIndex(-1, 0).
 	 * @param end The tile from where the 'tile to be considered' will be
 	 *            exited. This is a relative tile, sovalid parameters are:
-	 *              AIMap.GetTileIndex(0, 1), AIMap.GetTileIndex(0, -1),
-	 *              AIMap.GetTileIndex(1, 0) and AIMap.GetTileIndex(-1, 0).
+	 *              ScriptMap.GetTileIndex(0, 1), ScriptMap.GetTileIndex(0, -1),
+	 *              ScriptMap.GetTileIndex(1, 0) and ScriptMap.GetTileIndex(-1, 0).
 	 * @pre start != end.
-	 * @pre slope must be a valid slope, i.e. one specified in AITile::Slope.
+	 * @pre slope must be a valid slope, i.e. one specified in ScriptTile::Slope.
 	 * @note Passing data that would be invalid in-game, e.g. existing containing
 	 *       road parts that can not be build on a tile with the given slope,
 	 *       does not necessarily means that -1 is returned, i.e. not all
@@ -184,7 +184,7 @@
 	 *         they are build or 2 when building the first part automatically
 	 *         builds the second part. -1 means the preconditions are not met.
 	 */
-	static int32 CanBuildConnectedRoadParts(AITile::Slope slope, struct Array *existing, TileIndex start, TileIndex end);
+	static int32 CanBuildConnectedRoadParts(ScriptTile::Slope slope, struct Array *existing, TileIndex start, TileIndex end);
 
 	/**
 	 * Lookup function for building road parts independend on whether the
@@ -196,11 +196,11 @@
 	 * @pre start != end.
 	 * @pre tile != start.
 	 * @pre tile != end.
-	 * @pre AIMap.IsValidTile(tile).
-	 * @pre AIMap.IsValidTile(start).
-	 * @pre AIMap.IsValidTile(end).
-	 * @pre AIMap.GetDistanceManhattanToTile(tile, start) == 1.
-	 * @pre AIMap.GetDistanceManhattanToTile(tile, end) == 1.
+	 * @pre ScriptMap.IsValidTile(tile).
+	 * @pre ScriptMap.IsValidTile(start).
+	 * @pre ScriptMap.IsValidTile(end).
+	 * @pre ScriptMap.GetDistanceManhattanToTile(tile, start) == 1.
+	 * @pre ScriptMap.GetDistanceManhattanToTile(tile, end) == 1.
 	 * @return 0 when the build parts do not connect, 1 when they do connect once
 	 *         they are build or 2 when building the first part automatically
 	 *         builds the second part. -1 means the preconditions are not met.
@@ -210,7 +210,7 @@
 	/**
 	 * Count how many neighbours are road.
 	 * @param tile The tile to check on.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre IsRoadTypeAvailable(GetCurrentRoadType()).
 	 * @return 0 means no neighbour road; max value is 4.
 	 */
@@ -247,18 +247,18 @@
 	 * @param start The start tile of the road.
 	 * @param end The end tile of the road.
 	 * @pre 'start' is not equal to 'end'.
-	 * @pre AIMap::IsValidTile(start).
-	 * @pre AIMap::IsValidTile(end).
+	 * @pre ScriptMap::IsValidTile(start).
+	 * @pre ScriptMap::IsValidTile(end).
 	 * @pre 'start' and 'end' are in a straight line, i.e.
-	 *  AIMap::GetTileX(start) == AIMap::GetTileX(end) or
-	 *  AIMap::GetTileY(start) == AIMap::GetTileY(end).
+	 *  ScriptMap::GetTileX(start) == ScriptMap::GetTileX(end) or
+	 *  ScriptMap::GetTileY(start) == ScriptMap::GetTileY(end).
 	 * @pre IsRoadTypeAvailable(GetCurrentRoadType()).
-	 * @exception AIError::ERR_ALREADY_BUILT
-	 * @exception AIError::ERR_LAND_SLOPED_WRONG
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
-	 * @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
-	 * @exception AIError::ERR_VEHICLE_IN_THE_WAY
+	 * @exception ScriptError::ERR_ALREADY_BUILT
+	 * @exception ScriptError::ERR_LAND_SLOPED_WRONG
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
+	 * @exception ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS
+	 * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY
 	 * @note Construction will fail if an obstacle is found between the start and end tiles.
 	 * @return Whether the road has been/can be build or not.
 	 */
@@ -274,18 +274,18 @@
 	 * @param start The start tile of the road.
 	 * @param end The end tile of the road.
 	 * @pre 'start' is not equal to 'end'.
-	 * @pre AIMap::IsValidTile(start).
-	 * @pre AIMap::IsValidTile(end).
+	 * @pre ScriptMap::IsValidTile(start).
+	 * @pre ScriptMap::IsValidTile(end).
 	 * @pre 'start' and 'end' are in a straight line, i.e.
-	 *  AIMap::GetTileX(start) == AIMap::GetTileX(end) or
-	 *  AIMap::GetTileY(start) == AIMap::GetTileY(end).
+	 *  ScriptMap::GetTileX(start) == ScriptMap::GetTileX(end) or
+	 *  ScriptMap::GetTileY(start) == ScriptMap::GetTileY(end).
 	 * @pre GetCurrentRoadType() == ROADTYPE_ROAD.
-	 * @exception AIError::ERR_ALREADY_BUILT
-	 * @exception AIError::ERR_LAND_SLOPED_WRONG
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
-	 * @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
-	 * @exception AIError::ERR_VEHICLE_IN_THE_WAY
+	 * @exception ScriptError::ERR_ALREADY_BUILT
+	 * @exception ScriptError::ERR_LAND_SLOPED_WRONG
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
+	 * @exception ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS
+	 * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY
 	 * @note Construction will fail if an obstacle is found between the start and end tiles.
 	 * @return Whether the road has been/can be build or not.
 	 */
@@ -297,18 +297,18 @@
 	 * @param start The start tile of the road.
 	 * @param end The end tile of the road.
 	 * @pre 'start' is not equal to 'end'.
-	 * @pre AIMap::IsValidTile(start).
-	 * @pre AIMap::IsValidTile(end).
+	 * @pre ScriptMap::IsValidTile(start).
+	 * @pre ScriptMap::IsValidTile(end).
 	 * @pre 'start' and 'end' are in a straight line, i.e.
-	 *  AIMap::GetTileX(start) == AIMap::GetTileX(end) or
-	 *  AIMap::GetTileY(start) == AIMap::GetTileY(end).
+	 *  ScriptMap::GetTileX(start) == ScriptMap::GetTileX(end) or
+	 *  ScriptMap::GetTileY(start) == ScriptMap::GetTileY(end).
 	 * @pre IsRoadTypeAvailable(GetCurrentRoadType()).
-	 * @exception AIError::ERR_ALREADY_BUILT
-	 * @exception AIError::ERR_LAND_SLOPED_WRONG
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
-	 * @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
-	 * @exception AIError::ERR_VEHICLE_IN_THE_WAY
+	 * @exception ScriptError::ERR_ALREADY_BUILT
+	 * @exception ScriptError::ERR_LAND_SLOPED_WRONG
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
+	 * @exception ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS
+	 * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY
 	 * @note Construction will fail if an obstacle is found between the start and end tiles.
 	 * @return Whether the road has been/can be build or not.
 	 */
@@ -325,18 +325,18 @@
 	 * @param start The start tile of the road.
 	 * @param end The end tile of the road.
 	 * @pre 'start' is not equal to 'end'.
-	 * @pre AIMap::IsValidTile(start).
-	 * @pre AIMap::IsValidTile(end).
+	 * @pre ScriptMap::IsValidTile(start).
+	 * @pre ScriptMap::IsValidTile(end).
 	 * @pre 'start' and 'end' are in a straight line, i.e.
-	 *  AIMap::GetTileX(start) == AIMap::GetTileX(end) or
-	 *  AIMap::GetTileY(start) == AIMap::GetTileY(end).
+	 *  ScriptMap::GetTileX(start) == ScriptMap::GetTileX(end) or
+	 *  ScriptMap::GetTileY(start) == ScriptMap::GetTileY(end).
 	 * @pre GetCurrentRoadType() == ROADTYPE_ROAD.
-	 * @exception AIError::ERR_ALREADY_BUILT
-	 * @exception AIError::ERR_LAND_SLOPED_WRONG
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
-	 * @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
-	 * @exception AIError::ERR_VEHICLE_IN_THE_WAY
+	 * @exception ScriptError::ERR_ALREADY_BUILT
+	 * @exception ScriptError::ERR_LAND_SLOPED_WRONG
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
+	 * @exception ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS
+	 * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY
 	 * @note Construction will fail if an obstacle is found between the start and end tiles.
 	 * @return Whether the road has been/can be build or not.
 	 */
@@ -346,12 +346,12 @@
 	 * Builds a road depot.
 	 * @param tile Place to build the depot.
 	 * @param front The tile exactly in front of the depot.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @pre AIMap::IsValidTile(front).
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(front).
 	 * @pre 'tile' is not equal to 'front', but in a straight line of it.
 	 * @pre IsRoadTypeAvailable(GetCurrentRoadType()).
-	 * @exception AIError::ERR_FLAT_LAND_REQUIRED
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_FLAT_LAND_REQUIRED
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
 	 * @return Whether the road depot has been/can be build or not.
 	 */
 	static bool BuildRoadDepot(TileIndex tile, TileIndex front);
@@ -361,21 +361,21 @@
 	 * @param tile Place to build the station.
 	 * @param front The tile exactly in front of the station.
 	 * @param road_veh_type Whether to build a truck or bus station.
-	 * @param station_id The station to join, AIStation::STATION_NEW or AIStation::STATION_JOIN_ADJACENT.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @pre AIMap::IsValidTile(front).
+	 * @param station_id The station to join, ScriptStation::STATION_NEW or ScriptStation::STATION_JOIN_ADJACENT.
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(front).
 	 * @pre 'tile' is not equal to 'front', but in a straight line of it.
-	 * @pre station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id).
+	 * @pre station_id == ScriptStation::STATION_NEW || station_id == ScriptStation::STATION_JOIN_ADJACENT || ScriptStation::IsValidStation(station_id).
 	 * @pre GetCurrentRoadType() == ROADTYPE_ROAD.
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_FLAT_LAND_REQUIRED
-	 * @exception AIRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION
-	 * @exception AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD
-	 * @exception AIError::ERR_VEHICLE_IN_THE_WAY
-	 * @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
-	 * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
-	 * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_FLAT_LAND_REQUIRED
+	 * @exception ScriptRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION
+	 * @exception ScriptRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD
+	 * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY
+	 * @exception ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
+	 * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS
+	 * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
 	 * @return Whether the station has been/can be build or not.
 	 */
 	static bool BuildRoadStation(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id);
@@ -385,21 +385,21 @@
 	 * @param tile Place to build the station.
 	 * @param front A tile on the same axis with 'tile' as the station shall be oriented.
 	 * @param road_veh_type Whether to build a truck or bus station.
-	 * @param station_id The station to join, AIStation::STATION_NEW or AIStation::STATION_JOIN_ADJACENT.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @pre AIMap::IsValidTile(front).
+	 * @param station_id The station to join, ScriptStation::STATION_NEW or ScriptStation::STATION_JOIN_ADJACENT.
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(front).
 	 * @pre 'tile' is not equal to 'front', but in a straight line of it.
-	 * @pre station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id).
+	 * @pre station_id == ScriptStation::STATION_NEW || station_id == ScriptStation::STATION_JOIN_ADJACENT || ScriptStation::IsValidStation(station_id).
 	 * @pre IsRoadTypeAvailable(GetCurrentRoadType()).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_FLAT_LAND_REQUIRED
-	 * @exception AIRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION
-	 * @exception AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD
-	 * @exception AIError::ERR_VEHICLE_IN_THE_WAY
-	 * @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
-	 * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
-	 * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_FLAT_LAND_REQUIRED
+	 * @exception ScriptRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION
+	 * @exception ScriptRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD
+	 * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY
+	 * @exception ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
+	 * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS
+	 * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
 	 * @return Whether the station has been/can be build or not.
 	 */
 	static bool BuildDriveThroughRoadStation(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id);
@@ -408,15 +408,15 @@
 	 * Removes a road from the center of tile start to the center of tile end.
 	 * @param start The start tile of the road.
 	 * @param end The end tile of the road.
-	 * @pre AIMap::IsValidTile(start).
-	 * @pre AIMap::IsValidTile(end).
+	 * @pre ScriptMap::IsValidTile(start).
+	 * @pre ScriptMap::IsValidTile(end).
 	 * @pre 'start' and 'end' are in a straight line, i.e.
-	 *  AIMap::GetTileX(start) == AIMap::GetTileX(end) or
-	 *  AIMap::GetTileY(start) == AIMap::GetTileY(end).
+	 *  ScriptMap::GetTileX(start) == ScriptMap::GetTileX(end) or
+	 *  ScriptMap::GetTileY(start) == ScriptMap::GetTileY(end).
 	 * @pre IsRoadTypeAvailable(GetCurrentRoadType()).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIError::ERR_VEHICLE_IN_THE_WAY
-	 * @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY
+	 * @exception ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS
 	 * @return Whether the road has been/can be removed or not.
 	 */
 	static bool RemoveRoad(TileIndex start, TileIndex end);
@@ -426,15 +426,15 @@
 	 *  included).
 	 * @param start The start tile of the road.
 	 * @param end The end tile of the road.
-	 * @pre AIMap::IsValidTile(start).
-	 * @pre AIMap::IsValidTile(end).
+	 * @pre ScriptMap::IsValidTile(start).
+	 * @pre ScriptMap::IsValidTile(end).
 	 * @pre 'start' and 'end' are in a straight line, i.e.
-	 *  AIMap::GetTileX(start) == AIMap::GetTileX(end) or
-	 *  AIMap::GetTileY(start) == AIMap::GetTileY(end).
+	 *  ScriptMap::GetTileX(start) == ScriptMap::GetTileX(end) or
+	 *  ScriptMap::GetTileY(start) == ScriptMap::GetTileY(end).
 	 * @pre IsRoadTypeAvailable(GetCurrentRoadType()).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIError::ERR_VEHICLE_IN_THE_WAY
-	 * @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY
+	 * @exception ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS
 	 * @return Whether the road has been/can be removed or not.
 	 */
 	static bool RemoveRoadFull(TileIndex start, TileIndex end);
@@ -442,10 +442,10 @@
 	/**
 	 * Removes a road depot.
 	 * @param tile Place to remove the depot from.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre Tile is a road depot.
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIError::ERR_VEHICLE_IN_THE_WAY
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY
 	 * @return Whether the road depot has been/can be removed or not.
 	 */
 	static bool RemoveRoadDepot(TileIndex tile);
@@ -453,10 +453,10 @@
 	/**
 	 * Removes a road bus or truck station.
 	 * @param tile Place to remove the station from.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre Tile is a road station.
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
-	 * @exception AIError::ERR_VEHICLE_IN_THE_WAY
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY
 	 * @return Whether the station has been/can be removed or not.
 	 */
 	static bool RemoveRoadStation(TileIndex tile);
--- a/src/script/api/script_sign.cpp
+++ b/src/script/api/script_sign.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_sign.cpp Implementation of AISign. */
+/** @file script_sign.cpp Implementation of ScriptSign. */
 
 #include "../../stdafx.h"
 #include "script_sign.hpp"
@@ -21,22 +21,22 @@
 #include "../../tile_map.h"
 #include "../../company_func.h"
 
-/* static */ bool AISign::IsValidSign(SignID sign_id)
+/* static */ bool ScriptSign::IsValidSign(SignID sign_id)
 {
 	const Sign *si = ::Sign::GetIfValid(sign_id);
 	return si != NULL && si->owner == _current_company;
 }
 
-/* static */ bool AISign::SetName(SignID sign_id, const char *name)
+/* static */ bool ScriptSign::SetName(SignID sign_id, const char *name)
 {
 	EnforcePrecondition(false, IsValidSign(sign_id));
 	EnforcePrecondition(false, !::StrEmpty(name));
-	EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_SIGN_NAME_CHARS, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
+	EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_SIGN_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
 
-	return AIObject::DoCommand(0, sign_id, 0, CMD_RENAME_SIGN, name);
+	return ScriptObject::DoCommand(0, sign_id, 0, CMD_RENAME_SIGN, name);
 }
 
-/* static */ char *AISign::GetName(SignID sign_id)
+/* static */ char *ScriptSign::GetName(SignID sign_id)
 {
 	if (!IsValidSign(sign_id)) return NULL;
 
@@ -49,7 +49,7 @@
 	return sign_name;
 }
 
-/* static */ TileIndex AISign::GetLocation(SignID sign_id)
+/* static */ TileIndex ScriptSign::GetLocation(SignID sign_id)
 {
 	if (!IsValidSign(sign_id)) return INVALID_TILE;
 
@@ -57,19 +57,19 @@
 	return ::TileVirtXY(sign->x, sign->y);
 }
 
-/* static */ bool AISign::RemoveSign(SignID sign_id)
+/* static */ bool ScriptSign::RemoveSign(SignID sign_id)
 {
 	EnforcePrecondition(false, IsValidSign(sign_id));
-	return AIObject::DoCommand(0, sign_id, 0, CMD_RENAME_SIGN, "");
+	return ScriptObject::DoCommand(0, sign_id, 0, CMD_RENAME_SIGN, "");
 }
 
-/* static */ SignID AISign::BuildSign(TileIndex location, const char *text)
+/* static */ SignID ScriptSign::BuildSign(TileIndex location, const char *text)
 {
 	EnforcePrecondition(INVALID_SIGN, ::IsValidTile(location));
 	EnforcePrecondition(INVALID_SIGN, !::StrEmpty(text));
-	EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_SIGN_NAME_CHARS, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
+	EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_SIGN_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
 
-	if (!AIObject::DoCommand(location, 0, 0, CMD_PLACE_SIGN, text, &AIInstance::DoCommandReturnSignID)) return INVALID_SIGN;
+	if (!ScriptObject::DoCommand(location, 0, 0, CMD_PLACE_SIGN, text, &AIInstance::DoCommandReturnSignID)) return INVALID_SIGN;
 
 	/* In case of test-mode, we return SignID 0 */
 	return 0;
--- a/src/script/api/script_sign.hpp
+++ b/src/script/api/script_sign.hpp
@@ -17,7 +17,7 @@
 /**
  * Class that handles all sign related functions.
  */
-class AISign : public AIObject {
+class ScriptSign : public ScriptObject {
 public:
 	/**
 	 * All sign related error messages.
@@ -25,7 +25,7 @@
 	enum ErrorMessages {
 
 		/** Base for sign building related errors */
-		ERR_SIGN_BASE = AIError::ERR_CAT_SIGN << AIError::ERR_CAT_BIT_SIZE,
+		ERR_SIGN_BASE = ScriptError::ERR_CAT_SIGN << ScriptError::ERR_CAT_BIT_SIZE,
 
 		/** Too many signs have been placed */
 		ERR_SIGN_TOO_MANY_SIGNS,             // [STR_ERROR_TOO_MANY_SIGNS]
@@ -45,7 +45,7 @@
 	 * @pre IsValidSign(sign_id).
 	 * @pre 'name' must have at least one character.
 	 * @pre 'name' must have at most 30 characters.
-	 * @exception AIError::ERR_NAME_IS_NOT_UNIQUE
+	 * @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
 	 * @return True if and only if the name was changed.
 	 */
 	static bool SetName(SignID sign_id, const char *name);
@@ -70,10 +70,10 @@
 	 * Builds a sign on the map.
 	 * @param location The place to build the sign.
 	 * @param text The text to place on the sign.
-	 * @pre AIMap::IsValidTile(location).
+	 * @pre ScriptMap::IsValidTile(location).
 	 * @pre 'text' must have at least one character.
 	 * @pre 'text' must have at most 30 characters.
-	 * @exception AISign::ERR_SIGN_TOO_MANY_SIGNS
+	 * @exception ScriptSign::ERR_SIGN_TOO_MANY_SIGNS
 	 * @return The SignID of the build sign (use IsValidSign() to check for validity).
 	 *   In test-mode it returns 0 if successful, or any other value to indicate
 	 *   failure.
--- a/src/script/api/script_signlist.cpp
+++ b/src/script/api/script_signlist.cpp
@@ -7,17 +7,17 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_signlist.cpp Implementation of AISignList and friends. */
+/** @file script_signlist.cpp Implementation of ScriptSignList and friends. */
 
 #include "../../stdafx.h"
 #include "script_signlist.hpp"
 #include "script_sign.hpp"
 #include "../../signs_base.h"
 
-AISignList::AISignList()
+ScriptSignList::ScriptSignList()
 {
 	Sign *s;
 	FOR_ALL_SIGNS(s) {
-		if (AISign::IsValidSign(s->index)) this->AddItem(s->index);
+		if (ScriptSign::IsValidSign(s->index)) this->AddItem(s->index);
 	}
 }
--- a/src/script/api/script_signlist.hpp
+++ b/src/script/api/script_signlist.hpp
@@ -16,11 +16,11 @@
 
 /**
  * Create a list of signs your company has created.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AISignList : public AIList {
+class ScriptSignList : public ScriptList {
 public:
-	AISignList();
+	ScriptSignList();
 };
 
 #endif /* SCRIPT_SIGNLIST_HPP */
--- a/src/script/api/script_station.cpp
+++ b/src/script/api/script_station.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_station.cpp Implementation of AIStation. */
+/** @file script_station.cpp Implementation of ScriptStation. */
 
 #include "../../stdafx.h"
 #include "script_station.hpp"
@@ -20,38 +20,38 @@
 #include "../../company_func.h"
 #include "../../town.h"
 
-/* static */ bool AIStation::IsValidStation(StationID station_id)
+/* static */ bool ScriptStation::IsValidStation(StationID station_id)
 {
 	const Station *st = ::Station::GetIfValid(station_id);
 	return st != NULL && (st->owner == _current_company || st->owner == OWNER_NONE);
 }
 
-/* static */ StationID AIStation::GetStationID(TileIndex tile)
+/* static */ StationID ScriptStation::GetStationID(TileIndex tile)
 {
 	if (!::IsValidTile(tile) || !::IsTileType(tile, MP_STATION)) return INVALID_STATION;
 	return ::GetStationIndex(tile);
 }
 
-/* static */ int32 AIStation::GetCargoWaiting(StationID station_id, CargoID cargo_id)
+/* static */ int32 ScriptStation::GetCargoWaiting(StationID station_id, CargoID cargo_id)
 {
 	if (!IsValidStation(station_id)) return -1;
-	if (!AICargo::IsValidCargo(cargo_id)) return -1;
+	if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
 
 	return ::Station::Get(station_id)->goods[cargo_id].cargo.Count();
 }
 
-/* static */ int32 AIStation::GetCargoRating(StationID station_id, CargoID cargo_id)
+/* static */ int32 ScriptStation::GetCargoRating(StationID station_id, CargoID cargo_id)
 {
 	if (!IsValidStation(station_id)) return -1;
-	if (!AICargo::IsValidCargo(cargo_id)) return -1;
+	if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
 
 	return ::ToPercent8(::Station::Get(station_id)->goods[cargo_id].rating);
 }
 
-/* static */ int32 AIStation::GetCoverageRadius(AIStation::StationType station_type)
+/* static */ int32 ScriptStation::GetCoverageRadius(ScriptStation::StationType station_type)
 {
 	if (station_type == STATION_AIRPORT) {
-		DEBUG(ai, 0, "GetCoverageRadius(): coverage radius of airports needs to be requested via AIAirport::GetAirportCoverageRadius(), as it requires AirportType");
+		DEBUG(ai, 0, "GetCoverageRadius(): coverage radius of airports needs to be requested via ScriptAirport::GetAirportCoverageRadius(), as it requires AirportType");
 		return -1;
 	}
 	if (!HasExactlyOneBit(station_type)) return -1;
@@ -66,28 +66,28 @@
 	}
 }
 
-/* static */ int32 AIStation::GetDistanceManhattanToTile(StationID station_id, TileIndex tile)
+/* static */ int32 ScriptStation::GetDistanceManhattanToTile(StationID station_id, TileIndex tile)
 {
 	if (!IsValidStation(station_id)) return -1;
 
-	return AIMap::DistanceManhattan(tile, GetLocation(station_id));
+	return ScriptMap::DistanceManhattan(tile, GetLocation(station_id));
 }
 
-/* static */ int32 AIStation::GetDistanceSquareToTile(StationID station_id, TileIndex tile)
+/* static */ int32 ScriptStation::GetDistanceSquareToTile(StationID station_id, TileIndex tile)
 {
 	if (!IsValidStation(station_id)) return -1;
 
-	return AIMap::DistanceSquare(tile, GetLocation(station_id));
+	return ScriptMap::DistanceSquare(tile, GetLocation(station_id));
 }
 
-/* static */ bool AIStation::IsWithinTownInfluence(StationID station_id, TownID town_id)
+/* static */ bool ScriptStation::IsWithinTownInfluence(StationID station_id, TownID town_id)
 {
 	if (!IsValidStation(station_id)) return false;
 
-	return AITown::IsWithinTownInfluence(town_id, GetLocation(station_id));
+	return ScriptTown::IsWithinTownInfluence(town_id, GetLocation(station_id));
 }
 
-/* static */ bool AIStation::HasStationType(StationID station_id, StationType station_type)
+/* static */ bool ScriptStation::HasStationType(StationID station_id, StationType station_type)
 {
 	if (!IsValidStation(station_id)) return false;
 	if (!HasExactlyOneBit(station_type)) return false;
@@ -95,10 +95,10 @@
 	return (::Station::Get(station_id)->facilities & station_type) != 0;
 }
 
-/* static */ bool AIStation::HasRoadType(StationID station_id, AIRoad::RoadType road_type)
+/* static */ bool ScriptStation::HasRoadType(StationID station_id, ScriptRoad::RoadType road_type)
 {
 	if (!IsValidStation(station_id)) return false;
-	if (!AIRoad::IsRoadTypeAvailable(road_type)) return false;
+	if (!ScriptRoad::IsRoadTypeAvailable(road_type)) return false;
 
 	::RoadTypes r = RoadTypeToRoadTypes((::RoadType)road_type);
 
@@ -112,7 +112,7 @@
 	return false;
 }
 
-/* static */ TownID AIStation::GetNearestTown(StationID station_id)
+/* static */ TownID ScriptStation::GetNearestTown(StationID station_id)
 {
 	if (!IsValidStation(station_id)) return INVALID_TOWN;
 
--- a/src/script/api/script_station.hpp
+++ b/src/script/api/script_station.hpp
@@ -18,14 +18,14 @@
 /**
  * Class that handles all station related functions.
  */
-class AIStation : public AIBaseStation {
+class ScriptStation : public ScriptBaseStation {
 public:
 	/**
 	 * All station related error messages.
 	 */
 	enum ErrorMessages {
 		/** Base for station related errors */
-		ERR_STATION_BASE = AIError::ERR_CAT_STATION << AIError::ERR_CAT_BIT_SIZE,
+		ERR_STATION_BASE = ScriptError::ERR_CAT_STATION << ScriptError::ERR_CAT_BIT_SIZE,
 
 		/** The station is build too close to another station, airport or dock */
 		ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, // [STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT, STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION, STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK]
@@ -90,10 +90,10 @@
 	 * @param station_type The type of station.
 	 * @return The radius in tiles.
 	 */
-	static int32 GetCoverageRadius(AIStation::StationType station_type);
+	static int32 GetCoverageRadius(ScriptStation::StationType station_type);
 
 	/**
-	 * Get the manhattan distance from the tile to the AIStation::GetLocation()
+	 * Get the manhattan distance from the tile to the ScriptStation::GetLocation()
 	 *  of the station.
 	 * @param station_id The station to get the distance to.
 	 * @param tile The tile to get the distance to.
@@ -103,7 +103,7 @@
 	static int32 GetDistanceManhattanToTile(StationID station_id, TileIndex tile);
 
 	/**
-	 * Get the square distance from the tile to the AIStation::GetLocation()
+	 * Get the square distance from the tile to the ScriptStation::GetLocation()
 	 *  of the station.
 	 * @param station_id The station to get the distance to.
 	 * @param tile The tile to get the distance to.
@@ -138,7 +138,7 @@
 	 * @param road_type The RoadType to look for.
 	 * @return True if the station has a station part of the type RoadType.
 	 */
-	static bool HasRoadType(StationID station_id, AIRoad::RoadType road_type);
+	static bool HasRoadType(StationID station_id, ScriptRoad::RoadType road_type);
 
 	/**
 	 * Get the town that was nearest to the given station when the station was built.
@@ -153,6 +153,6 @@
 	static TownID GetNearestTown(StationID station_id);
 };
 
-DECLARE_ENUM_AS_BIT_SET(AIStation::StationType)
+DECLARE_ENUM_AS_BIT_SET(ScriptStation::StationType)
 
 #endif /* SCRIPT_STATION_HPP */
--- a/src/script/api/script_stationlist.cpp
+++ b/src/script/api/script_stationlist.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_stationlist.cpp Implementation of AIStationList and friends. */
+/** @file script_stationlist.cpp Implementation of ScriptStationList and friends. */
 
 #include "../../stdafx.h"
 #include "script_stationlist.hpp"
@@ -16,7 +16,7 @@
 #include "../../station_base.h"
 #include "../../vehicle_base.h"
 
-AIStationList::AIStationList(AIStation::StationType station_type)
+ScriptStationList::ScriptStationList(ScriptStation::StationType station_type)
 {
 	Station *st;
 	FOR_ALL_STATIONS(st) {
@@ -24,9 +24,9 @@
 	}
 }
 
-AIStationList_Vehicle::AIStationList_Vehicle(VehicleID vehicle_id)
+ScriptStationList_Vehicle::ScriptStationList_Vehicle(VehicleID vehicle_id)
 {
-	if (!AIVehicle::IsValidVehicle(vehicle_id)) return;
+	if (!ScriptVehicle::IsValidVehicle(vehicle_id)) return;
 
 	Vehicle *v = ::Vehicle::Get(vehicle_id);
 
--- a/src/script/api/script_stationlist.hpp
+++ b/src/script/api/script_stationlist.hpp
@@ -17,26 +17,26 @@
 
 /**
  * Creates a list of stations of which you are the owner.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIStationList : public AIList {
+class ScriptStationList : public ScriptList {
 public:
 	/**
 	 * @param station_type The type of station to make a list of stations for.
 	 */
-	AIStationList(AIStation::StationType station_type);
+	ScriptStationList(ScriptStation::StationType station_type);
 };
 
 /**
  * Creates a list of stations which the vehicle has in its orders.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIStationList_Vehicle : public AIList {
+class ScriptStationList_Vehicle : public ScriptList {
 public:
 	/**
 	 * @param vehicle_id The vehicle to get the list of stations he has in its orders from.
 	 */
-	AIStationList_Vehicle(VehicleID vehicle_id);
+	ScriptStationList_Vehicle(VehicleID vehicle_id);
 };
 
 #endif /* SCRIPT_STATIONLIST_HPP */
--- a/src/script/api/script_subsidy.cpp
+++ b/src/script/api/script_subsidy.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_subsidy.cpp Implementation of AISubsidy. */
+/** @file script_subsidy.cpp Implementation of ScriptSubsidy. */
 
 #include "../../stdafx.h"
 #include "script_subsidy.hpp"
@@ -15,69 +15,69 @@
 #include "../../subsidy_base.h"
 #include "../../station_base.h"
 
-/* static */ bool AISubsidy::IsValidSubsidy(SubsidyID subsidy_id)
+/* static */ bool ScriptSubsidy::IsValidSubsidy(SubsidyID subsidy_id)
 {
 	return ::Subsidy::IsValidID(subsidy_id);
 }
 
-/* static */ bool AISubsidy::IsAwarded(SubsidyID subsidy_id)
+/* static */ bool ScriptSubsidy::IsAwarded(SubsidyID subsidy_id)
 {
 	if (!IsValidSubsidy(subsidy_id)) return false;
 
 	return ::Subsidy::Get(subsidy_id)->IsAwarded();
 }
 
-/* static */ AICompany::CompanyID AISubsidy::GetAwardedTo(SubsidyID subsidy_id)
+/* static */ ScriptCompany::CompanyID ScriptSubsidy::GetAwardedTo(SubsidyID subsidy_id)
 {
-	if (!IsAwarded(subsidy_id)) return AICompany::COMPANY_INVALID;
+	if (!IsAwarded(subsidy_id)) return ScriptCompany::COMPANY_INVALID;
 
-	return (AICompany::CompanyID)((byte)::Subsidy::Get(subsidy_id)->awarded);
+	return (ScriptCompany::CompanyID)((byte)::Subsidy::Get(subsidy_id)->awarded);
 }
 
-/* static */ int32 AISubsidy::GetExpireDate(SubsidyID subsidy_id)
+/* static */ int32 ScriptSubsidy::GetExpireDate(SubsidyID subsidy_id)
 {
 	if (!IsValidSubsidy(subsidy_id)) return -1;
 
-	int year = AIDate::GetYear(AIDate::GetCurrentDate());
-	int month = AIDate::GetMonth(AIDate::GetCurrentDate());
+	int year = ScriptDate::GetYear(ScriptDate::GetCurrentDate());
+	int month = ScriptDate::GetMonth(ScriptDate::GetCurrentDate());
 
 	month += ::Subsidy::Get(subsidy_id)->remaining;
 
 	year += (month - 1) / 12;
 	month = ((month - 1) % 12) + 1;
 
-	return AIDate::GetDate(year, month, 1);
+	return ScriptDate::GetDate(year, month, 1);
 }
 
-/* static */ CargoID AISubsidy::GetCargoType(SubsidyID subsidy_id)
+/* static */ CargoID ScriptSubsidy::GetCargoType(SubsidyID subsidy_id)
 {
 	if (!IsValidSubsidy(subsidy_id)) return CT_INVALID;
 
 	return ::Subsidy::Get(subsidy_id)->cargo_type;
 }
 
-/* static */ AISubsidy::SubsidyParticipantType AISubsidy::GetSourceType(SubsidyID subsidy_id)
+/* static */ ScriptSubsidy::SubsidyParticipantType ScriptSubsidy::GetSourceType(SubsidyID subsidy_id)
 {
 	if (!IsValidSubsidy(subsidy_id)) return SPT_INVALID;
 
 	return (SubsidyParticipantType)(uint)::Subsidy::Get(subsidy_id)->src_type;
 }
 
-/* static */ int32 AISubsidy::GetSourceIndex(SubsidyID subsidy_id)
+/* static */ int32 ScriptSubsidy::GetSourceIndex(SubsidyID subsidy_id)
 {
 	if (!IsValidSubsidy(subsidy_id)) return INVALID_STATION;
 
 	return ::Subsidy::Get(subsidy_id)->src;
 }
 
-/* static */ AISubsidy::SubsidyParticipantType AISubsidy::GetDestinationType(SubsidyID subsidy_id)
+/* static */ ScriptSubsidy::SubsidyParticipantType ScriptSubsidy::GetDestinationType(SubsidyID subsidy_id)
 {
 	if (!IsValidSubsidy(subsidy_id)) return SPT_INVALID;
 
 	return (SubsidyParticipantType)(uint)::Subsidy::Get(subsidy_id)->dst_type;
 }
 
-/* static */ int32 AISubsidy::GetDestinationIndex(SubsidyID subsidy_id)
+/* static */ int32 ScriptSubsidy::GetDestinationIndex(SubsidyID subsidy_id)
 {
 	if (!IsValidSubsidy(subsidy_id)) return INVALID_STATION;
 
--- a/src/script/api/script_subsidy.hpp
+++ b/src/script/api/script_subsidy.hpp
@@ -17,7 +17,7 @@
 /**
  * Class that handles all subsidy related functions.
  */
-class AISubsidy : public AIObject {
+class ScriptSubsidy : public ScriptObject {
 public:
 	/**
 	 * Enumeration for source and destination of a subsidy.
@@ -50,7 +50,7 @@
 	 * @pre IsAwarded(subsidy_id).
 	 * @return The companyindex of the company this subsidy is awarded to.
 	 */
-	static AICompany::CompanyID GetAwardedTo(SubsidyID subsidy_id);
+	static ScriptCompany::CompanyID GetAwardedTo(SubsidyID subsidy_id);
 
 	/**
 	 * Get the date this subsidy expires. In case the subsidy is already
--- a/src/script/api/script_subsidylist.cpp
+++ b/src/script/api/script_subsidylist.cpp
@@ -7,13 +7,13 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_subsidylist.cpp Implementation of AISubsidyList. */
+/** @file script_subsidylist.cpp Implementation of ScriptSubsidyList. */
 
 #include "../../stdafx.h"
 #include "script_subsidylist.hpp"
 #include "../../subsidy_base.h"
 
-AISubsidyList::AISubsidyList()
+ScriptSubsidyList::ScriptSubsidyList()
 {
 	const Subsidy *s;
 	FOR_ALL_SUBSIDIES(s) {
--- a/src/script/api/script_subsidylist.hpp
+++ b/src/script/api/script_subsidylist.hpp
@@ -16,11 +16,11 @@
 
 /**
  * Creates a list of all current subsidies.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AISubsidyList : public AIList {
+class ScriptSubsidyList : public ScriptList {
 public:
-	AISubsidyList();
+	ScriptSubsidyList();
 };
 
 #endif /* SCRIPT_SUBSIDYLIST_HPP */
--- a/src/script/api/script_testmode.cpp
+++ b/src/script/api/script_testmode.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_testmode.cpp Implementation of AITestMode. */
+/** @file script_testmode.cpp Implementation of ScriptTestMode. */
 
 #include "../../stdafx.h"
 #include "script_testmode.hpp"
@@ -15,25 +15,25 @@
 #include "../../company_func.h"
 #include "../../ai/ai_instance.hpp"
 
-bool AITestMode::ModeProc()
+bool ScriptTestMode::ModeProc()
 {
 	/* In test mode we only return 'false', telling the DoCommand it
 	 *  should stop after testing the command and return with that result. */
 	return false;
 }
 
-AITestMode::AITestMode()
+ScriptTestMode::ScriptTestMode()
 {
 	this->last_mode     = this->GetDoCommandMode();
 	this->last_instance = this->GetDoCommandModeInstance();
-	this->SetDoCommandMode(&AITestMode::ModeProc, this);
+	this->SetDoCommandMode(&ScriptTestMode::ModeProc, this);
 }
 
-AITestMode::~AITestMode()
+ScriptTestMode::~ScriptTestMode()
 {
 	if (this->GetDoCommandModeInstance() != this) {
 		/* Ignore this error if the AI already died. */
-		if (!AIObject::GetActiveInstance()->IsDead()) {
+		if (!ScriptObject::GetActiveInstance()->IsDead()) {
 			throw AI_FatalError("AITestmode object was removed while it was not the latest AI*Mode object created.");
 		}
 	}
--- a/src/script/api/script_testmode.hpp
+++ b/src/script/api/script_testmode.hpp
@@ -23,10 +23,10 @@
  *   system only checks if it would be able to execute your requests, and what
  *   the cost would be.
  */
-class AITestMode : public AIObject {
+class ScriptTestMode : public ScriptObject {
 private:
 	AIModeProc *last_mode;   ///< The previous mode we were in.
-	AIObject *last_instance; ///< The previous instace of the mode.
+	ScriptObject *last_instance; ///< The previous instace of the mode.
 
 protected:
 	/**
@@ -40,13 +40,13 @@
 	 * @note When the instance is destroyed, he restores the mode that was
 	 *   current when the instance was created!
 	 */
-	AITestMode();
+	ScriptTestMode();
 
 	/**
 	 * Destroying this instance reset the building mode to the mode it was
 	 *   in when the instance was created.
 	 */
-	~AITestMode();
+	~ScriptTestMode();
 };
 
 #endif /* SCRIPT_TESTMODE_HPP */
--- a/src/script/api/script_tile.cpp
+++ b/src/script/api/script_tile.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_tile.cpp Implementation of AITile. */
+/** @file script_tile.cpp Implementation of ScriptTile. */
 
 #include "../../stdafx.h"
 #include "script_tile.hpp"
@@ -23,7 +23,7 @@
 #include "../../landscape.h"
 #include "../../economy_func.h"
 
-/* static */ bool AITile::IsBuildable(TileIndex tile)
+/* static */ bool ScriptTile::IsBuildable(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
@@ -44,30 +44,30 @@
 	}
 }
 
-/* static */ bool AITile::IsBuildableRectangle(TileIndex tile, uint width, uint height)
+/* static */ bool ScriptTile::IsBuildableRectangle(TileIndex tile, uint width, uint height)
 {
 	uint tx, ty;
 
-	tx = AIMap::GetTileX(tile);
-	ty = AIMap::GetTileY(tile);
+	tx = ScriptMap::GetTileX(tile);
+	ty = ScriptMap::GetTileY(tile);
 
 	for (uint x = tx; x < width + tx; x++) {
 		for (uint y = ty; y < height + ty; y++) {
-			if (!IsBuildable(AIMap::GetTileIndex(x, y))) return false;
+			if (!IsBuildable(ScriptMap::GetTileIndex(x, y))) return false;
 		}
 	}
 
 	return true;
 }
 
-/* static */ bool AITile::IsWaterTile(TileIndex tile)
+/* static */ bool ScriptTile::IsWaterTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_WATER) && !::IsCoast(tile);
 }
 
-/* static */ bool AITile::IsCoastTile(TileIndex tile)
+/* static */ bool ScriptTile::IsCoastTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
@@ -75,98 +75,98 @@
 		(::IsTileType(tile, MP_TREES) && ::GetTreeGround(tile) == TREE_GROUND_SHORE);
 }
 
-/* static */ bool AITile::IsStationTile(TileIndex tile)
+/* static */ bool ScriptTile::IsStationTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_STATION);
 }
 
-/* static */ bool AITile::IsSteepSlope(Slope slope)
+/* static */ bool ScriptTile::IsSteepSlope(Slope slope)
 {
 	if ((slope & ~(SLOPE_ELEVATED | SLOPE_STEEP | SLOPE_HALFTILE_MASK)) != 0) return false;
 
 	return ::IsSteepSlope((::Slope)slope);
 }
 
-/* static */ bool AITile::IsHalftileSlope(Slope slope)
+/* static */ bool ScriptTile::IsHalftileSlope(Slope slope)
 {
 	if ((slope & ~(SLOPE_ELEVATED | SLOPE_STEEP | SLOPE_HALFTILE_MASK)) != 0) return false;
 
 	return ::IsHalftileSlope((::Slope)slope);
 }
 
-/* static */ bool AITile::HasTreeOnTile(TileIndex tile)
+/* static */ bool ScriptTile::HasTreeOnTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_TREES);
 }
 
-/* static */ bool AITile::IsFarmTile(TileIndex tile)
+/* static */ bool ScriptTile::IsFarmTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return (::IsTileType(tile, MP_CLEAR) && ::IsClearGround(tile, CLEAR_FIELDS));
 }
 
-/* static */ bool AITile::IsRockTile(TileIndex tile)
+/* static */ bool ScriptTile::IsRockTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return (::IsTileType(tile, MP_CLEAR) && ::GetRawClearGround(tile) == ::CLEAR_ROCKS);
 }
 
-/* static */ bool AITile::IsRoughTile(TileIndex tile)
+/* static */ bool ScriptTile::IsRoughTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return (::IsTileType(tile, MP_CLEAR) && ::GetRawClearGround(tile) == ::CLEAR_ROUGH);
 }
 
-/* static */ bool AITile::IsSnowTile(TileIndex tile)
+/* static */ bool ScriptTile::IsSnowTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return (::IsTileType(tile, MP_CLEAR) && ::IsSnowTile(tile));
 }
 
-/* static */ bool AITile::IsDesertTile(TileIndex tile)
+/* static */ bool ScriptTile::IsDesertTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return (::IsTileType(tile, MP_CLEAR) && ::IsClearGround(tile, CLEAR_DESERT));
 }
 
-/* static */ AITile::Slope AITile::GetSlope(TileIndex tile)
+/* static */ ScriptTile::Slope ScriptTile::GetSlope(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return SLOPE_INVALID;
 
 	return (Slope)::GetTileSlope(tile);
 }
 
-/* static */ AITile::Slope AITile::GetComplementSlope(Slope slope)
+/* static */ ScriptTile::Slope ScriptTile::GetComplementSlope(Slope slope)
 {
 	if ((slope & ~SLOPE_ELEVATED) != 0) return SLOPE_INVALID;
 
 	return (Slope)::ComplementSlope((::Slope)slope);
 }
 
-/* static */ int32 AITile::GetMinHeight(TileIndex tile)
+/* static */ int32 ScriptTile::GetMinHeight(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return -1;
 
 	return ::GetTileZ(tile);
 }
 
-/* static */ int32 AITile::GetMaxHeight(TileIndex tile)
+/* static */ int32 ScriptTile::GetMaxHeight(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return -1;
 
 	return ::GetTileMaxZ(tile);
 }
 
-/* static */ int32 AITile::GetCornerHeight(TileIndex tile, Corner corner)
+/* static */ int32 ScriptTile::GetCornerHeight(TileIndex tile, Corner corner)
 {
 	if (!::IsValidTile(tile) || !::IsValidCorner((::Corner)corner)) return -1;
 
@@ -175,114 +175,114 @@
 	return (z + ::GetSlopeZInCorner(slope, (::Corner)corner));
 }
 
-/* static */ AICompany::CompanyID AITile::GetOwner(TileIndex tile)
+/* static */ ScriptCompany::CompanyID ScriptTile::GetOwner(TileIndex tile)
 {
-	if (!::IsValidTile(tile)) return AICompany::COMPANY_INVALID;
-	if (::IsTileType(tile, MP_HOUSE)) return AICompany::COMPANY_INVALID;
-	if (::IsTileType(tile, MP_INDUSTRY)) return AICompany::COMPANY_INVALID;
+	if (!::IsValidTile(tile)) return ScriptCompany::COMPANY_INVALID;
+	if (::IsTileType(tile, MP_HOUSE)) return ScriptCompany::COMPANY_INVALID;
+	if (::IsTileType(tile, MP_INDUSTRY)) return ScriptCompany::COMPANY_INVALID;
 
-	return AICompany::ResolveCompanyID((AICompany::CompanyID)(byte)::GetTileOwner(tile));
+	return ScriptCompany::ResolveCompanyID((ScriptCompany::CompanyID)(byte)::GetTileOwner(tile));
 }
 
-/* static */ bool AITile::HasTransportType(TileIndex tile, TransportType transport_type)
+/* static */ bool ScriptTile::HasTransportType(TileIndex tile, TransportType transport_type)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::TrackStatusToTrackdirBits(::GetTileTrackStatus(tile, (::TransportType)transport_type, UINT32_MAX)) != TRACKDIR_BIT_NONE;
 }
 
-/* static */ int32 AITile::GetCargoAcceptance(TileIndex tile, CargoID cargo_type, int width, int height, int radius)
+/* static */ int32 ScriptTile::GetCargoAcceptance(TileIndex tile, CargoID cargo_type, int width, int height, int radius)
 {
-	if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius < 0 || !AICargo::IsValidCargo(cargo_type)) return -1;
+	if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius < 0 || !ScriptCargo::IsValidCargo(cargo_type)) return -1;
 
 	CargoArray acceptance = ::GetAcceptanceAroundTiles(tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED);
 	return acceptance[cargo_type];
 }
 
-/* static */ int32 AITile::GetCargoProduction(TileIndex tile, CargoID cargo_type, int width, int height, int radius)
+/* static */ int32 ScriptTile::GetCargoProduction(TileIndex tile, CargoID cargo_type, int width, int height, int radius)
 {
-	if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius < 0 || !AICargo::IsValidCargo(cargo_type)) return -1;
+	if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius < 0 || !ScriptCargo::IsValidCargo(cargo_type)) return -1;
 
 	CargoArray produced = ::GetProductionAroundTiles(tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED);
 	return produced[cargo_type];
 }
 
-/* static */ int32 AITile::GetDistanceManhattanToTile(TileIndex tile_from, TileIndex tile_to)
+/* static */ int32 ScriptTile::GetDistanceManhattanToTile(TileIndex tile_from, TileIndex tile_to)
 {
-	return AIMap::DistanceManhattan(tile_from, tile_to);
+	return ScriptMap::DistanceManhattan(tile_from, tile_to);
 }
 
-/* static */ int32 AITile::GetDistanceSquareToTile(TileIndex tile_from, TileIndex tile_to)
+/* static */ int32 ScriptTile::GetDistanceSquareToTile(TileIndex tile_from, TileIndex tile_to)
 {
-	return AIMap::DistanceSquare(tile_from, tile_to);
+	return ScriptMap::DistanceSquare(tile_from, tile_to);
 }
 
-/* static */ bool AITile::RaiseTile(TileIndex tile, int32 slope)
+/* static */ bool ScriptTile::RaiseTile(TileIndex tile, int32 slope)
 {
 	EnforcePrecondition(false, tile < ::MapSize());
 
-	return AIObject::DoCommand(tile, slope, 1, CMD_TERRAFORM_LAND);
+	return ScriptObject::DoCommand(tile, slope, 1, CMD_TERRAFORM_LAND);
 }
 
-/* static */ bool AITile::LowerTile(TileIndex tile, int32 slope)
+/* static */ bool ScriptTile::LowerTile(TileIndex tile, int32 slope)
 {
 	EnforcePrecondition(false, tile < ::MapSize());
 
-	return AIObject::DoCommand(tile, slope, 0, CMD_TERRAFORM_LAND);
+	return ScriptObject::DoCommand(tile, slope, 0, CMD_TERRAFORM_LAND);
 }
 
-/* static */ bool AITile::LevelTiles(TileIndex start_tile, TileIndex end_tile)
+/* static */ bool ScriptTile::LevelTiles(TileIndex start_tile, TileIndex end_tile)
 {
 	EnforcePrecondition(false, start_tile < ::MapSize());
 	EnforcePrecondition(false, end_tile < ::MapSize());
 
-	return AIObject::DoCommand(end_tile, start_tile, LM_LEVEL << 1, CMD_LEVEL_LAND);
+	return ScriptObject::DoCommand(end_tile, start_tile, LM_LEVEL << 1, CMD_LEVEL_LAND);
 }
 
-/* static */ bool AITile::DemolishTile(TileIndex tile)
+/* static */ bool ScriptTile::DemolishTile(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 
-	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
+	return ScriptObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
 }
 
-/* static */ bool AITile::PlantTree(TileIndex tile)
+/* static */ bool ScriptTile::PlantTree(TileIndex tile)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 
-	return AIObject::DoCommand(tile, TREE_INVALID, tile, CMD_PLANT_TREE);
+	return ScriptObject::DoCommand(tile, TREE_INVALID, tile, CMD_PLANT_TREE);
 }
 
-/* static */ bool AITile::PlantTreeRectangle(TileIndex tile, uint width, uint height)
+/* static */ bool ScriptTile::PlantTreeRectangle(TileIndex tile, uint width, uint height)
 {
 	EnforcePrecondition(false, ::IsValidTile(tile));
 	EnforcePrecondition(false, width >= 1 && width <= 20);
 	EnforcePrecondition(false, height >= 1 && height <= 20);
 	TileIndex end_tile = tile + ::TileDiffXY(width - 1, height - 1);
 
-	return AIObject::DoCommand(tile, TREE_INVALID, end_tile, CMD_PLANT_TREE);
+	return ScriptObject::DoCommand(tile, TREE_INVALID, end_tile, CMD_PLANT_TREE);
 }
 
-/* static */ bool AITile::IsWithinTownInfluence(TileIndex tile, TownID town_id)
+/* static */ bool ScriptTile::IsWithinTownInfluence(TileIndex tile, TownID town_id)
 {
-	return AITown::IsWithinTownInfluence(town_id, tile);
+	return ScriptTown::IsWithinTownInfluence(town_id, tile);
 }
 
-/* static */ TownID AITile::GetTownAuthority(TileIndex tile)
+/* static */ TownID ScriptTile::GetTownAuthority(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 
 	return ::ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority)->index;
 }
 
-/* static */ TownID AITile::GetClosestTown(TileIndex tile)
+/* static */ TownID ScriptTile::GetClosestTown(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return INVALID_TOWN;
 
 	return ::ClosestTownFromTile(tile, UINT_MAX)->index;
 }
 
-/* static */ Money AITile::GetBuildCost(BuildType build_type)
+/* static */ Money ScriptTile::GetBuildCost(BuildType build_type)
 {
 	switch (build_type) {
 		case BT_FOUNDATION:   return ::GetPrice(PR_BUILD_FOUNDATION, 1, NULL);
--- a/src/script/api/script_tile.hpp
+++ b/src/script/api/script_tile.hpp
@@ -18,7 +18,7 @@
 /**
  * Class that handles all tile related functions.
  */
-class AITile : public AIObject {
+class ScriptTile : public ScriptObject {
 public:
 	/**
 	 * Error messages related to modifying tiles.
@@ -26,7 +26,7 @@
 	enum ErrorMessages {
 
 		/** Base for tile related errors */
-		ERR_TILE_BASE = AIError::ERR_CAT_TILE << AIError::ERR_CAT_BIT_SIZE,
+		ERR_TILE_BASE = ScriptError::ERR_CAT_TILE << ScriptError::ERR_CAT_BIT_SIZE,
 
 		/** Tile can't be raised any higher */
 		ERR_TILE_TOO_HIGH,                     // [STR_ERROR_ALREADY_AT_SEA_LEVEL]
@@ -118,11 +118,11 @@
 	 * Check if this tile is buildable, i.e. no things on it that needs
 	 *  demolishing.
 	 * @param tile The tile to check on.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if it is buildable, false if not.
-	 * @note For trams you also might want to check for AIRoad::IsRoad(),
+	 * @note For trams you also might want to check for ScriptRoad::IsRoad(),
 	 *   as you can build tram-rails on road-tiles.
-	 * @note For rail you also might want to check for AIRoad::IsRoad(),
+	 * @note For rail you also might want to check for ScriptRoad::IsRoad(),
 	 *   as in some cases you can build rails on road-tiles.
 	 */
 	static bool IsBuildable(TileIndex tile);
@@ -133,7 +133,7 @@
 	 * @param tile The tile to check on.
 	 * @param width The width of the rectangle.
 	 * @param height The height of the rectangle.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if it is buildable, false if not.
 	 */
 	static bool IsBuildableRectangle(TileIndex tile, uint width, uint height);
@@ -141,7 +141,7 @@
 	/**
 	 * Checks whether the given tile is actually a water tile.
 	 * @param tile The tile to check on.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile is a water tile.
 	 */
 	static bool IsWaterTile(TileIndex tile);
@@ -149,7 +149,7 @@
 	/**
 	 * Checks whether the given tile is actually a coast tile.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile is a coast tile.
 	 * @note Building on coast tiles in general is more expensive. This is not
 	 *  true if there are also trees on the tile, see #HasTreeOnTile.
@@ -159,7 +159,7 @@
 	/**
 	 * Checks whether the given tile is a station tile of any station.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile is a station tile.
 	 */
 	static bool IsStationTile(TileIndex tile);
@@ -186,7 +186,7 @@
 	/**
 	 * Check if the tile has any tree on it.
 	 * @param tile The tile to check on.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if there is a tree on the tile.
 	 */
 	static bool HasTreeOnTile(TileIndex tile);
@@ -194,7 +194,7 @@
 	/**
 	 * Check if the tile is a farmland tile.
 	 * @param tile The tile to check on.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile is farmland.
 	 */
 	static bool IsFarmTile(TileIndex tile);
@@ -202,7 +202,7 @@
 	/**
 	 * Check if the tile is a rock tile.
 	 * @param tile The tile to check on.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile is rock tile.
 	 */
 	static bool IsRockTile(TileIndex tile);
@@ -210,7 +210,7 @@
 	/**
 	 * Check if the tile is a rough tile.
 	 * @param tile The tile to check on.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile is rough tile.
 	 */
 	static bool IsRoughTile(TileIndex tile);
@@ -218,7 +218,7 @@
 	/**
 	 * Check if the tile is a snow tile.
 	 * @param tile The tile to check on.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile is snow tile.
 	 */
 	static bool IsSnowTile(TileIndex tile);
@@ -226,7 +226,7 @@
 	/**
 	 * Check if the tile is a desert tile.
 	 * @param tile The tile to check on.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile is desert tile.
 	 */
 	static bool IsDesertTile(TileIndex tile);
@@ -235,7 +235,7 @@
 	 * Get the slope of a tile.
 	 * This is the slope of the bare tile. A possible foundation on the tile does not influence this slope.
 	 * @param tile The tile to check on.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return Bit mask encoding the slope. See #Slope for a description of the returned values.
 	 */
 	static Slope GetSlope(TileIndex tile);
@@ -255,7 +255,7 @@
 	 * Get the minimal height on a tile.
 	 * The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
 	 * @param tile The tile to check on.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return The height of the lowest corner of the tile, ranging from 0 to 15.
 	 */
 	static int32 GetMinHeight(TileIndex tile);
@@ -264,7 +264,7 @@
 	 * Get the maximal height on a tile.
 	 * The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
 	 * @param tile The tile to check on.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return The height of the highest corner of the tile, ranging from 0 to 15.
 	 */
 	static int32 GetMaxHeight(TileIndex tile);
@@ -274,7 +274,7 @@
 	 * The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
 	 * @param tile The tile to check on.
 	 * @param corner The corner to query.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return The height of the lowest corner of the tile, ranging from 0 to 15.
 	 */
 	static int32 GetCornerHeight(TileIndex tile, Corner corner);
@@ -282,24 +282,24 @@
 	/**
 	 * Get the owner of the tile.
 	 * @param tile The tile to get the owner from.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return The CompanyID of the owner of the tile, or COMPANY_INVALID if
 	 *  there is no owner (grass/industry/water tiles, etc.).
 	 */
-	static AICompany::CompanyID GetOwner(TileIndex tile);
+	static ScriptCompany::CompanyID GetOwner(TileIndex tile);
 
 	/**
 	 * Checks whether the given tile contains parts suitable for the given
 	 *  TransportType.
 	 * @param tile The tile to check.
 	 * @param transport_type The TransportType to check against.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre transport_type != TRANSPORT_AIR.
 	 * @note Returns false on tiles with roadworks and on road tiles with only
 	 *       a single piece of road as these tiles cannot be used to transport
 	 *       anything on. It furthermore returns true on some coast tile for
 	 *       TRANSPORT_WATER because ships can navigate over them.
-	 * @note Use AIAirport.IsAirportTile to check for airport tiles. Aircraft
+	 * @note Use ScriptAirport.IsAirportTile to check for airport tiles. Aircraft
 	 *       can fly over every tile on the map so using HasTransportType
 	 *       doesn't make sense for TRANSPORT_AIR.
 	 * @return True if and only if the tile has the given TransportType.
@@ -315,8 +315,8 @@
 	 * @param width The width of the station.
 	 * @param height The height of the station.
 	 * @param radius The radius of the station.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @pre AICargo::IsValidCargo(cargo_type)
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @pre ScriptCargo::IsValidCargo(cargo_type)
 	 * @pre width > 0.
 	 * @pre height > 0.
 	 * @pre radius >= 0.
@@ -332,8 +332,8 @@
 	 * @param width The width of the station.
 	 * @param height The height of the station.
 	 * @param radius The radius of the station.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @pre AICargo::IsValidCargo(cargo_type)
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @pre ScriptCargo::IsValidCargo(cargo_type)
 	 * @pre width > 0.
 	 * @pre height > 0.
 	 * @pre radius >= 0.
@@ -365,10 +365,10 @@
 	 *       multiple corners may result in changing some corners by multiple steps.
 	 * @param tile The tile to raise.
 	 * @param slope Corners to raise (SLOPE_xxx).
-	 * @pre tile < AIMap::GetMapSize().
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_TOO_CLOSE_TO_EDGE
-	 * @exception AITile::ERR_TILE_TOO_HIGH
+	 * @pre tile < ScriptMap::GetMapSize().
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_TOO_CLOSE_TO_EDGE
+	 * @exception ScriptTile::ERR_TILE_TOO_HIGH
 	 * @return 0 means failed, 1 means success.
 	 */
 	static bool RaiseTile(TileIndex tile, int32 slope);
@@ -381,10 +381,10 @@
 	 *       multiple corners may result in changing some corners by multiple steps.
 	 * @param tile The tile to lower.
 	 * @param slope Corners to lower (SLOPE_xxx).
-	 * @pre tile < AIMap::GetMapSize().
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_TOO_CLOSE_TO_EDGE
-	 * @exception AITile::ERR_TILE_TOO_LOW
+	 * @pre tile < ScriptMap::GetMapSize().
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_TOO_CLOSE_TO_EDGE
+	 * @exception ScriptTile::ERR_TILE_TOO_LOW
 	 * @return 0 means failed, 1 means success.
 	 */
 	static bool LowerTile(TileIndex tile, int32 slope);
@@ -392,26 +392,26 @@
 	/**
 	 * Level all tiles in the rectangle between start_tile and end_tile so they
 	 *  are at the same height. All tiles will be raised or lowered until
-	 *  they are at height AITile::GetHeight(start_tile).
+	 *  they are at height ScriptTile::GetHeight(start_tile).
 	 * @param start_tile One corner of the rectangle to level.
 	 * @param end_tile The opposite corner of the rectangle.
-	 * @pre start_tile < AIMap::GetMapSize().
-	 * @pre end_tile < AIMap::GetMapSize().
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AIError::ERR_TOO_CLOSE_TO_EDGE
+	 * @pre start_tile < ScriptMap::GetMapSize().
+	 * @pre end_tile < ScriptMap::GetMapSize().
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptError::ERR_TOO_CLOSE_TO_EDGE
 	 * @return True if one or more tiles were leveled.
 	 * @note Even if leveling some part fails, some other part may have been
 	 *  successfully leveled already.
-	 * @note This function may return true in AITestMode, although it fails in
-	 *  AIExecMode.
+	 * @note This function may return true in ScriptTestMode, although it fails in
+	 *  ScriptExecMode.
 	 */
 	static bool LevelTiles(TileIndex start_tile, TileIndex end_tile);
 
 	/**
 	 * Destroy everything on the given tile.
 	 * @param tile The tile to demolish.
-	 * @pre AIMap::IsValidTile(tile).
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
+	 * @pre ScriptMap::IsValidTile(tile).
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
 	 * @return True if and only if the tile was demolished.
 	 */
 	static bool DemolishTile(TileIndex tile);
@@ -419,7 +419,7 @@
 	/**
 	 * Create a random tree on a tile.
 	 * @param tile The tile to build a tree on.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if a tree was added on the tile.
 	 */
 	static bool PlantTree(TileIndex tile);
@@ -429,7 +429,7 @@
 	 * @param tile The top left tile of the rectangle.
 	 * @param width The width of the rectangle.
 	 * @param height The height of the rectangle.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @pre width >= 1 && width <= 20.
 	 * @pre height >= 1 && height <= 20.
 	 * @return True if and only if a tree was added on any of the tiles in the rectangle.
--- a/src/script/api/script_tilelist.cpp
+++ b/src/script/api/script_tilelist.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_tilelist.cpp Implementation of AITileList and friends. */
+/** @file script_tilelist.cpp Implementation of ScriptTileList and friends. */
 
 #include "../../stdafx.h"
 #include "script_tilelist.hpp"
@@ -15,7 +15,7 @@
 #include "../../industry.h"
 #include "../../station_base.h"
 
-void AITileList::AddRectangle(TileIndex t1, TileIndex t2)
+void ScriptTileList::AddRectangle(TileIndex t1, TileIndex t2)
 {
 	if (!::IsValidTile(t1)) return;
 	if (!::IsValidTile(t2)) return;
@@ -24,14 +24,14 @@
 	TILE_AREA_LOOP(t, ta) this->AddItem(t);
 }
 
-void AITileList::AddTile(TileIndex tile)
+void ScriptTileList::AddTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return;
 
 	this->AddItem(tile);
 }
 
-void AITileList::RemoveRectangle(TileIndex t1, TileIndex t2)
+void ScriptTileList::RemoveRectangle(TileIndex t1, TileIndex t2)
 {
 	if (!::IsValidTile(t1)) return;
 	if (!::IsValidTile(t2)) return;
@@ -40,16 +40,16 @@
 	TILE_AREA_LOOP(t, ta) this->RemoveItem(t);
 }
 
-void AITileList::RemoveTile(TileIndex tile)
+void ScriptTileList::RemoveTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return;
 
 	this->RemoveItem(tile);
 }
 
-AITileList_IndustryAccepting::AITileList_IndustryAccepting(IndustryID industry_id, int radius)
+ScriptTileList_IndustryAccepting::ScriptTileList_IndustryAccepting(IndustryID industry_id, int radius)
 {
-	if (!AIIndustry::IsValidIndustry(industry_id) || radius <= 0) return;
+	if (!ScriptIndustry::IsValidIndustry(industry_id) || radius <= 0) return;
 
 	const Industry *i = ::Industry::Get(industry_id);
 
@@ -85,9 +85,9 @@
 	}
 }
 
-AITileList_IndustryProducing::AITileList_IndustryProducing(IndustryID industry_id, int radius)
+ScriptTileList_IndustryProducing::ScriptTileList_IndustryProducing(IndustryID industry_id, int radius)
 {
-	if (!AIIndustry::IsValidIndustry(industry_id) || radius <= 0) return;
+	if (!ScriptIndustry::IsValidIndustry(industry_id) || radius <= 0) return;
 
 	const Industry *i = ::Industry::Get(industry_id);
 
@@ -110,20 +110,20 @@
 	}
 }
 
-AITileList_StationType::AITileList_StationType(StationID station_id, AIStation::StationType station_type)
+ScriptTileList_StationType::ScriptTileList_StationType(StationID station_id, ScriptStation::StationType station_type)
 {
-	if (!AIStation::IsValidStation(station_id)) return;
+	if (!ScriptStation::IsValidStation(station_id)) return;
 
 	const StationRect *rect = &::Station::Get(station_id)->rect;
 
 	uint station_type_value = 0;
-	/* Convert AIStation::StationType to ::StationType, but do it in a
+	/* Convert ScriptStation::StationType to ::StationType, but do it in a
 	 *  bitmask, so we can scan for multiple entries at the same time. */
-	if ((station_type & AIStation::STATION_TRAIN) != 0)      station_type_value |= (1 << ::STATION_RAIL);
-	if ((station_type & AIStation::STATION_TRUCK_STOP) != 0) station_type_value |= (1 << ::STATION_TRUCK);
-	if ((station_type & AIStation::STATION_BUS_STOP) != 0)   station_type_value |= (1 << ::STATION_BUS);
-	if ((station_type & AIStation::STATION_AIRPORT) != 0)    station_type_value |= (1 << ::STATION_AIRPORT) | (1 << ::STATION_OILRIG);
-	if ((station_type & AIStation::STATION_DOCK) != 0)       station_type_value |= (1 << ::STATION_DOCK)    | (1 << ::STATION_OILRIG);
+	if ((station_type & ScriptStation::STATION_TRAIN) != 0)      station_type_value |= (1 << ::STATION_RAIL);
+	if ((station_type & ScriptStation::STATION_TRUCK_STOP) != 0) station_type_value |= (1 << ::STATION_TRUCK);
+	if ((station_type & ScriptStation::STATION_BUS_STOP) != 0)   station_type_value |= (1 << ::STATION_BUS);
+	if ((station_type & ScriptStation::STATION_AIRPORT) != 0)    station_type_value |= (1 << ::STATION_AIRPORT) | (1 << ::STATION_OILRIG);
+	if ((station_type & ScriptStation::STATION_DOCK) != 0)       station_type_value |= (1 << ::STATION_DOCK)    | (1 << ::STATION_OILRIG);
 
 	TileArea ta(::TileXY(rect->left, rect->top), rect->right - rect->left + 1, rect->bottom - rect->top + 1);
 	TILE_AREA_LOOP(cur_tile, ta) {
--- a/src/script/api/script_tilelist.hpp
+++ b/src/script/api/script_tilelist.hpp
@@ -17,23 +17,23 @@
 
 /**
  * Creates an empty list, in which you can add tiles.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AITileList : public AIList {
+class ScriptTileList : public ScriptList {
 public:
 	/**
 	 * Adds the rectangle between tile_from and tile_to to the to-be-evaluated tiles.
 	 * @param tile_from One corner of the tiles to add.
 	 * @param tile_to The other corner of the tiles to add.
-	 * @pre AIMap::IsValidTile(tile_from).
-	 * @pre AIMap::IsValidTile(tile_to).
+	 * @pre ScriptMap::IsValidTile(tile_from).
+	 * @pre ScriptMap::IsValidTile(tile_to).
 	 */
 	void AddRectangle(TileIndex tile_from, TileIndex tile_to);
 
 	/**
 	 * Add a tile to the to-be-evaluated tiles.
 	 * @param tile The tile to add.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 */
 	void AddTile(TileIndex tile);
 
@@ -41,15 +41,15 @@
 	 * Remove the tiles inside the rectangle between tile_from and tile_to form the list.
 	 * @param tile_from One corner of the tiles to remove.
 	 * @param tile_to The other corner of the files to remove.
-	 * @pre AIMap::IsValidTile(tile_from).
-	 * @pre AIMap::IsValidTile(tile_to).
+	 * @pre ScriptMap::IsValidTile(tile_from).
+	 * @pre ScriptMap::IsValidTile(tile_to).
 	 */
 	void RemoveRectangle(TileIndex tile_from, TileIndex tile_to);
 
 	/**
 	 * Remove a tile from the list.
 	 * @param tile The tile to remove.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 */
 	void RemoveTile(TileIndex tile);
 };
@@ -57,47 +57,47 @@
 /**
  * Creates a list of tiles that will accept cargo for the given industry.
  * @note If a simular industry is close, it might happen that this industry receives the cargo.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AITileList_IndustryAccepting : public AITileList {
+class ScriptTileList_IndustryAccepting : public ScriptTileList {
 public:
 	/**
-	 * @param industry_id The industry to create the AITileList around.
+	 * @param industry_id The industry to create the ScriptTileList around.
 	 * @param radius The radius of the station you will be using.
-	 * @pre AIIndustry::IsValidIndustry(industry_id).
+	 * @pre ScriptIndustry::IsValidIndustry(industry_id).
 	 * @pre radius > 0.
 	 */
-	AITileList_IndustryAccepting(IndustryID industry_id, int radius);
+	ScriptTileList_IndustryAccepting(IndustryID industry_id, int radius);
 };
 
 /**
  * Creates a list of tiles which the industry checks to see if a station is
  *  there to receive cargo produced by this industry.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AITileList_IndustryProducing : public AITileList {
+class ScriptTileList_IndustryProducing : public ScriptTileList {
 public:
 	/**
-	 * @param industry_id The industry to create the AITileList around.
+	 * @param industry_id The industry to create the ScriptTileList around.
 	 * @param radius The radius of the station you will be using.
-	 * @pre AIIndustry::IsValidIndustry(industry_id).
+	 * @pre ScriptIndustry::IsValidIndustry(industry_id).
 	 * @pre radius > 0.
 	 */
-	AITileList_IndustryProducing(IndustryID industry_id, int radius);
+	ScriptTileList_IndustryProducing(IndustryID industry_id, int radius);
 };
 
 /**
  * Creates a list of tiles which have the requested StationType of the
  *  StationID.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AITileList_StationType : public AITileList {
+class ScriptTileList_StationType : public ScriptTileList {
 public:
 	/**
-	 * @param station_id The station to create the AITileList for.
-	 * @param station_type The StationType to create the AIList for.
+	 * @param station_id The station to create the ScriptTileList for.
+	 * @param station_type The StationType to create the ScriptList for.
 	 */
-	AITileList_StationType(StationID station_id, AIStation::StationType station_type);
+	ScriptTileList_StationType(StationID station_id, ScriptStation::StationType station_type);
 };
 
 #endif /* SCRIPT_TILELIST_HPP */
--- a/src/script/api/script_town.cpp
+++ b/src/script/api/script_town.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_town.cpp Implementation of AITown. */
+/** @file script_town.cpp Implementation of ScriptTown. */
 
 #include "../../stdafx.h"
 #include "script_town.hpp"
@@ -21,17 +21,17 @@
 #include "../../landscape.h"
 #include "table/strings.h"
 
-/* static */ int32 AITown::GetTownCount()
+/* static */ int32 ScriptTown::GetTownCount()
 {
 	return (int32)::Town::GetNumItems();
 }
 
-/* static */ bool AITown::IsValidTown(TownID town_id)
+/* static */ bool ScriptTown::IsValidTown(TownID town_id)
 {
 	return ::Town::IsValidID(town_id);
 }
 
-/* static */ char *AITown::GetName(TownID town_id)
+/* static */ char *ScriptTown::GetName(TownID town_id)
 {
 	if (!IsValidTown(town_id)) return NULL;
 	static const int len = 64;
@@ -43,70 +43,70 @@
 	return town_name;
 }
 
-/* static */ int32 AITown::GetPopulation(TownID town_id)
+/* static */ int32 ScriptTown::GetPopulation(TownID town_id)
 {
 	if (!IsValidTown(town_id)) return -1;
 	const Town *t = ::Town::Get(town_id);
 	return t->population;
 }
 
-/* static */ int32 AITown::GetHouseCount(TownID town_id)
+/* static */ int32 ScriptTown::GetHouseCount(TownID town_id)
 {
 	if (!IsValidTown(town_id)) return -1;
 	const Town *t = ::Town::Get(town_id);
 	return t->num_houses;
 }
 
-/* static */ TileIndex AITown::GetLocation(TownID town_id)
+/* static */ TileIndex ScriptTown::GetLocation(TownID town_id)
 {
 	if (!IsValidTown(town_id)) return INVALID_TILE;
 	const Town *t = ::Town::Get(town_id);
 	return t->xy;
 }
 
-/* static */ int32 AITown::GetLastMonthProduction(TownID town_id, CargoID cargo_id)
+/* static */ int32 ScriptTown::GetLastMonthProduction(TownID town_id, CargoID cargo_id)
 {
 	if (!IsValidTown(town_id)) return -1;
-	if (!AICargo::IsValidCargo(cargo_id)) return -1;
+	if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
 
 	const Town *t = ::Town::Get(town_id);
 
 	return t->supplied[cargo_id].old_max;
 }
 
-/* static */ int32 AITown::GetLastMonthSupplied(TownID town_id, CargoID cargo_id)
+/* static */ int32 ScriptTown::GetLastMonthSupplied(TownID town_id, CargoID cargo_id)
 {
 	if (!IsValidTown(town_id)) return -1;
-	if (!AICargo::IsValidCargo(cargo_id)) return -1;
+	if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
 
 	const Town *t = ::Town::Get(town_id);
 
 	return t->supplied[cargo_id].old_act;
 }
 
-/* static */ int32 AITown::GetLastMonthTransportedPercentage(TownID town_id, CargoID cargo_id)
+/* static */ int32 ScriptTown::GetLastMonthTransportedPercentage(TownID town_id, CargoID cargo_id)
 {
 	if (!IsValidTown(town_id)) return -1;
-	if (!AICargo::IsValidCargo(cargo_id)) return -1;
+	if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
 
 	const Town *t = ::Town::Get(town_id);
 	return ::ToPercent8(t->GetPercentTransported(cargo_id));
 }
 
-/* static */ int32 AITown::GetLastMonthReceived(TownID town_id, AICargo::TownEffect towneffect_id)
+/* static */ int32 ScriptTown::GetLastMonthReceived(TownID town_id, ScriptCargo::TownEffect towneffect_id)
 {
 	if (!IsValidTown(town_id)) return -1;
-	if (!AICargo::IsValidTownEffect(towneffect_id)) return -1;
+	if (!ScriptCargo::IsValidTownEffect(towneffect_id)) return -1;
 
 	const Town *t = ::Town::Get(town_id);
 
 	return t->received[towneffect_id].old_act;
 }
 
-/* static */ uint32 AITown::GetCargoGoal(TownID town_id, AICargo::TownEffect towneffect_id)
+/* static */ uint32 ScriptTown::GetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id)
 {
 	if (!IsValidTown(town_id)) return -1;
-	if (!AICargo::IsValidTownEffect(towneffect_id)) return -1;
+	if (!ScriptCargo::IsValidTownEffect(towneffect_id)) return -1;
 
 	const Town *t = ::Town::Get(town_id);
 
@@ -123,7 +123,7 @@
 	}
 }
 
-/* static */ int32 AITown::GetGrowthRate(TownID town_id)
+/* static */ int32 ScriptTown::GetGrowthRate(TownID town_id)
 {
 	if (!IsValidTown(town_id)) return false;
 
@@ -132,17 +132,17 @@
 	return (t->growth_rate * TOWN_GROWTH_TICKS + DAY_TICKS) / DAY_TICKS;
 }
 
-/* static */ int32 AITown::GetDistanceManhattanToTile(TownID town_id, TileIndex tile)
+/* static */ int32 ScriptTown::GetDistanceManhattanToTile(TownID town_id, TileIndex tile)
 {
-	return AIMap::DistanceManhattan(tile, GetLocation(town_id));
+	return ScriptMap::DistanceManhattan(tile, GetLocation(town_id));
 }
 
-/* static */ int32 AITown::GetDistanceSquareToTile(TownID town_id, TileIndex tile)
+/* static */ int32 ScriptTown::GetDistanceSquareToTile(TownID town_id, TileIndex tile)
 {
-	return AIMap::DistanceSquare(tile, GetLocation(town_id));
+	return ScriptMap::DistanceSquare(tile, GetLocation(town_id));
 }
 
-/* static */ bool AITown::IsWithinTownInfluence(TownID town_id, TileIndex tile)
+/* static */ bool ScriptTown::IsWithinTownInfluence(TownID town_id, TileIndex tile)
 {
 	if (!IsValidTown(town_id)) return false;
 
@@ -150,61 +150,61 @@
 	return ((uint32)GetDistanceSquareToTile(town_id, tile) <= t->squared_town_zone_radius[0]);
 }
 
-/* static */ bool AITown::HasStatue(TownID town_id)
+/* static */ bool ScriptTown::HasStatue(TownID town_id)
 {
 	if (!IsValidTown(town_id)) return false;
 
 	return ::HasBit(::Town::Get(town_id)->statues, _current_company);
 }
 
-/* static */ bool AITown::IsCity(TownID town_id)
+/* static */ bool ScriptTown::IsCity(TownID town_id)
 {
 	if (!IsValidTown(town_id)) return false;
 
 	return ::Town::Get(town_id)->larger_town;
 }
 
-/* static */ int AITown::GetRoadReworkDuration(TownID town_id)
+/* static */ int ScriptTown::GetRoadReworkDuration(TownID town_id)
 {
 	if (!IsValidTown(town_id)) return -1;
 
 	return ::Town::Get(town_id)->road_build_months;
 }
 
-/* static */ AICompany::CompanyID AITown::GetExclusiveRightsCompany(TownID town_id)
+/* static */ ScriptCompany::CompanyID ScriptTown::GetExclusiveRightsCompany(TownID town_id)
 {
-	if (!IsValidTown(town_id)) return AICompany::COMPANY_INVALID;
+	if (!IsValidTown(town_id)) return ScriptCompany::COMPANY_INVALID;
 
-	return (AICompany::CompanyID)(int8)::Town::Get(town_id)->exclusivity;
+	return (ScriptCompany::CompanyID)(int8)::Town::Get(town_id)->exclusivity;
 }
 
-/* static */ int32 AITown::GetExclusiveRightsDuration(TownID town_id)
+/* static */ int32 ScriptTown::GetExclusiveRightsDuration(TownID town_id)
 {
 	if (!IsValidTown(town_id)) return -1;
 
 	return ::Town::Get(town_id)->exclusive_counter;
 }
 
-/* static */ bool AITown::IsActionAvailable(TownID town_id, TownAction town_action)
+/* static */ bool ScriptTown::IsActionAvailable(TownID town_id, TownAction town_action)
 {
 	if (!IsValidTown(town_id)) return false;
 
 	return HasBit(::GetMaskOfTownActions(NULL, _current_company, ::Town::Get(town_id)), town_action);
 }
 
-/* static */ bool AITown::PerformTownAction(TownID town_id, TownAction town_action)
+/* static */ bool ScriptTown::PerformTownAction(TownID town_id, TownAction town_action)
 {
 	EnforcePrecondition(false, IsValidTown(town_id));
 	EnforcePrecondition(false, IsActionAvailable(town_id, town_action));
 
-	return AIObject::DoCommand(::Town::Get(town_id)->xy, town_id, town_action, CMD_DO_TOWN_ACTION);
+	return ScriptObject::DoCommand(::Town::Get(town_id)->xy, town_id, town_action, CMD_DO_TOWN_ACTION);
 }
 
-/* static */ AITown::TownRating AITown::GetRating(TownID town_id, AICompany::CompanyID company_id)
+/* static */ ScriptTown::TownRating ScriptTown::GetRating(TownID town_id, ScriptCompany::CompanyID company_id)
 {
 	if (!IsValidTown(town_id)) return TOWN_RATING_INVALID;
-	AICompany::CompanyID company = AICompany::ResolveCompanyID(company_id);
-	if (company == AICompany::COMPANY_INVALID) return TOWN_RATING_INVALID;
+	ScriptCompany::CompanyID company = ScriptCompany::ResolveCompanyID(company_id);
+	if (company == ScriptCompany::COMPANY_INVALID) return TOWN_RATING_INVALID;
 
 	const Town *t = ::Town::Get(town_id);
 	if (!HasBit(t->have_ratings, company)) {
@@ -228,7 +228,7 @@
 	}
 }
 
-/* static */ int AITown::GetAllowedNoise(TownID town_id)
+/* static */ int ScriptTown::GetAllowedNoise(TownID town_id)
 {
 	if (!IsValidTown(town_id)) return -1;
 
@@ -245,9 +245,9 @@
 	return max(0, 2 - num);
 }
 
-/* static */ AITown::RoadLayout AITown::GetRoadLayout(TownID town_id)
+/* static */ ScriptTown::RoadLayout ScriptTown::GetRoadLayout(TownID town_id)
 {
 	if (!IsValidTown(town_id)) return ROAD_LAYOUT_INVALID;
 
-	return (AITown::RoadLayout)((TownLayout)::Town::Get(town_id)->layout);
+	return (ScriptTown::RoadLayout)((TownLayout)::Town::Get(town_id)->layout);
 }
--- a/src/script/api/script_town.hpp
+++ b/src/script/api/script_town.hpp
@@ -18,7 +18,7 @@
 /**
  * Class that handles all town related functions.
  */
-class AITown : public AIObject {
+class ScriptTown : public ScriptObject {
 public:
 	/**
 	 * Actions that one can perform on a town.
@@ -151,7 +151,7 @@
 	 * @param town_id The index of the town.
 	 * @param cargo_id The index of the cargo.
 	 * @pre IsValidTown(town_id).
-	 * @pre AICargo::IsValidCargo(cargo_id).
+	 * @pre ScriptCargo::IsValidCargo(cargo_id).
 	 * @return The last month's production of the given cargo for this town.
 	 */
 	static int32 GetLastMonthProduction(TownID town_id, CargoID cargo_id);
@@ -161,7 +161,7 @@
 	 * @param town_id The index of the town.
 	 * @param cargo_id The index of the cargo.
 	 * @pre IsValidTown(town_id).
-	 * @pre AICargo::IsValidCargo(cargo_id).
+	 * @pre ScriptCargo::IsValidCargo(cargo_id).
 	 * @return The amount of cargo supplied for transport from this town last month.
 	 */
 	static int32 GetLastMonthSupplied(TownID town_id, CargoID cargo_id);
@@ -171,7 +171,7 @@
 	 * @param town_id The index of the town.
 	 * @param cargo_id The index of the cargo.
 	 * @pre IsValidTown(town_id).
-	 * @pre AICargo::IsValidCargo(cargo_id).
+	 * @pre ScriptCargo::IsValidCargo(cargo_id).
 	 * @return The percentage of given cargo transported from this town last month.
 	 */
 	static int32 GetLastMonthTransportedPercentage(TownID town_id, CargoID cargo_id);
@@ -181,10 +181,10 @@
 	 * @param town_id The index of the town.
 	 * @param towneffect_id The index of the cargo.
 	 * @pre IsValidTown(town_id).
-	 * @pre AICargo::IsValidTownEffect(cargo_id).
+	 * @pre ScriptCargo::IsValidTownEffect(cargo_id).
 	 * @return The amount of cargo received by this town last month for this cargo effect.
 	 */
-	static int32 GetLastMonthReceived(TownID town_id, AICargo::TownEffect towneffect_id);
+	static int32 GetLastMonthReceived(TownID town_id, ScriptCargo::TownEffect towneffect_id);
 
 	/**
 	 * Get the amount of cargo that needs to be delivered (per TownEffect) for a
@@ -192,12 +192,12 @@
 	 * @param town_id The index of the town.
 	 * @param towneffect_id The index of the towneffect.
 	 * @pre IsValidTown(town_id).
-	 * @pre AICargo::IsValidTownEffect(cargo_id).
+	 * @pre ScriptCargo::IsValidTownEffect(cargo_id).
 	 * @return The goal of the cargo.
 	 * @note Goals can change over time. For example with a changing snowline, or
 	 *  with a growing town.
 	 */
-	static uint32 GetCargoGoal(TownID town_id, AICargo::TownEffect towneffect_id);
+	static uint32 GetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id);
 
 	/**
 	 * Get the amount of days between town growth.
@@ -209,7 +209,7 @@
 	static int32 GetGrowthRate(TownID town_id);
 
 	/**
-	 * Get the manhattan distance from the tile to the AITown::GetLocation()
+	 * Get the manhattan distance from the tile to the ScriptTown::GetLocation()
 	 *  of the town.
 	 * @param town_id The town to get the distance to.
 	 * @param tile The tile to get the distance to.
@@ -219,7 +219,7 @@
 	static int32 GetDistanceManhattanToTile(TownID town_id, TileIndex tile);
 
 	/**
-	 * Get the square distance from the tile to the AITown::GetLocation()
+	 * Get the square distance from the tile to the ScriptTown::GetLocation()
 	 *  of the town.
 	 * @param town_id The town to get the distance to.
 	 * @param tile The tile to get the distance to.
@@ -269,10 +269,10 @@
 	 * @param town_id The town to check.
 	 * @pre IsValidTown(town_id).
 	 * @return The company that has the exclusive rights. The value
-	 *         AICompany::COMPANY_INVALID means that there are currently no
+	 *         ScriptCompany::COMPANY_INVALID means that there are currently no
 	 *         exclusive rights given out to anyone.
 	 */
-	static AICompany::CompanyID GetExclusiveRightsCompany(TownID town_id);
+	static ScriptCompany::CompanyID GetExclusiveRightsCompany(TownID town_id);
 
 	/**
 	 * Find out how long the town is under influence of the exclusive rights.
@@ -308,10 +308,10 @@
 	 * @param town_id The town to get the rating for.
 	 * @param company_id The company to get the rating for.
 	 * @pre IsValidTown(town_id).
-	 * @pre AICompany.ResolveCompanyID(company) != AICompany::COMPANY_INVALID.
+	 * @pre ScriptCompany.ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID.
 	 * @return The rating as shown to humans.
 	 */
-	static TownRating GetRating(TownID town_id, AICompany::CompanyID company_id);
+	static TownRating GetRating(TownID town_id, ScriptCompany::CompanyID company_id);
 
 	/**
 	 * Get the maximum level of noise that still can be added by airports
--- a/src/script/api/script_townlist.cpp
+++ b/src/script/api/script_townlist.cpp
@@ -7,13 +7,13 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_townlist.cpp Implementation of AITownList and friends. */
+/** @file script_townlist.cpp Implementation of ScriptTownList and friends. */
 
 #include "../../stdafx.h"
 #include "script_townlist.hpp"
 #include "../../town.h"
 
-AITownList::AITownList()
+ScriptTownList::ScriptTownList()
 {
 	Town *t;
 	FOR_ALL_TOWNS(t) {
@@ -21,7 +21,7 @@
 	}
 }
 
-AITownEffectList::AITownEffectList()
+ScriptTownEffectList::ScriptTownEffectList()
 {
 	for (int i = TE_BEGIN; i < TE_END; i++) {
 		this->AddItem(i);
--- a/src/script/api/script_townlist.hpp
+++ b/src/script/api/script_townlist.hpp
@@ -16,20 +16,20 @@
 
 /**
  * Creates a list of towns that are currently on the map.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AITownList : public AIList {
+class ScriptTownList : public ScriptList {
 public:
-	AITownList();
+	ScriptTownList();
 };
 
 /**
  * Creates a list of all TownEffects known in the game.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AITownEffectList : public AIList {
+class ScriptTownEffectList : public ScriptList {
 public:
-	AITownEffectList();
+	ScriptTownEffectList();
 };
 
 #endif /* SCRIPT_TOWNLIST_HPP */
--- a/src/script/api/script_tunnel.cpp
+++ b/src/script/api/script_tunnel.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_tunnel.cpp Implementation of AITunnel. */
+/** @file script_tunnel.cpp Implementation of ScriptTunnel. */
 
 #include "../../stdafx.h"
 #include "script_tunnel.hpp"
@@ -16,13 +16,13 @@
 #include "../../tunnel_map.h"
 #include "../../command_func.h"
 
-/* static */ bool AITunnel::IsTunnelTile(TileIndex tile)
+/* static */ bool ScriptTunnel::IsTunnelTile(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return false;
 	return ::IsTunnelTile(tile);
 }
 
-/* static */ TileIndex AITunnel::GetOtherTunnelEnd(TileIndex tile)
+/* static */ TileIndex ScriptTunnel::GetOtherTunnelEnd(TileIndex tile)
 {
 	if (!::IsValidTile(tile)) return INVALID_TILE;
 
@@ -52,7 +52,7 @@
  */
 static void _DoCommandReturnBuildTunnel2(class AIInstance *instance)
 {
-	if (!AITunnel::_BuildTunnelRoad2()) {
+	if (!ScriptTunnel::_BuildTunnelRoad2()) {
 		AIInstance::DoCommandReturn(instance);
 		return;
 	}
@@ -68,7 +68,7 @@
  */
 static void _DoCommandReturnBuildTunnel1(class AIInstance *instance)
 {
-	if (!AITunnel::_BuildTunnelRoad1()) {
+	if (!ScriptTunnel::_BuildTunnelRoad1()) {
 		AIInstance::DoCommandReturn(instance);
 		return;
 	}
@@ -78,57 +78,57 @@
 	NOT_REACHED();
 }
 
-/* static */ bool AITunnel::BuildTunnel(AIVehicle::VehicleType vehicle_type, TileIndex start)
+/* static */ bool ScriptTunnel::BuildTunnel(ScriptVehicle::VehicleType vehicle_type, TileIndex start)
 {
 	EnforcePrecondition(false, ::IsValidTile(start));
-	EnforcePrecondition(false, vehicle_type == AIVehicle::VT_RAIL || vehicle_type == AIVehicle::VT_ROAD);
-	EnforcePrecondition(false, vehicle_type != AIVehicle::VT_RAIL || AIRail::IsRailTypeAvailable(AIRail::GetCurrentRailType()));
+	EnforcePrecondition(false, vehicle_type == ScriptVehicle::VT_RAIL || vehicle_type == ScriptVehicle::VT_ROAD);
+	EnforcePrecondition(false, vehicle_type != ScriptVehicle::VT_RAIL || ScriptRail::IsRailTypeAvailable(ScriptRail::GetCurrentRailType()));
 
 	uint type = 0;
-	if (vehicle_type == AIVehicle::VT_ROAD) {
+	if (vehicle_type == ScriptVehicle::VT_ROAD) {
 		type |= (TRANSPORT_ROAD << 8);
-		type |= ::RoadTypeToRoadTypes((::RoadType)AIObject::GetRoadType());
+		type |= ::RoadTypeToRoadTypes((::RoadType)ScriptObject::GetRoadType());
 	} else {
 		type |= (TRANSPORT_RAIL << 8);
-		type |= AIRail::GetCurrentRailType();
+		type |= ScriptRail::GetCurrentRailType();
 	}
 
 	/* For rail we do nothing special */
-	if (vehicle_type == AIVehicle::VT_RAIL) {
-		return AIObject::DoCommand(start, type, 0, CMD_BUILD_TUNNEL);
+	if (vehicle_type == ScriptVehicle::VT_RAIL) {
+		return ScriptObject::DoCommand(start, type, 0, CMD_BUILD_TUNNEL);
 	}
 
-	AIObject::SetCallbackVariable(0, start);
-	return AIObject::DoCommand(start, type, 0, CMD_BUILD_TUNNEL, NULL, &::_DoCommandReturnBuildTunnel1);
+	ScriptObject::SetCallbackVariable(0, start);
+	return ScriptObject::DoCommand(start, type, 0, CMD_BUILD_TUNNEL, NULL, &::_DoCommandReturnBuildTunnel1);
 }
 
-/* static */ bool AITunnel::_BuildTunnelRoad1()
+/* static */ bool ScriptTunnel::_BuildTunnelRoad1()
 {
 	/* Build the piece of road on the 'start' side of the tunnel */
-	TileIndex end = AIObject::GetCallbackVariable(0);
-	TileIndex start = AITunnel::GetOtherTunnelEnd(end);
+	TileIndex end = ScriptObject::GetCallbackVariable(0);
+	TileIndex start = ScriptTunnel::GetOtherTunnelEnd(end);
 
 	DiagDirection dir_1 = ::DiagdirBetweenTiles(end, start);
 	DiagDirection dir_2 = ::ReverseDiagDir(dir_1);
 
-	return AIObject::DoCommand(start + ::TileOffsByDiagDir(dir_1), ::DiagDirToRoadBits(dir_2) | (AIObject::GetRoadType() << 4), 0, CMD_BUILD_ROAD, NULL, &::_DoCommandReturnBuildTunnel2);
+	return ScriptObject::DoCommand(start + ::TileOffsByDiagDir(dir_1), ::DiagDirToRoadBits(dir_2) | (ScriptObject::GetRoadType() << 4), 0, CMD_BUILD_ROAD, NULL, &::_DoCommandReturnBuildTunnel2);
 }
 
-/* static */ bool AITunnel::_BuildTunnelRoad2()
+/* static */ bool ScriptTunnel::_BuildTunnelRoad2()
 {
 	/* Build the piece of road on the 'end' side of the tunnel */
-	TileIndex end = AIObject::GetCallbackVariable(0);
-	TileIndex start = AITunnel::GetOtherTunnelEnd(end);
+	TileIndex end = ScriptObject::GetCallbackVariable(0);
+	TileIndex start = ScriptTunnel::GetOtherTunnelEnd(end);
 
 	DiagDirection dir_1 = ::DiagdirBetweenTiles(end, start);
 	DiagDirection dir_2 = ::ReverseDiagDir(dir_1);
 
-	return AIObject::DoCommand(end + ::TileOffsByDiagDir(dir_2), ::DiagDirToRoadBits(dir_1) | (AIObject::GetRoadType() << 4), 0, CMD_BUILD_ROAD);
+	return ScriptObject::DoCommand(end + ::TileOffsByDiagDir(dir_2), ::DiagDirToRoadBits(dir_1) | (ScriptObject::GetRoadType() << 4), 0, CMD_BUILD_ROAD);
 }
 
-/* static */ bool AITunnel::RemoveTunnel(TileIndex tile)
+/* static */ bool ScriptTunnel::RemoveTunnel(TileIndex tile)
 {
 	EnforcePrecondition(false, IsTunnelTile(tile));
 
-	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
+	return ScriptObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
 }
--- a/src/script/api/script_tunnel.hpp
+++ b/src/script/api/script_tunnel.hpp
@@ -17,7 +17,7 @@
 /**
  * Class that handles all tunnel related functions.
  */
-class AITunnel : public AIObject {
+class ScriptTunnel : public ScriptObject {
 public:
 	/**
 	 * All tunnel related errors.
@@ -25,7 +25,7 @@
 	enum ErrorMessages {
 
 		/** Base for bridge related errors */
-		ERR_TUNNEL_BASE = AIError::ERR_CAT_TUNNEL << AIError::ERR_CAT_BIT_SIZE,
+		ERR_TUNNEL_BASE = ScriptError::ERR_CAT_TUNNEL << ScriptError::ERR_CAT_BIT_SIZE,
 
 		/** Can't build tunnels on water */
 		ERR_TUNNEL_CANNOT_BUILD_ON_WATER,            // [STR_ERROR_CAN_T_BUILD_ON_WATER]
@@ -43,7 +43,7 @@
 	/**
 	 * Check whether the tile is an entrance to a tunnel.
 	 * @param tile The tile to check.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return True if and only if the tile is the beginning or end of a tunnel.
 	 */
 	static bool IsTunnelTile(TileIndex tile);
@@ -51,13 +51,13 @@
 	/**
 	 * Get the tile that exits on the other end of a (would be) tunnel starting
 	 *  at tile. If there is no 'simple' inclined slope at the start tile,
-	 *  this function will return AIMap::TILE_INVALID.
+	 *  this function will return ScriptMap::TILE_INVALID.
 	 * @param tile The tile that is an entrance to a tunnel or the tile where you may want to build a tunnel.
-	 * @pre AIMap::IsValidTile(tile).
+	 * @pre ScriptMap::IsValidTile(tile).
 	 * @return The TileIndex that is the other end of the (would be) tunnel, or
-	 *  AIMap::TILE_INVALID if no other end was found (can't build tunnel).
+	 *  ScriptMap::TILE_INVALID if no other end was found (can't build tunnel).
 	 * @note Even if this function returns a valid tile, that is no guarantee
-	 *  that building a tunnel will succeed. Use BuildTunnel in AITestMode to
+	 *  that building a tunnel will succeed. Use BuildTunnel in ScriptTestMode to
 	 *  check whether a tunnel can actually be build.
 	 */
 	static TileIndex GetOtherTunnelEnd(TileIndex tile);
@@ -77,32 +77,32 @@
 	/**
 	 * Builds a tunnel starting at start. The direction of the tunnel depends
 	 *  on the slope of the start tile. Tunnels can be created for either
-	 *  rails or roads; use the appropriate AIVehicle::VehicleType.
+	 *  rails or roads; use the appropriate ScriptVehicle::VehicleType.
 	 * As an extra for road, this functions builds two half-pieces of road on
 	 *  each end of the tunnel, making it easier for you to connect it to your
 	 *  network.
 	 * @param start Where to start the tunnel.
 	 * @param vehicle_type The vehicle-type of tunnel to build.
-	 * @pre AIMap::IsValidTile(start).
-	 * @pre vehicle_type == AIVehicle::VT_ROAD || (vehicle_type == AIVehicle::VT_RAIL &&
-	 *   AIRail::IsRailTypeAvailable(AIRail::GetCurrentRailType())).
-	 * @exception AIError::ERR_AREA_NOT_CLEAR
-	 * @exception AITunnel::ERR_TUNNEL_CANNOT_BUILD_ON_WATER
-	 * @exception AITunnel::ERR_TUNNEL_START_SITE_UNSUITABLE
-	 * @exception AITunnel::ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY
-	 * @exception AITunnel::ERR_TUNNEL_END_SITE_UNSUITABLE
+	 * @pre ScriptMap::IsValidTile(start).
+	 * @pre vehicle_type == ScriptVehicle::VT_ROAD || (vehicle_type == ScriptVehicle::VT_RAIL &&
+	 *   ScriptRail::IsRailTypeAvailable(ScriptRail::GetCurrentRailType())).
+	 * @exception ScriptError::ERR_AREA_NOT_CLEAR
+	 * @exception ScriptTunnel::ERR_TUNNEL_CANNOT_BUILD_ON_WATER
+	 * @exception ScriptTunnel::ERR_TUNNEL_START_SITE_UNSUITABLE
+	 * @exception ScriptTunnel::ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY
+	 * @exception ScriptTunnel::ERR_TUNNEL_END_SITE_UNSUITABLE
 	 * @return Whether the tunnel has been/can be build or not.
-	 * @note The slope of a tile can be determined by AITile::GetSlope(TileIndex).
+	 * @note The slope of a tile can be determined by ScriptTile::GetSlope(TileIndex).
 	 * @note No matter if the road pieces were build or not, if building the
 	 *  tunnel succeeded, this function returns true.
 	 */
-	static bool BuildTunnel(AIVehicle::VehicleType vehicle_type, TileIndex start);
+	static bool BuildTunnel(ScriptVehicle::VehicleType vehicle_type, TileIndex start);
 
 	/**
 	 * Remove the tunnel whose entrance is located at tile.
 	 * @param tile The tile that is an entrance to a tunnel.
-	 * @pre AIMap::IsValidTile(tile) && IsTunnelTile(tile).
-	 * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+	 * @pre ScriptMap::IsValidTile(tile) && IsTunnelTile(tile).
+	 * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
 	 * @return Whether the tunnel has been/can be removed or not.
 	 */
 	static bool RemoveTunnel(TileIndex tile);
--- a/src/script/api/script_types.hpp
+++ b/src/script/api/script_types.hpp
@@ -100,7 +100,7 @@
 typedef uint32 VehicleID;    ///< The ID of a vehicle.
 
 /* Types we defined ourself, as the OpenTTD core doesn't have them (yet) */
-typedef uint AIErrorType;    ///< The types of errors inside the NoAI framework.
+typedef uint ScriptErrorType;    ///< The types of errors inside the NoAI framework.
 typedef BridgeType BridgeID; ///< The ID of a bridge.
 
 #endif /* SCRIPT_TYPES_HPP */
--- a/src/script/api/script_vehicle.cpp
+++ b/src/script/api/script_vehicle.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_vehicle.cpp Implementation of AIVehicle. */
+/** @file script_vehicle.cpp Implementation of ScriptVehicle. */
 
 #include "../../stdafx.h"
 #include "script_engine.hpp"
@@ -24,13 +24,13 @@
 #include "../../vehicle_func.h"
 #include "table/strings.h"
 
-/* static */ bool AIVehicle::IsValidVehicle(VehicleID vehicle_id)
+/* static */ bool ScriptVehicle::IsValidVehicle(VehicleID vehicle_id)
 {
 	const Vehicle *v = ::Vehicle::GetIfValid(vehicle_id);
 	return v != NULL && v->owner == _current_company && (v->IsPrimaryVehicle() || (v->type == VEH_TRAIN && ::Train::From(v)->IsFreeWagon()));
 }
 
-/* static */ int32 AIVehicle::GetNumWagons(VehicleID vehicle_id)
+/* static */ int32 ScriptVehicle::GetNumWagons(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
 
@@ -44,7 +44,7 @@
 	return num;
 }
 
-/* static */ int AIVehicle::GetLength(VehicleID vehicle_id)
+/* static */ int ScriptVehicle::GetLength(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
 
@@ -52,31 +52,31 @@
 	return v->IsGroundVehicle() ? v->GetGroundVehicleCache()->cached_total_length : -1;
 }
 
-/* static */ VehicleID AIVehicle::BuildVehicle(TileIndex depot, EngineID engine_id)
+/* static */ VehicleID ScriptVehicle::BuildVehicle(TileIndex depot, EngineID engine_id)
 {
-	EnforcePrecondition(VEHICLE_INVALID, AIEngine::IsBuildable(engine_id));
+	EnforcePrecondition(VEHICLE_INVALID, ScriptEngine::IsBuildable(engine_id));
 
 	::VehicleType type = ::Engine::Get(engine_id)->type;
 
-	EnforcePreconditionCustomError(VEHICLE_INVALID, !AIGameSettings::IsDisabledVehicleType((AIVehicle::VehicleType)type), AIVehicle::ERR_VEHICLE_BUILD_DISABLED);
+	EnforcePreconditionCustomError(VEHICLE_INVALID, !ScriptGameSettings::IsDisabledVehicleType((ScriptVehicle::VehicleType)type), ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED);
 
-	if (!AIObject::DoCommand(depot, engine_id, 0, ::GetCmdBuildVeh(type), NULL, &AIInstance::DoCommandReturnVehicleID)) return VEHICLE_INVALID;
+	if (!ScriptObject::DoCommand(depot, engine_id, 0, ::GetCmdBuildVeh(type), NULL, &AIInstance::DoCommandReturnVehicleID)) return VEHICLE_INVALID;
 
 	/* In case of test-mode, we return VehicleID 0 */
 	return 0;
 }
 
-/* static */ VehicleID AIVehicle::CloneVehicle(TileIndex depot, VehicleID vehicle_id, bool share_orders)
+/* static */ VehicleID ScriptVehicle::CloneVehicle(TileIndex depot, VehicleID vehicle_id, bool share_orders)
 {
 	EnforcePrecondition(false, IsValidVehicle(vehicle_id));
 
-	if (!AIObject::DoCommand(depot, vehicle_id, share_orders, CMD_CLONE_VEHICLE, NULL, &AIInstance::DoCommandReturnVehicleID)) return VEHICLE_INVALID;
+	if (!ScriptObject::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;
 }
 
-/* static */ bool AIVehicle::_MoveWagonInternal(VehicleID source_vehicle_id, int source_wagon, bool move_attached_wagons, int dest_vehicle_id, int dest_wagon)
+/* static */ bool ScriptVehicle::_MoveWagonInternal(VehicleID source_vehicle_id, int source_wagon, bool move_attached_wagons, int dest_vehicle_id, int dest_wagon)
 {
 	EnforcePrecondition(false, IsValidVehicle(source_vehicle_id) && source_wagon < GetNumWagons(source_vehicle_id));
 	EnforcePrecondition(false, dest_vehicle_id == -1 || (IsValidVehicle(dest_vehicle_id) && dest_wagon < GetNumWagons(dest_vehicle_id)));
@@ -91,45 +91,45 @@
 		while (dest_wagon-- > 0) w = w->GetNextUnit();
 	}
 
-	return AIObject::DoCommand(0, v->index | (move_attached_wagons ? 1 : 0) << 20, w == NULL ? ::INVALID_VEHICLE : w->index, CMD_MOVE_RAIL_VEHICLE);
+	return ScriptObject::DoCommand(0, v->index | (move_attached_wagons ? 1 : 0) << 20, w == NULL ? ::INVALID_VEHICLE : w->index, CMD_MOVE_RAIL_VEHICLE);
 }
 
-/* static */ bool AIVehicle::MoveWagon(VehicleID source_vehicle_id, int source_wagon, int dest_vehicle_id, int dest_wagon)
+/* static */ bool ScriptVehicle::MoveWagon(VehicleID source_vehicle_id, int source_wagon, int dest_vehicle_id, int dest_wagon)
 {
 	return _MoveWagonInternal(source_vehicle_id, source_wagon, false, dest_vehicle_id, dest_wagon);
 }
 
-/* static */ bool AIVehicle::MoveWagonChain(VehicleID source_vehicle_id, int source_wagon, int dest_vehicle_id, int dest_wagon)
+/* static */ bool ScriptVehicle::MoveWagonChain(VehicleID source_vehicle_id, int source_wagon, int dest_vehicle_id, int dest_wagon)
 {
 	return _MoveWagonInternal(source_vehicle_id, source_wagon, true, dest_vehicle_id, dest_wagon);
 }
 
-/* static */ int AIVehicle::GetRefitCapacity(VehicleID vehicle_id, CargoID cargo)
+/* static */ int ScriptVehicle::GetRefitCapacity(VehicleID vehicle_id, CargoID cargo)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
-	if (!AICargo::IsValidCargo(cargo)) return -1;
+	if (!ScriptCargo::IsValidCargo(cargo)) return -1;
 
 	CommandCost res = ::DoCommand(0, vehicle_id, cargo, DC_QUERY_COST, GetCmdRefitVeh(::Vehicle::Get(vehicle_id)));
 	return res.Succeeded() ? _returned_refit_capacity : -1;
 }
 
-/* static */ bool AIVehicle::RefitVehicle(VehicleID vehicle_id, CargoID cargo)
+/* static */ bool ScriptVehicle::RefitVehicle(VehicleID vehicle_id, CargoID cargo)
 {
-	EnforcePrecondition(false, IsValidVehicle(vehicle_id) && AICargo::IsValidCargo(cargo));
+	EnforcePrecondition(false, IsValidVehicle(vehicle_id) && ScriptCargo::IsValidCargo(cargo));
 
-	return AIObject::DoCommand(0, vehicle_id, cargo, GetCmdRefitVeh(::Vehicle::Get(vehicle_id)));
+	return ScriptObject::DoCommand(0, vehicle_id, cargo, GetCmdRefitVeh(::Vehicle::Get(vehicle_id)));
 }
 
 
-/* static */ bool AIVehicle::SellVehicle(VehicleID vehicle_id)
+/* static */ bool ScriptVehicle::SellVehicle(VehicleID vehicle_id)
 {
 	EnforcePrecondition(false, IsValidVehicle(vehicle_id));
 
 	const Vehicle *v = ::Vehicle::Get(vehicle_id);
-	return AIObject::DoCommand(0, vehicle_id | (v->type == VEH_TRAIN ? 1 : 0) << 20, 0, GetCmdSellVeh(v));
+	return ScriptObject::DoCommand(0, vehicle_id | (v->type == VEH_TRAIN ? 1 : 0) << 20, 0, GetCmdSellVeh(v));
 }
 
-/* static */ bool AIVehicle::_SellWagonInternal(VehicleID vehicle_id, int wagon, bool sell_attached_wagons)
+/* static */ bool ScriptVehicle::_SellWagonInternal(VehicleID vehicle_id, int wagon, bool sell_attached_wagons)
 {
 	EnforcePrecondition(false, IsValidVehicle(vehicle_id) && wagon < GetNumWagons(vehicle_id));
 	EnforcePrecondition(false, ::Vehicle::Get(vehicle_id)->type == VEH_TRAIN);
@@ -137,74 +137,74 @@
 	const Train *v = ::Train::Get(vehicle_id);
 	while (wagon-- > 0) v = v->GetNextUnit();
 
-	return AIObject::DoCommand(0, v->index | (sell_attached_wagons ? 1 : 0) << 20, 0, CMD_SELL_VEHICLE);
+	return ScriptObject::DoCommand(0, v->index | (sell_attached_wagons ? 1 : 0) << 20, 0, CMD_SELL_VEHICLE);
 }
 
-/* static */ bool AIVehicle::SellWagon(VehicleID vehicle_id, int wagon)
+/* static */ bool ScriptVehicle::SellWagon(VehicleID vehicle_id, int wagon)
 {
 	return _SellWagonInternal(vehicle_id, wagon, false);
 }
 
-/* static */ bool AIVehicle::SellWagonChain(VehicleID vehicle_id, int wagon)
+/* static */ bool ScriptVehicle::SellWagonChain(VehicleID vehicle_id, int wagon)
 {
 	return _SellWagonInternal(vehicle_id, wagon, true);
 }
 
-/* static */ bool AIVehicle::SendVehicleToDepot(VehicleID vehicle_id)
+/* static */ bool ScriptVehicle::SendVehicleToDepot(VehicleID vehicle_id)
 {
 	EnforcePrecondition(false, IsValidVehicle(vehicle_id));
 
-	return AIObject::DoCommand(0, vehicle_id, 0, GetCmdSendToDepot(::Vehicle::Get(vehicle_id)));
+	return ScriptObject::DoCommand(0, vehicle_id, 0, GetCmdSendToDepot(::Vehicle::Get(vehicle_id)));
 }
 
-/* static */ bool AIVehicle::SendVehicleToDepotForServicing(VehicleID vehicle_id)
+/* static */ bool ScriptVehicle::SendVehicleToDepotForServicing(VehicleID vehicle_id)
 {
 	EnforcePrecondition(false, IsValidVehicle(vehicle_id));
 
-	return AIObject::DoCommand(0, vehicle_id | DEPOT_SERVICE, 0, GetCmdSendToDepot(::Vehicle::Get(vehicle_id)));
+	return ScriptObject::DoCommand(0, vehicle_id | DEPOT_SERVICE, 0, GetCmdSendToDepot(::Vehicle::Get(vehicle_id)));
 }
 
-/* static */ bool AIVehicle::IsInDepot(VehicleID vehicle_id)
+/* static */ bool ScriptVehicle::IsInDepot(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return false;
 	return ::Vehicle::Get(vehicle_id)->IsInDepot();
 }
 
-/* static */ bool AIVehicle::IsStoppedInDepot(VehicleID vehicle_id)
+/* static */ bool ScriptVehicle::IsStoppedInDepot(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return false;
 	return ::Vehicle::Get(vehicle_id)->IsStoppedInDepot();
 }
 
-/* static */ bool AIVehicle::StartStopVehicle(VehicleID vehicle_id)
+/* static */ bool ScriptVehicle::StartStopVehicle(VehicleID vehicle_id)
 {
 	EnforcePrecondition(false, IsValidVehicle(vehicle_id));
 
-	return AIObject::DoCommand(0, vehicle_id, 0, CMD_START_STOP_VEHICLE);
+	return ScriptObject::DoCommand(0, vehicle_id, 0, CMD_START_STOP_VEHICLE);
 }
 
-/* static */ bool AIVehicle::ReverseVehicle(VehicleID vehicle_id)
+/* static */ bool ScriptVehicle::ReverseVehicle(VehicleID vehicle_id)
 {
 	EnforcePrecondition(false, IsValidVehicle(vehicle_id));
 	EnforcePrecondition(false, ::Vehicle::Get(vehicle_id)->type == VEH_ROAD || ::Vehicle::Get(vehicle_id)->type == VEH_TRAIN);
 
 	switch (::Vehicle::Get(vehicle_id)->type) {
-		case VEH_ROAD: return AIObject::DoCommand(0, vehicle_id, 0, CMD_TURN_ROADVEH);
-		case VEH_TRAIN: return AIObject::DoCommand(0, vehicle_id, 0, CMD_REVERSE_TRAIN_DIRECTION);
+		case VEH_ROAD: return ScriptObject::DoCommand(0, vehicle_id, 0, CMD_TURN_ROADVEH);
+		case VEH_TRAIN: return ScriptObject::DoCommand(0, vehicle_id, 0, CMD_REVERSE_TRAIN_DIRECTION);
 		default: NOT_REACHED();
 	}
 }
 
-/* static */ bool AIVehicle::SetName(VehicleID vehicle_id, const char *name)
+/* static */ bool ScriptVehicle::SetName(VehicleID vehicle_id, const char *name)
 {
 	EnforcePrecondition(false, IsValidVehicle(vehicle_id));
 	EnforcePrecondition(false, !::StrEmpty(name));
-	EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_VEHICLE_NAME_CHARS, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
+	EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_VEHICLE_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
 
-	return AIObject::DoCommand(0, vehicle_id, 0, CMD_RENAME_VEHICLE, name);
+	return ScriptObject::DoCommand(0, vehicle_id, 0, CMD_RENAME_VEHICLE, name);
 }
 
-/* static */ TileIndex AIVehicle::GetLocation(VehicleID vehicle_id)
+/* static */ TileIndex ScriptVehicle::GetLocation(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return INVALID_TILE;
 
@@ -218,14 +218,14 @@
 	return v->tile;
 }
 
-/* static */ EngineID AIVehicle::GetEngineType(VehicleID vehicle_id)
+/* static */ EngineID ScriptVehicle::GetEngineType(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return INVALID_ENGINE;
 
 	return ::Vehicle::Get(vehicle_id)->engine_type;
 }
 
-/* static */ EngineID AIVehicle::GetWagonEngineType(VehicleID vehicle_id, int wagon)
+/* static */ EngineID ScriptVehicle::GetWagonEngineType(VehicleID vehicle_id, int wagon)
 {
 	if (!IsValidVehicle(vehicle_id)) return INVALID_ENGINE;
 	if (wagon >= GetNumWagons(vehicle_id)) return INVALID_ENGINE;
@@ -237,14 +237,14 @@
 	return v->engine_type;
 }
 
-/* static */ int32 AIVehicle::GetUnitNumber(VehicleID vehicle_id)
+/* static */ int32 ScriptVehicle::GetUnitNumber(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
 
 	return ::Vehicle::Get(vehicle_id)->unitnumber;
 }
 
-/* static */ char *AIVehicle::GetName(VehicleID vehicle_id)
+/* static */ char *ScriptVehicle::GetName(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return NULL;
 
@@ -256,14 +256,14 @@
 	return vehicle_name;
 }
 
-/* static */ int32 AIVehicle::GetAge(VehicleID vehicle_id)
+/* static */ int32 ScriptVehicle::GetAge(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
 
 	return ::Vehicle::Get(vehicle_id)->age;
 }
 
-/* static */ int32 AIVehicle::GetWagonAge(VehicleID vehicle_id, int wagon)
+/* static */ int32 ScriptVehicle::GetWagonAge(VehicleID vehicle_id, int wagon)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
 	if (wagon >= GetNumWagons(vehicle_id)) return -1;
@@ -275,71 +275,71 @@
 	return v->age;
 }
 
-/* static */ int32 AIVehicle::GetMaxAge(VehicleID vehicle_id)
+/* static */ int32 ScriptVehicle::GetMaxAge(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
 
 	return ::Vehicle::Get(vehicle_id)->max_age;
 }
 
-/* static */ int32 AIVehicle::GetAgeLeft(VehicleID vehicle_id)
+/* static */ int32 ScriptVehicle::GetAgeLeft(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
 
 	return ::Vehicle::Get(vehicle_id)->max_age - ::Vehicle::Get(vehicle_id)->age;
 }
 
-/* static */ int32 AIVehicle::GetCurrentSpeed(VehicleID vehicle_id)
+/* static */ int32 ScriptVehicle::GetCurrentSpeed(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
 
 	return ::Vehicle::Get(vehicle_id)->GetDisplaySpeed(); // km-ish/h
 }
 
-/* static */ AIVehicle::VehicleState AIVehicle::GetState(VehicleID vehicle_id)
+/* static */ ScriptVehicle::VehicleState ScriptVehicle::GetState(VehicleID vehicle_id)
 {
-	if (!IsValidVehicle(vehicle_id)) return AIVehicle::VS_INVALID;
+	if (!IsValidVehicle(vehicle_id)) return ScriptVehicle::VS_INVALID;
 
 	const Vehicle *v = ::Vehicle::Get(vehicle_id);
 	byte vehstatus = v->vehstatus;
 
-	if (vehstatus & ::VS_CRASHED) return AIVehicle::VS_CRASHED;
-	if (v->breakdown_ctr != 0) return AIVehicle::VS_BROKEN;
-	if (v->IsStoppedInDepot()) return AIVehicle::VS_IN_DEPOT;
-	if (vehstatus & ::VS_STOPPED) return AIVehicle::VS_STOPPED;
-	if (v->current_order.IsType(OT_LOADING)) return AIVehicle::VS_AT_STATION;
-	return AIVehicle::VS_RUNNING;
+	if (vehstatus & ::VS_CRASHED) return ScriptVehicle::VS_CRASHED;
+	if (v->breakdown_ctr != 0) return ScriptVehicle::VS_BROKEN;
+	if (v->IsStoppedInDepot()) return ScriptVehicle::VS_IN_DEPOT;
+	if (vehstatus & ::VS_STOPPED) return ScriptVehicle::VS_STOPPED;
+	if (v->current_order.IsType(OT_LOADING)) return ScriptVehicle::VS_AT_STATION;
+	return ScriptVehicle::VS_RUNNING;
 }
 
-/* static */ Money AIVehicle::GetRunningCost(VehicleID vehicle_id)
+/* static */ Money ScriptVehicle::GetRunningCost(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
 
 	return ::Vehicle::Get(vehicle_id)->GetRunningCost() >> 8;
 }
 
-/* static */ Money AIVehicle::GetProfitThisYear(VehicleID vehicle_id)
+/* static */ Money ScriptVehicle::GetProfitThisYear(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
 
 	return ::Vehicle::Get(vehicle_id)->GetDisplayProfitThisYear();
 }
 
-/* static */ Money AIVehicle::GetProfitLastYear(VehicleID vehicle_id)
+/* static */ Money ScriptVehicle::GetProfitLastYear(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
 
 	return ::Vehicle::Get(vehicle_id)->GetDisplayProfitLastYear();
 }
 
-/* static */ Money AIVehicle::GetCurrentValue(VehicleID vehicle_id)
+/* static */ Money ScriptVehicle::GetCurrentValue(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
 
 	return ::Vehicle::Get(vehicle_id)->value;
 }
 
-/* static */ AIVehicle::VehicleType AIVehicle::GetVehicleType(VehicleID vehicle_id)
+/* static */ ScriptVehicle::VehicleType ScriptVehicle::GetVehicleType(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return VT_INVALID;
 
@@ -352,18 +352,18 @@
 	}
 }
 
-/* static */ AIRoad::RoadType AIVehicle::GetRoadType(VehicleID vehicle_id)
+/* static */ ScriptRoad::RoadType ScriptVehicle::GetRoadType(VehicleID vehicle_id)
 {
-	if (!IsValidVehicle(vehicle_id)) return AIRoad::ROADTYPE_INVALID;
-	if (GetVehicleType(vehicle_id) != VT_ROAD) return AIRoad::ROADTYPE_INVALID;
+	if (!IsValidVehicle(vehicle_id)) return ScriptRoad::ROADTYPE_INVALID;
+	if (GetVehicleType(vehicle_id) != VT_ROAD) return ScriptRoad::ROADTYPE_INVALID;
 
-	return (AIRoad::RoadType)(::RoadVehicle::Get(vehicle_id))->roadtype;
+	return (ScriptRoad::RoadType)(::RoadVehicle::Get(vehicle_id))->roadtype;
 }
 
-/* static */ int32 AIVehicle::GetCapacity(VehicleID vehicle_id, CargoID cargo)
+/* static */ int32 ScriptVehicle::GetCapacity(VehicleID vehicle_id, CargoID cargo)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
-	if (!AICargo::IsValidCargo(cargo)) return -1;
+	if (!ScriptCargo::IsValidCargo(cargo)) return -1;
 
 	uint32 amount = 0;
 	for (const Vehicle *v = ::Vehicle::Get(vehicle_id); v != NULL; v = v->Next()) {
@@ -373,10 +373,10 @@
 	return amount;
 }
 
-/* static */ int32 AIVehicle::GetCargoLoad(VehicleID vehicle_id, CargoID cargo)
+/* static */ int32 ScriptVehicle::GetCargoLoad(VehicleID vehicle_id, CargoID cargo)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
-	if (!AICargo::IsValidCargo(cargo)) return -1;
+	if (!ScriptCargo::IsValidCargo(cargo)) return -1;
 
 	uint32 amount = 0;
 	for (const Vehicle *v = ::Vehicle::Get(vehicle_id); v != NULL; v = v->Next()) {
@@ -386,14 +386,14 @@
 	return amount;
 }
 
-/* static */ GroupID AIVehicle::GetGroupID(VehicleID vehicle_id)
+/* static */ GroupID ScriptVehicle::GetGroupID(VehicleID vehicle_id)
 {
-	if (!IsValidVehicle(vehicle_id)) return AIGroup::GROUP_INVALID;
+	if (!IsValidVehicle(vehicle_id)) return ScriptGroup::GROUP_INVALID;
 
 	return ::Vehicle::Get(vehicle_id)->group_id;
 }
 
-/* static */ bool AIVehicle::IsArticulated(VehicleID vehicle_id)
+/* static */ bool ScriptVehicle::IsArticulated(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return false;
 	if (GetVehicleType(vehicle_id) != VT_ROAD && GetVehicleType(vehicle_id) != VT_RAIL) return false;
@@ -406,7 +406,7 @@
 	}
 }
 
-/* static */ bool AIVehicle::HasSharedOrders(VehicleID vehicle_id)
+/* static */ bool ScriptVehicle::HasSharedOrders(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return false;
 
@@ -414,7 +414,7 @@
 	return v->orders.list != NULL && v->orders.list->GetNumVehicles() > 1;
 }
 
-/* static */ int AIVehicle::GetReliability(VehicleID vehicle_id)
+/* static */ int ScriptVehicle::GetReliability(VehicleID vehicle_id)
 {
 	if (!IsValidVehicle(vehicle_id)) return -1;
 
--- a/src/script/api/script_vehicle.hpp
+++ b/src/script/api/script_vehicle.hpp
@@ -17,14 +17,14 @@
 /**
  * Class that handles all vehicle related functions.
  */
-class AIVehicle : public AIObject {
+class ScriptVehicle : public ScriptObject {
 public:
 	/**
 	 * All vehicle related error messages.
 	 */
 	enum ErrorMessages {
 		/** Base for vehicle related errors */
-		ERR_VEHICLE_BASE = AIError::ERR_CAT_VEHICLE << AIError::ERR_CAT_BIT_SIZE,
+		ERR_VEHICLE_BASE = ScriptError::ERR_CAT_VEHICLE << ScriptError::ERR_CAT_BIT_SIZE,
 
 		/** Too many vehicles in the game, can't build any more. */
 		ERR_VEHICLE_TOO_MANY,                   // [STR_ERROR_TOO_MANY_VEHICLES_IN_GAME]
@@ -117,7 +117,7 @@
 	 * @pre IsValidVehicle(vehicle_id).
 	 * @pre 'name' must have at least one character.
 	 * @pre 'name' must have at most 30 characters.
-	 * @exception AIError::ERR_NAME_IS_NOT_UNIQUE
+	 * @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE
 	 * @return True if and only if the name was changed.
 	 */
 	static bool SetName(VehicleID vehicle_id, const char *name);
@@ -227,7 +227,7 @@
 	 * @pre IsValidVehicle(vehicle_id).
 	 * @return The running cost of the vehicle per year.
 	 * @note Cost is per year; divide by 365 to get per day.
-	 * @note This is not equal to AIEngine::GetRunningCost for Trains, because
+	 * @note This is not equal to ScriptEngine::GetRunningCost for Trains, because
 	 *   wagons and second engines can add up in the calculation too.
 	 */
 	static Money GetRunningCost(VehicleID vehicle_id);
@@ -264,7 +264,7 @@
 	 * @pre IsValidVehicle(vehicle_id).
 	 * @return The vehicle type.
 	 */
-	static AIVehicle::VehicleType GetVehicleType(VehicleID vehicle_id);
+	static ScriptVehicle::VehicleType GetVehicleType(VehicleID vehicle_id);
 
 	/**
 	 * Get the RoadType of the vehicle.
@@ -273,7 +273,7 @@
 	 * @pre GetVehicleType(vehicle_id) == VT_ROAD.
 	 * @return The RoadType the vehicle has.
 	 */
-	static AIRoad::RoadType GetRoadType(VehicleID vehicle_id);
+	static ScriptRoad::RoadType GetRoadType(VehicleID vehicle_id);
 
 	/**
 	 * Check if a vehicle is in a depot.
@@ -297,10 +297,10 @@
 	 * @param engine_id The engine to use for this vehicle.
 	 * @pre The tile at depot has a depot that can build the engine and
 	 *   is owned by you.
-	 * @pre AIEngine::IsBuildable(engine_id).
-	 * @exception AIVehicle::ERR_VEHICLE_TOO_MANY
-	 * @exception AIVehicle::ERR_VEHICLE_BUILD_DISABLED
-	 * @exception AIVehicle::ERR_VEHICLE_WRONG_DEPOT
+	 * @pre ScriptEngine::IsBuildable(engine_id).
+	 * @exception ScriptVehicle::ERR_VEHICLE_TOO_MANY
+	 * @exception ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED
+	 * @exception ScriptVehicle::ERR_VEHICLE_WRONG_DEPOT
 	 * @return The VehicleID of the new vehicle, or an invalid VehicleID when
 	 *   it failed. Check the return value using IsValidVehicle. In test-mode
 	 *   0 is returned if it was successful; any other value indicates failure.
@@ -317,9 +317,9 @@
 	 * @param share_orders Should the orders be copied or shared?
 	 * @pre The tile 'depot' has a depot on it, allowing 'vehicle_id'-type vehicles.
 	 * @pre IsValidVehicle(vehicle_id).
-	 * @exception AIVehicle::ERR_VEHICLE_TOO_MANY
-	 * @exception AIVehicle::ERR_VEHICLE_BUILD_DISABLED
-	 * @exception AIVehicle::ERR_VEHICLE_WRONG_DEPOT
+	 * @exception ScriptVehicle::ERR_VEHICLE_TOO_MANY
+	 * @exception ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED
+	 * @exception ScriptVehicle::ERR_VEHICLE_WRONG_DEPOT
 	 * @return The VehicleID of the new vehicle, or an invalid VehicleID when
 	 *   it failed. Check the return value using IsValidVehicle. In test-mode
 	 *   0 is returned if it was successful; any other value indicates failure.
@@ -361,7 +361,7 @@
 	 * @param vehicle_id The vehicle to refit.
 	 * @param cargo The cargo to refit to.
 	 * @pre IsValidVehicle(vehicle_id).
-	 * @pre AICargo::IsValidCargo(cargo).
+	 * @pre ScriptCargo::IsValidCargo(cargo).
 	 * @pre You must own the vehicle.
 	 * @pre The vehicle must be stopped in the depot.
 	 * @return The capacity the vehicle will have when refited.
@@ -373,12 +373,12 @@
 	 * @param vehicle_id The vehicle to refit.
 	 * @param cargo The cargo to refit to.
 	 * @pre IsValidVehicle(vehicle_id).
-	 * @pre AICargo::IsValidCargo(cargo).
+	 * @pre ScriptCargo::IsValidCargo(cargo).
 	 * @pre You must own the vehicle.
 	 * @pre The vehicle must be stopped in the depot.
-	 * @exception AIVehicle::ERR_VEHICLE_CANNOT_REFIT
-	 * @exception AIVehicle::ERR_VEHICLE_IS_DESTROYED
-	 * @exception AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT
+	 * @exception ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT
+	 * @exception ScriptVehicle::ERR_VEHICLE_IS_DESTROYED
+	 * @exception ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT
 	 * @return True if and only if the refit succeeded.
 	 */
 	static bool RefitVehicle(VehicleID vehicle_id, CargoID cargo);
@@ -389,8 +389,8 @@
 	 * @pre IsValidVehicle(vehicle_id).
 	 * @pre You must own the vehicle.
 	 * @pre The vehicle must be stopped in the depot.
-	 * @exception AIVehicle::ERR_VEHICLE_IS_DESTROYED
-	 * @exception AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT
+	 * @exception ScriptVehicle::ERR_VEHICLE_IS_DESTROYED
+	 * @exception ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT
 	 * @return True if and only if the vehicle has been sold.
 	 */
 	static bool SellVehicle(VehicleID vehicle_id);
@@ -403,8 +403,8 @@
 	 * @pre wagon < GetNumWagons(vehicle_id).
 	 * @pre You must own the vehicle.
 	 * @pre The vehicle must be stopped in the depot.
-	 * @exception AIVehicle::ERR_VEHICLE_IS_DESTROYED
-	 * @exception AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT
+	 * @exception ScriptVehicle::ERR_VEHICLE_IS_DESTROYED
+	 * @exception ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT
 	 * @return True if and only if the wagon has been sold.
 	 */
 	static bool SellWagon(VehicleID vehicle_id, int wagon);
@@ -417,8 +417,8 @@
 	 * @pre wagon < GetNumWagons(vehicle_id).
 	 * @pre You must own the vehicle.
 	 * @pre The vehicle must be stopped in the depot.
-	 * @exception AIVehicle::ERR_VEHICLE_IS_DESTROYED
-	 * @exception AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT
+	 * @exception ScriptVehicle::ERR_VEHICLE_IS_DESTROYED
+	 * @exception ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT
 	 * @return True if and only if the wagons have been sold.
 	 */
 	static bool SellWagonChain(VehicleID vehicle_id, int wagon);
@@ -428,7 +428,7 @@
 	 * sent to a depot it continues with its normal orders instead.
 	 * @param vehicle_id The vehicle to send to a depot.
 	 * @pre IsValidVehicle(vehicle_id).
-	 * @exception AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT
+	 * @exception ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT
 	 * @return True if the current order was changed.
 	 */
 	static bool SendVehicleToDepot(VehicleID vehicle_id);
@@ -438,7 +438,7 @@
 	 * already been sent to a depot it continues with its normal orders instead.
 	 * @param vehicle_id The vehicle to send to a depot for servicing.
 	 * @pre IsValidVehicle(vehicle_id).
-	 * @exception AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT
+	 * @exception ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT
 	 * @return True if the current order was changed.
 	 */
 	static bool SendVehicleToDepotForServicing(VehicleID vehicle_id);
@@ -447,9 +447,9 @@
 	 * Starts or stops the given vehicle depending on the current state.
 	 * @param vehicle_id The vehicle to start/stop.
 	 * @pre IsValidVehicle(vehicle_id).
-	 * @exception AIVehicle::ERR_VEHICLE_CANNOT_START_STOP
-	 * @exception (For aircraft only): AIVehicle::ERR_VEHICLE_IN_FLIGHT
-	 * @exception (For trains only): AIVehicle::ERR_VEHICLE_NO_POWER
+	 * @exception ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP
+	 * @exception (For aircraft only): ScriptVehicle::ERR_VEHICLE_IN_FLIGHT
+	 * @exception (For trains only): ScriptVehicle::ERR_VEHICLE_NO_POWER
 	 * @return True if and only if the vehicle has been started or stopped.
 	 */
 	static bool StartStopVehicle(VehicleID vehicle_id);
@@ -470,7 +470,7 @@
 	 * @param vehicle_id The vehicle to get the capacity of.
 	 * @param cargo The cargo to get the capacity for.
 	 * @pre IsValidVehicle(vehicle_id).
-	 * @pre AICargo::IsValidCargo(cargo).
+	 * @pre ScriptCargo::IsValidCargo(cargo).
 	 * @return The maximum amount of the given cargo the vehicle can transport.
 	 */
 	static int32 GetCapacity(VehicleID vehicle_id, CargoID cargo);
@@ -489,7 +489,7 @@
 	 * @param vehicle_id The vehicle to get the load amount of.
 	 * @param cargo The cargo to get the load amount for.
 	 * @pre IsValidVehicle(vehicle_id).
-	 * @pre AICargo::IsValidCargo(cargo).
+	 * @pre ScriptCargo::IsValidCargo(cargo).
 	 * @return The amount of the given cargo the vehicle currently transports.
 	 */
 	static int32 GetCargoLoad(VehicleID vehicle_id, CargoID cargo);
--- a/src/script/api/script_vehiclelist.cpp
+++ b/src/script/api/script_vehiclelist.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_vehiclelist.cpp Implementation of AIVehicleList and friends. */
+/** @file script_vehiclelist.cpp Implementation of ScriptVehicleList and friends. */
 
 #include "../../stdafx.h"
 #include "script_vehiclelist.hpp"
@@ -18,7 +18,7 @@
 #include "../../depot_map.h"
 #include "../../vehicle_base.h"
 
-AIVehicleList::AIVehicleList()
+ScriptVehicleList::ScriptVehicleList()
 {
 	const Vehicle *v;
 	FOR_ALL_VEHICLES(v) {
@@ -26,9 +26,9 @@
 	}
 }
 
-AIVehicleList_Station::AIVehicleList_Station(StationID station_id)
+ScriptVehicleList_Station::ScriptVehicleList_Station(StationID station_id)
 {
-	if (!AIBaseStation::IsValidBaseStation(station_id)) return;
+	if (!ScriptBaseStation::IsValidBaseStation(station_id)) return;
 
 	const Vehicle *v;
 	FOR_ALL_VEHICLES(v) {
@@ -45,9 +45,9 @@
 	}
 }
 
-AIVehicleList_Depot::AIVehicleList_Depot(TileIndex tile)
+ScriptVehicleList_Depot::ScriptVehicleList_Depot(TileIndex tile)
 {
-	if (!AIMap::IsValidTile(tile)) return;
+	if (!ScriptMap::IsValidTile(tile)) return;
 
 	DestinationID dest;
 	VehicleType type;
@@ -96,18 +96,18 @@
 	}
 }
 
-AIVehicleList_SharedOrders::AIVehicleList_SharedOrders(VehicleID vehicle_id)
+ScriptVehicleList_SharedOrders::ScriptVehicleList_SharedOrders(VehicleID vehicle_id)
 {
-	if (!AIVehicle::IsValidVehicle(vehicle_id)) return;
+	if (!ScriptVehicle::IsValidVehicle(vehicle_id)) return;
 
 	for (const Vehicle *v = Vehicle::Get(vehicle_id)->FirstShared(); v != NULL; v = v->NextShared()) {
 		this->AddItem(v->index);
 	}
 }
 
-AIVehicleList_Group::AIVehicleList_Group(GroupID group_id)
+ScriptVehicleList_Group::ScriptVehicleList_Group(GroupID group_id)
 {
-	if (!AIGroup::IsValidGroup((AIGroup::GroupID)group_id)) return;
+	if (!ScriptGroup::IsValidGroup((ScriptGroup::GroupID)group_id)) return;
 
 	const Vehicle *v;
 	FOR_ALL_VEHICLES(v) {
@@ -117,14 +117,14 @@
 	}
 }
 
-AIVehicleList_DefaultGroup::AIVehicleList_DefaultGroup(AIVehicle::VehicleType vehicle_type)
+ScriptVehicleList_DefaultGroup::ScriptVehicleList_DefaultGroup(ScriptVehicle::VehicleType vehicle_type)
 {
-	if (vehicle_type < AIVehicle::VT_RAIL || vehicle_type > AIVehicle::VT_AIR) return;
+	if (vehicle_type < ScriptVehicle::VT_RAIL || vehicle_type > ScriptVehicle::VT_AIR) return;
 
 	const Vehicle *v;
 	FOR_ALL_VEHICLES(v) {
 		if (v->owner == _current_company && v->IsPrimaryVehicle()) {
-			if (v->type == vehicle_type && v->group_id == AIGroup::GROUP_DEFAULT) this->AddItem(v->index);
+			if (v->type == vehicle_type && v->group_id == ScriptGroup::GROUP_DEFAULT) this->AddItem(v->index);
 		}
 	}
 }
--- a/src/script/api/script_vehiclelist.hpp
+++ b/src/script/api/script_vehiclelist.hpp
@@ -17,24 +17,24 @@
 
 /**
  * Creates a list of vehicles of which you are the owner.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIVehicleList : public AIList {
+class ScriptVehicleList : public ScriptList {
 public:
-	AIVehicleList();
+	ScriptVehicleList();
 };
 
 /**
  * Creates a list of vehicles that have orders to a given station.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIVehicleList_Station : public AIList {
+class ScriptVehicleList_Station : public ScriptList {
 public:
 	/**
 	 * @param station_id The station to get the list of vehicles from, which have orders to it.
-	 * @pre AIBaseStation::IsValidBaseStation(station_id)
+	 * @pre ScriptBaseStation::IsValidBaseStation(station_id)
 	 */
-	AIVehicleList_Station(StationID station_id);
+	ScriptVehicleList_Station(StationID station_id);
 };
 
 /**
@@ -43,50 +43,50 @@
  * aircraft having a depot order on a hangar of that airport will be
  * returned. For all other vehicle types the tile has to be a depot or
  * an empty list will be returned.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIVehicleList_Depot : public AIList {
+class ScriptVehicleList_Depot : public ScriptList {
 public:
 	/**
 	 * @param tile The tile of the depot to get the list of vehicles from, which have orders to it.
 	 */
-	AIVehicleList_Depot(TileIndex tile);
+	ScriptVehicleList_Depot(TileIndex tile);
 };
 
 /**
  * Creates a list of vehicles that share orders.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIVehicleList_SharedOrders : public AIList {
+class ScriptVehicleList_SharedOrders : public ScriptList {
 public:
 	/**
 	 * @param vehicle_id The vehicle that the rest shared orders with.
 	 */
-	AIVehicleList_SharedOrders(VehicleID vehicle_id);
+	ScriptVehicleList_SharedOrders(VehicleID vehicle_id);
 };
 
 /**
  * Creates a list of vehicles that are in a group.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIVehicleList_Group : public AIList {
+class ScriptVehicleList_Group : public ScriptList {
 public:
 	/**
 	 * @param group_id The ID of the group the vehicles are in.
 	 */
-	AIVehicleList_Group(GroupID group_id);
+	ScriptVehicleList_Group(GroupID group_id);
 };
 
 /**
  * Creates a list of vehicles that are in the default group.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIVehicleList_DefaultGroup : public AIList {
+class ScriptVehicleList_DefaultGroup : public ScriptList {
 public:
 	/**
 	 * @param vehicle_type The VehicleType to get the list of vehicles for.
 	 */
-	AIVehicleList_DefaultGroup(AIVehicle::VehicleType vehicle_type);
+	ScriptVehicleList_DefaultGroup(ScriptVehicle::VehicleType vehicle_type);
 };
 
 #endif /* SCRIPT_VEHICLELIST_HPP */
--- a/src/script/api/script_waypoint.cpp
+++ b/src/script/api/script_waypoint.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_waypoint.cpp Implementation of AIWaypoint. */
+/** @file script_waypoint.cpp Implementation of ScriptWaypoint. */
 
 #include "../../stdafx.h"
 #include "script_waypoint.hpp"
@@ -16,20 +16,20 @@
 #include "../../company_func.h"
 #include "../../waypoint_base.h"
 
-/* static */ bool AIWaypoint::IsValidWaypoint(StationID waypoint_id)
+/* static */ bool ScriptWaypoint::IsValidWaypoint(StationID waypoint_id)
 {
 	const Waypoint *wp = ::Waypoint::GetIfValid(waypoint_id);
 	return wp != NULL && (wp->owner == _current_company || wp->owner == OWNER_NONE);
 }
 
-/* static */ StationID AIWaypoint::GetWaypointID(TileIndex tile)
+/* static */ StationID ScriptWaypoint::GetWaypointID(TileIndex tile)
 {
-	if (!AIRail::IsRailWaypointTile(tile) && !AIMarine::IsBuoyTile(tile)) return STATION_INVALID;
+	if (!ScriptRail::IsRailWaypointTile(tile) && !ScriptMarine::IsBuoyTile(tile)) return STATION_INVALID;
 
 	return ::GetStationIndex(tile);
 }
 
-/* static */ bool AIWaypoint::HasWaypointType(StationID waypoint_id, WaypointType waypoint_type)
+/* static */ bool ScriptWaypoint::HasWaypointType(StationID waypoint_id, WaypointType waypoint_type)
 {
 	if (!IsValidWaypoint(waypoint_id)) return false;
 	if (!HasExactlyOneBit(waypoint_type)) return false;
--- a/src/script/api/script_waypoint.hpp
+++ b/src/script/api/script_waypoint.hpp
@@ -17,7 +17,7 @@
 /**
  * Class that handles all waypoint related functions.
  */
-class AIWaypoint : public AIBaseStation {
+class ScriptWaypoint : public ScriptBaseStation {
 public:
 	/**
 	 * Type of waypoints known in the game.
@@ -34,7 +34,7 @@
 	 */
 	enum ErrorMessages {
 		/** Base for waypoint related errors */
-		ERR_WAYPOINT_BASE = AIError::ERR_CAT_WAYPOINT << AIError::ERR_CAT_BIT_SIZE,
+		ERR_WAYPOINT_BASE = ScriptError::ERR_CAT_WAYPOINT << ScriptError::ERR_CAT_BIT_SIZE,
 
 		/** The waypoint is build too close to another waypoint */
 		ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, // [STR_ERROR_TOO_CLOSE_TO_ANOTHER_WAYPOINT]
@@ -53,7 +53,7 @@
 	/**
 	 * Get the StationID of a tile.
 	 * @param tile The tile to find the StationID of.
-	 * @pre AIRail::IsRailWaypointTile(tile).
+	 * @pre ScriptRail::IsRailWaypointTile(tile).
 	 * @return StationID of the waypoint.
 	 */
 	static StationID GetWaypointID(TileIndex tile);
@@ -67,6 +67,6 @@
 	static bool HasWaypointType(StationID waypoint_id, WaypointType waypoint_type);
 };
 
-DECLARE_ENUM_AS_BIT_SET(AIWaypoint::WaypointType)
+DECLARE_ENUM_AS_BIT_SET(ScriptWaypoint::WaypointType)
 
 #endif /* SCRIPT_WAYPOINT_HPP */
--- a/src/script/api/script_waypointlist.cpp
+++ b/src/script/api/script_waypointlist.cpp
@@ -7,7 +7,7 @@
  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/** @file script_waypointlist.cpp Implementation of AIWaypointList and friends. */
+/** @file script_waypointlist.cpp Implementation of ScriptWaypointList and friends. */
 
 #include "../../stdafx.h"
 #include "script_waypointlist.hpp"
@@ -16,7 +16,7 @@
 #include "../../vehicle_base.h"
 #include "../../waypoint_base.h"
 
-AIWaypointList::AIWaypointList(AIWaypoint::WaypointType waypoint_type)
+ScriptWaypointList::ScriptWaypointList(ScriptWaypoint::WaypointType waypoint_type)
 {
 	const Waypoint *wp;
 	FOR_ALL_WAYPOINTS(wp) {
@@ -25,9 +25,9 @@
 	}
 }
 
-AIWaypointList_Vehicle::AIWaypointList_Vehicle(VehicleID vehicle_id)
+ScriptWaypointList_Vehicle::ScriptWaypointList_Vehicle(VehicleID vehicle_id)
 {
-	if (!AIVehicle::IsValidVehicle(vehicle_id)) return;
+	if (!ScriptVehicle::IsValidVehicle(vehicle_id)) return;
 
 	const Vehicle *v = ::Vehicle::Get(vehicle_id);
 
--- a/src/script/api/script_waypointlist.hpp
+++ b/src/script/api/script_waypointlist.hpp
@@ -17,26 +17,26 @@
 
 /**
  * Creates a list of waypoints of which you are the owner.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIWaypointList : public AIList {
+class ScriptWaypointList : public ScriptList {
 public:
 	/**
 	 * @param waypoint_type The type of waypoint to make a list of waypoints for.
 	 */
-	AIWaypointList(AIWaypoint::WaypointType waypoint_type);
+	ScriptWaypointList(ScriptWaypoint::WaypointType waypoint_type);
 };
 
 /**
  * Creates a list of waypoints which the vehicle has in its orders.
- * @ingroup AIList
+ * @ingroup ScriptList
  */
-class AIWaypointList_Vehicle : public AIList {
+class ScriptWaypointList_Vehicle : public ScriptList {
 public:
 	/**
 	 * @param vehicle_id The vehicle to get the list of waypoints he has in its orders from.
 	 */
-	AIWaypointList_Vehicle(VehicleID vehicle_id);
+	ScriptWaypointList_Vehicle(VehicleID vehicle_id);
 };
 
 #endif /* SCRIPT_WAYPOINTLIST_HPP */
--- a/src/script/squirrel.hpp
+++ b/src/script/squirrel.hpp
@@ -69,7 +69,7 @@
 public:
 	friend class AIScanner;
 	friend class AIInstance;
-	friend class AIController;
+	friend class ScriptController;
 	friend void squirrel_register_std(Squirrel *engine);
 
 	Squirrel(const char *APIName);
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -379,7 +379,7 @@
 			v->index,
 			st->index
 		);
-		AI::NewEvent(v->owner, new AIEventStationFirstVehicle(st->index, v->index));
+		AI::NewEvent(v->owner, new ScriptEventStationFirstVehicle(st->index, v->index));
 	}
 }
 
--- a/src/subsidy.cpp
+++ b/src/subsidy.cpp
@@ -57,7 +57,7 @@
 		(NewsReferenceType)reftype.a, this->src, (NewsReferenceType)reftype.b, this->dst,
 		cn
 	);
-	AI::BroadcastNewEvent(new AIEventSubsidyAwarded(this->index));
+	AI::BroadcastNewEvent(new ScriptEventSubsidyAwarded(this->index));
 
 	InvalidateWindowData(WC_SUBSIDIES_LIST, 0);
 }
@@ -274,13 +274,13 @@
 			if (!s->IsAwarded()) {
 				Pair reftype = SetupSubsidyDecodeParam(s, true);
 				AddNewsItem(STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED, NS_SUBSIDIES, (NewsReferenceType)reftype.a, s->src, (NewsReferenceType)reftype.b, s->dst);
-				AI::BroadcastNewEvent(new AIEventSubsidyOfferExpired(s->index));
+				AI::BroadcastNewEvent(new ScriptEventSubsidyOfferExpired(s->index));
 			} else {
 				if (s->awarded == _local_company) {
 					Pair reftype = SetupSubsidyDecodeParam(s, true);
 					AddNewsItem(STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE, NS_SUBSIDIES, (NewsReferenceType)reftype.a, s->src, (NewsReferenceType)reftype.b, s->dst);
 				}
-				AI::BroadcastNewEvent(new AIEventSubsidyExpired(s->index));
+				AI::BroadcastNewEvent(new ScriptEventSubsidyExpired(s->index));
 			}
 			delete s;
 			modified = true;
@@ -302,7 +302,7 @@
 				AddNewsItem(STR_NEWS_SERVICE_SUBSIDY_OFFERED, NS_SUBSIDIES, (NewsReferenceType)reftype.a, s->src, (NewsReferenceType)reftype.b, s->dst);
 				SetPartOfSubsidyFlag(s->src_type, s->src, POS_SRC);
 				SetPartOfSubsidyFlag(s->dst_type, s->dst, POS_DST);
-				AI::BroadcastNewEvent(new AIEventSubsidyOffer(s->index));
+				AI::BroadcastNewEvent(new ScriptEventSubsidyOffer(s->index));
 				modified = true;
 				break;
 			}
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1616,7 +1616,7 @@
 			SetDParam(1, t->index);
 
 			AddNewsItem(STR_NEWS_NEW_TOWN, NS_INDUSTRY_OPEN, NR_TILE, tile, NR_NONE, UINT32_MAX, cn);
-			AI::BroadcastNewEvent(new AIEventTownFounded(t->index));
+			AI::BroadcastNewEvent(new ScriptEventTownFounded(t->index));
 		}
 	}
 	return cost;
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2711,7 +2711,7 @@
 			v->index,
 			st->index
 		);
-		AI::NewEvent(v->owner, new AIEventStationFirstVehicle(st->index, v->index));
+		AI::NewEvent(v->owner, new ScriptEventStationFirstVehicle(st->index, v->index));
 	}
 
 	v->force_proceed = TFP_NONE;
@@ -2837,7 +2837,7 @@
 	/* do not crash train twice */
 	if (!(v->vehstatus & VS_CRASHED)) {
 		num = v->Crash();
-		AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile, AIEventVehicleCrashed::CRASH_TRAIN));
+		AI::NewEvent(v->owner, new ScriptEventVehicleCrashed(v->index, v->tile, ScriptEventVehicleCrashed::CRASH_TRAIN));
 	}
 
 	/* Try to re-reserve track under already crashed train too.
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -703,7 +703,7 @@
 	/* It is first time the problem occurred, set the "lost" flag. */
 	SetBit(this->vehicle_flags, VF_PATHFINDER_LOST);
 	/* Notify user about the event. */
-	AI::NewEvent(this->owner, new AIEventVehicleLost(this->index));
+	AI::NewEvent(this->owner, new ScriptEventVehicleLost(this->index));
 	if (_settings_client.gui.lost_vehicle_warn && this->owner == _local_company) {
 		SetDParam(0, this->index);
 		AddVehicleNewsItem(STR_NEWS_VEHICLE_IS_LOST, NS_ADVICE, this->index);
@@ -1380,7 +1380,7 @@
 				SetDParam(0, v->index);
 				AddVehicleNewsItem(STR_NEWS_TRAIN_IS_WAITING + v->type, NS_ADVICE, v->index);
 			}
-			AI::NewEvent(v->owner, new AIEventVehicleWaitingInDepot(v->index));
+			AI::NewEvent(v->owner, new ScriptEventVehicleWaitingInDepot(v->index));
 		}
 	}
 }
@@ -2389,7 +2389,7 @@
 						v->index
 					);
 				}
-				AI::NewEvent(v->owner, new AIEventVehicleUnprofitable(v->index));
+				AI::NewEvent(v->owner, new ScriptEventVehicleUnprofitable(v->index));
 			}
 
 			v->profit_last_year = v->profit_this_year;
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -844,7 +844,7 @@
 {
 	uint pass = v->Crash(true);
 
-	AI::NewEvent(v->owner, new AIEventVehicleCrashed(v->index, v->tile, AIEventVehicleCrashed::CRASH_FLOODED));
+	AI::NewEvent(v->owner, new ScriptEventVehicleCrashed(v->index, v->tile, ScriptEventVehicleCrashed::CRASH_FLOODED));
 	SetDParam(0, pass);
 	AddVehicleNewsItem(STR_NEWS_DISASTER_FLOOD_VEHICLE, NS_ACCIDENT, v->index);
 	CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);