Merge branch 'multiple_docks' into jgrpp
This commit is contained in:
		@@ -333,6 +333,7 @@
 | 
				
			|||||||
    <ClCompile Include="..\src\departures.cpp" />
 | 
					    <ClCompile Include="..\src\departures.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\depot.cpp" />
 | 
					    <ClCompile Include="..\src\depot.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\disaster_vehicle.cpp" />
 | 
					    <ClCompile Include="..\src\disaster_vehicle.cpp" />
 | 
				
			||||||
 | 
					    <ClCompile Include="..\src\dock.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\driver.cpp" />
 | 
					    <ClCompile Include="..\src\driver.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\economy.cpp" />
 | 
					    <ClCompile Include="..\src\economy.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\effectvehicle.cpp" />
 | 
					    <ClCompile Include="..\src\effectvehicle.cpp" />
 | 
				
			||||||
@@ -469,6 +470,7 @@
 | 
				
			|||||||
    <ClInclude Include="..\src\direction_type.h" />
 | 
					    <ClInclude Include="..\src\direction_type.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\disaster_vehicle.h" />
 | 
					    <ClInclude Include="..\src\disaster_vehicle.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\music\dmusic.h" />
 | 
					    <ClInclude Include="..\src\music\dmusic.h" />
 | 
				
			||||||
 | 
					    <ClInclude Include="..\src\dock_base.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\driver.h" />
 | 
					    <ClInclude Include="..\src\driver.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\economy_base.h" />
 | 
					    <ClInclude Include="..\src\economy_base.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\economy_func.h" />
 | 
					    <ClInclude Include="..\src\economy_func.h" />
 | 
				
			||||||
@@ -610,6 +612,7 @@
 | 
				
			|||||||
    <ClInclude Include="..\src\sdl.h" />
 | 
					    <ClInclude Include="..\src\sdl.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\sound\sdl_s.h" />
 | 
					    <ClInclude Include="..\src\sound\sdl_s.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\video\sdl_v.h" />
 | 
					    <ClInclude Include="..\src\video\sdl_v.h" />
 | 
				
			||||||
 | 
					    <ClInclude Include="..\src\schdispatch.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\settings_func.h" />
 | 
					    <ClInclude Include="..\src\settings_func.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\settings_gui.h" />
 | 
					    <ClInclude Include="..\src\settings_gui.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\settings_internal.h" />
 | 
					    <ClInclude Include="..\src\settings_internal.h" />
 | 
				
			||||||
@@ -641,6 +644,7 @@
 | 
				
			|||||||
    <ClInclude Include="..\src\strgen\strgen.h" />
 | 
					    <ClInclude Include="..\src\strgen\strgen.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\string_base.h" />
 | 
					    <ClInclude Include="..\src\string_base.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\string_func.h" />
 | 
					    <ClInclude Include="..\src\string_func.h" />
 | 
				
			||||||
 | 
					    <ClInclude Include="..\src\string_func_extra.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\string_type.h" />
 | 
					    <ClInclude Include="..\src\string_type.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\stringfilter_type.h" />
 | 
					    <ClInclude Include="..\src\stringfilter_type.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\strings_func.h" />
 | 
					    <ClInclude Include="..\src\strings_func.h" />
 | 
				
			||||||
@@ -771,6 +775,7 @@
 | 
				
			|||||||
    <ClCompile Include="..\src\rail_gui.cpp" />
 | 
					    <ClCompile Include="..\src\rail_gui.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\road_gui.cpp" />
 | 
					    <ClCompile Include="..\src\road_gui.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\roadveh_gui.cpp" />
 | 
					    <ClCompile Include="..\src\roadveh_gui.cpp" />
 | 
				
			||||||
 | 
					    <ClCompile Include="..\src\schdispatch_gui.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\settings_gui.cpp" />
 | 
					    <ClCompile Include="..\src\settings_gui.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\ship_gui.cpp" />
 | 
					    <ClCompile Include="..\src\ship_gui.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\signs_gui.cpp" />
 | 
					    <ClCompile Include="..\src\signs_gui.cpp" />
 | 
				
			||||||
@@ -864,6 +869,7 @@
 | 
				
			|||||||
    <ClCompile Include="..\src\rail_cmd.cpp" />
 | 
					    <ClCompile Include="..\src\rail_cmd.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\road_cmd.cpp" />
 | 
					    <ClCompile Include="..\src\road_cmd.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\roadveh_cmd.cpp" />
 | 
					    <ClCompile Include="..\src\roadveh_cmd.cpp" />
 | 
				
			||||||
 | 
					    <ClCompile Include="..\src\schdispatch_cmd.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\ship_cmd.cpp" />
 | 
					    <ClCompile Include="..\src\ship_cmd.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\signs_cmd.cpp" />
 | 
					    <ClCompile Include="..\src\signs_cmd.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\station_cmd.cpp" />
 | 
					    <ClCompile Include="..\src\station_cmd.cpp" />
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -195,6 +195,9 @@
 | 
				
			|||||||
    <ClCompile Include="..\src\disaster_vehicle.cpp">
 | 
					    <ClCompile Include="..\src\disaster_vehicle.cpp">
 | 
				
			||||||
      <Filter>Source Files</Filter>
 | 
					      <Filter>Source Files</Filter>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
 | 
					    <ClCompile Include="..\src\dock.cpp">
 | 
				
			||||||
 | 
					      <Filter>Source Files</Filter>
 | 
				
			||||||
 | 
					    </ClCompile>
 | 
				
			||||||
    <ClCompile Include="..\src\driver.cpp">
 | 
					    <ClCompile Include="..\src\driver.cpp">
 | 
				
			||||||
      <Filter>Source Files</Filter>
 | 
					      <Filter>Source Files</Filter>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
@@ -603,6 +606,9 @@
 | 
				
			|||||||
    <ClInclude Include="..\src\music\dmusic.h">
 | 
					    <ClInclude Include="..\src\music\dmusic.h">
 | 
				
			||||||
      <Filter>Header Files</Filter>
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
    </ClInclude>
 | 
					    </ClInclude>
 | 
				
			||||||
 | 
					    <ClInclude Include="..\src\dock_base.h">
 | 
				
			||||||
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
 | 
					    </ClInclude>
 | 
				
			||||||
    <ClInclude Include="..\src\driver.h">
 | 
					    <ClInclude Include="..\src\driver.h">
 | 
				
			||||||
      <Filter>Header Files</Filter>
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
    </ClInclude>
 | 
					    </ClInclude>
 | 
				
			||||||
@@ -1026,6 +1032,9 @@
 | 
				
			|||||||
    <ClInclude Include="..\src\video\sdl_v.h">
 | 
					    <ClInclude Include="..\src\video\sdl_v.h">
 | 
				
			||||||
      <Filter>Header Files</Filter>
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
    </ClInclude>
 | 
					    </ClInclude>
 | 
				
			||||||
 | 
					    <ClInclude Include="..\src\schdispatch.h">
 | 
				
			||||||
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
 | 
					    </ClInclude>
 | 
				
			||||||
    <ClInclude Include="..\src\settings_func.h">
 | 
					    <ClInclude Include="..\src\settings_func.h">
 | 
				
			||||||
      <Filter>Header Files</Filter>
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
    </ClInclude>
 | 
					    </ClInclude>
 | 
				
			||||||
@@ -1119,6 +1128,9 @@
 | 
				
			|||||||
    <ClInclude Include="..\src\string_func.h">
 | 
					    <ClInclude Include="..\src\string_func.h">
 | 
				
			||||||
      <Filter>Header Files</Filter>
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
    </ClInclude>
 | 
					    </ClInclude>
 | 
				
			||||||
 | 
					    <ClInclude Include="..\src\string_func_extra.h">
 | 
				
			||||||
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
 | 
					    </ClInclude>
 | 
				
			||||||
    <ClInclude Include="..\src\string_type.h">
 | 
					    <ClInclude Include="..\src\string_type.h">
 | 
				
			||||||
      <Filter>Header Files</Filter>
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
    </ClInclude>
 | 
					    </ClInclude>
 | 
				
			||||||
@@ -1509,6 +1521,9 @@
 | 
				
			|||||||
    <ClCompile Include="..\src\roadveh_gui.cpp">
 | 
					    <ClCompile Include="..\src\roadveh_gui.cpp">
 | 
				
			||||||
      <Filter>GUI Source Code</Filter>
 | 
					      <Filter>GUI Source Code</Filter>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
 | 
					    <ClCompile Include="..\src\schdispatch_gui.cpp">
 | 
				
			||||||
 | 
					      <Filter>GUI Source Code</Filter>
 | 
				
			||||||
 | 
					    </ClCompile>
 | 
				
			||||||
    <ClCompile Include="..\src\settings_gui.cpp">
 | 
					    <ClCompile Include="..\src\settings_gui.cpp">
 | 
				
			||||||
      <Filter>GUI Source Code</Filter>
 | 
					      <Filter>GUI Source Code</Filter>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
@@ -1788,6 +1803,9 @@
 | 
				
			|||||||
    <ClCompile Include="..\src\roadveh_cmd.cpp">
 | 
					    <ClCompile Include="..\src\roadveh_cmd.cpp">
 | 
				
			||||||
      <Filter>Command handlers</Filter>
 | 
					      <Filter>Command handlers</Filter>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
 | 
					    <ClCompile Include="..\src\schdispatch_cmd.cpp">
 | 
				
			||||||
 | 
					      <Filter>Command handlers</Filter>
 | 
				
			||||||
 | 
					    </ClCompile>
 | 
				
			||||||
    <ClCompile Include="..\src\ship_cmd.cpp">
 | 
					    <ClCompile Include="..\src\ship_cmd.cpp">
 | 
				
			||||||
      <Filter>Command handlers</Filter>
 | 
					      <Filter>Command handlers</Filter>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -350,6 +350,7 @@
 | 
				
			|||||||
    <ClCompile Include="..\src\departures.cpp" />
 | 
					    <ClCompile Include="..\src\departures.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\depot.cpp" />
 | 
					    <ClCompile Include="..\src\depot.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\disaster_vehicle.cpp" />
 | 
					    <ClCompile Include="..\src\disaster_vehicle.cpp" />
 | 
				
			||||||
 | 
					    <ClCompile Include="..\src\dock.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\driver.cpp" />
 | 
					    <ClCompile Include="..\src\driver.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\economy.cpp" />
 | 
					    <ClCompile Include="..\src\economy.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\effectvehicle.cpp" />
 | 
					    <ClCompile Include="..\src\effectvehicle.cpp" />
 | 
				
			||||||
@@ -486,6 +487,7 @@
 | 
				
			|||||||
    <ClInclude Include="..\src\direction_type.h" />
 | 
					    <ClInclude Include="..\src\direction_type.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\disaster_vehicle.h" />
 | 
					    <ClInclude Include="..\src\disaster_vehicle.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\music\dmusic.h" />
 | 
					    <ClInclude Include="..\src\music\dmusic.h" />
 | 
				
			||||||
 | 
					    <ClInclude Include="..\src\dock_base.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\driver.h" />
 | 
					    <ClInclude Include="..\src\driver.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\economy_base.h" />
 | 
					    <ClInclude Include="..\src\economy_base.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\economy_func.h" />
 | 
					    <ClInclude Include="..\src\economy_func.h" />
 | 
				
			||||||
@@ -627,6 +629,7 @@
 | 
				
			|||||||
    <ClInclude Include="..\src\sdl.h" />
 | 
					    <ClInclude Include="..\src\sdl.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\sound\sdl_s.h" />
 | 
					    <ClInclude Include="..\src\sound\sdl_s.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\video\sdl_v.h" />
 | 
					    <ClInclude Include="..\src\video\sdl_v.h" />
 | 
				
			||||||
 | 
					    <ClInclude Include="..\src\schdispatch.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\settings_func.h" />
 | 
					    <ClInclude Include="..\src\settings_func.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\settings_gui.h" />
 | 
					    <ClInclude Include="..\src\settings_gui.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\settings_internal.h" />
 | 
					    <ClInclude Include="..\src\settings_internal.h" />
 | 
				
			||||||
@@ -658,6 +661,7 @@
 | 
				
			|||||||
    <ClInclude Include="..\src\strgen\strgen.h" />
 | 
					    <ClInclude Include="..\src\strgen\strgen.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\string_base.h" />
 | 
					    <ClInclude Include="..\src\string_base.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\string_func.h" />
 | 
					    <ClInclude Include="..\src\string_func.h" />
 | 
				
			||||||
 | 
					    <ClInclude Include="..\src\string_func_extra.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\string_type.h" />
 | 
					    <ClInclude Include="..\src\string_type.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\stringfilter_type.h" />
 | 
					    <ClInclude Include="..\src\stringfilter_type.h" />
 | 
				
			||||||
    <ClInclude Include="..\src\strings_func.h" />
 | 
					    <ClInclude Include="..\src\strings_func.h" />
 | 
				
			||||||
@@ -788,6 +792,7 @@
 | 
				
			|||||||
    <ClCompile Include="..\src\rail_gui.cpp" />
 | 
					    <ClCompile Include="..\src\rail_gui.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\road_gui.cpp" />
 | 
					    <ClCompile Include="..\src\road_gui.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\roadveh_gui.cpp" />
 | 
					    <ClCompile Include="..\src\roadveh_gui.cpp" />
 | 
				
			||||||
 | 
					    <ClCompile Include="..\src\schdispatch_gui.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\settings_gui.cpp" />
 | 
					    <ClCompile Include="..\src\settings_gui.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\ship_gui.cpp" />
 | 
					    <ClCompile Include="..\src\ship_gui.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\signs_gui.cpp" />
 | 
					    <ClCompile Include="..\src\signs_gui.cpp" />
 | 
				
			||||||
@@ -881,6 +886,7 @@
 | 
				
			|||||||
    <ClCompile Include="..\src\rail_cmd.cpp" />
 | 
					    <ClCompile Include="..\src\rail_cmd.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\road_cmd.cpp" />
 | 
					    <ClCompile Include="..\src\road_cmd.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\roadveh_cmd.cpp" />
 | 
					    <ClCompile Include="..\src\roadveh_cmd.cpp" />
 | 
				
			||||||
 | 
					    <ClCompile Include="..\src\schdispatch_cmd.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\ship_cmd.cpp" />
 | 
					    <ClCompile Include="..\src\ship_cmd.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\signs_cmd.cpp" />
 | 
					    <ClCompile Include="..\src\signs_cmd.cpp" />
 | 
				
			||||||
    <ClCompile Include="..\src\station_cmd.cpp" />
 | 
					    <ClCompile Include="..\src\station_cmd.cpp" />
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -195,6 +195,9 @@
 | 
				
			|||||||
    <ClCompile Include="..\src\disaster_vehicle.cpp">
 | 
					    <ClCompile Include="..\src\disaster_vehicle.cpp">
 | 
				
			||||||
      <Filter>Source Files</Filter>
 | 
					      <Filter>Source Files</Filter>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
 | 
					    <ClCompile Include="..\src\dock.cpp">
 | 
				
			||||||
 | 
					      <Filter>Source Files</Filter>
 | 
				
			||||||
 | 
					    </ClCompile>
 | 
				
			||||||
    <ClCompile Include="..\src\driver.cpp">
 | 
					    <ClCompile Include="..\src\driver.cpp">
 | 
				
			||||||
      <Filter>Source Files</Filter>
 | 
					      <Filter>Source Files</Filter>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
@@ -603,6 +606,9 @@
 | 
				
			|||||||
    <ClInclude Include="..\src\music\dmusic.h">
 | 
					    <ClInclude Include="..\src\music\dmusic.h">
 | 
				
			||||||
      <Filter>Header Files</Filter>
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
    </ClInclude>
 | 
					    </ClInclude>
 | 
				
			||||||
 | 
					    <ClInclude Include="..\src\dock_base.h">
 | 
				
			||||||
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
 | 
					    </ClInclude>
 | 
				
			||||||
    <ClInclude Include="..\src\driver.h">
 | 
					    <ClInclude Include="..\src\driver.h">
 | 
				
			||||||
      <Filter>Header Files</Filter>
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
    </ClInclude>
 | 
					    </ClInclude>
 | 
				
			||||||
@@ -1026,6 +1032,9 @@
 | 
				
			|||||||
    <ClInclude Include="..\src\video\sdl_v.h">
 | 
					    <ClInclude Include="..\src\video\sdl_v.h">
 | 
				
			||||||
      <Filter>Header Files</Filter>
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
    </ClInclude>
 | 
					    </ClInclude>
 | 
				
			||||||
 | 
					    <ClInclude Include="..\src\schdispatch.h">
 | 
				
			||||||
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
 | 
					    </ClInclude>
 | 
				
			||||||
    <ClInclude Include="..\src\settings_func.h">
 | 
					    <ClInclude Include="..\src\settings_func.h">
 | 
				
			||||||
      <Filter>Header Files</Filter>
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
    </ClInclude>
 | 
					    </ClInclude>
 | 
				
			||||||
@@ -1119,6 +1128,9 @@
 | 
				
			|||||||
    <ClInclude Include="..\src\string_func.h">
 | 
					    <ClInclude Include="..\src\string_func.h">
 | 
				
			||||||
      <Filter>Header Files</Filter>
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
    </ClInclude>
 | 
					    </ClInclude>
 | 
				
			||||||
 | 
					    <ClInclude Include="..\src\string_func_extra.h">
 | 
				
			||||||
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
 | 
					    </ClInclude>
 | 
				
			||||||
    <ClInclude Include="..\src\string_type.h">
 | 
					    <ClInclude Include="..\src\string_type.h">
 | 
				
			||||||
      <Filter>Header Files</Filter>
 | 
					      <Filter>Header Files</Filter>
 | 
				
			||||||
    </ClInclude>
 | 
					    </ClInclude>
 | 
				
			||||||
@@ -1509,6 +1521,9 @@
 | 
				
			|||||||
    <ClCompile Include="..\src\roadveh_gui.cpp">
 | 
					    <ClCompile Include="..\src\roadveh_gui.cpp">
 | 
				
			||||||
      <Filter>GUI Source Code</Filter>
 | 
					      <Filter>GUI Source Code</Filter>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
 | 
					    <ClCompile Include="..\src\schdispatch_gui.cpp">
 | 
				
			||||||
 | 
					      <Filter>GUI Source Code</Filter>
 | 
				
			||||||
 | 
					    </ClCompile>
 | 
				
			||||||
    <ClCompile Include="..\src\settings_gui.cpp">
 | 
					    <ClCompile Include="..\src\settings_gui.cpp">
 | 
				
			||||||
      <Filter>GUI Source Code</Filter>
 | 
					      <Filter>GUI Source Code</Filter>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
@@ -1788,6 +1803,9 @@
 | 
				
			|||||||
    <ClCompile Include="..\src\roadveh_cmd.cpp">
 | 
					    <ClCompile Include="..\src\roadveh_cmd.cpp">
 | 
				
			||||||
      <Filter>Command handlers</Filter>
 | 
					      <Filter>Command handlers</Filter>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
 | 
					    <ClCompile Include="..\src\schdispatch_cmd.cpp">
 | 
				
			||||||
 | 
					      <Filter>Command handlers</Filter>
 | 
				
			||||||
 | 
					    </ClCompile>
 | 
				
			||||||
    <ClCompile Include="..\src\ship_cmd.cpp">
 | 
					    <ClCompile Include="..\src\ship_cmd.cpp">
 | 
				
			||||||
      <Filter>Command handlers</Filter>
 | 
					      <Filter>Command handlers</Filter>
 | 
				
			||||||
    </ClCompile>
 | 
					    </ClCompile>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -554,6 +554,10 @@
 | 
				
			|||||||
				RelativePath=".\..\src\disaster_vehicle.cpp"
 | 
									RelativePath=".\..\src\disaster_vehicle.cpp"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
			</File>
 | 
								</File>
 | 
				
			||||||
 | 
								<File
 | 
				
			||||||
 | 
									RelativePath=".\..\src\dock.cpp"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
								</File>
 | 
				
			||||||
			<File
 | 
								<File
 | 
				
			||||||
				RelativePath=".\..\src\driver.cpp"
 | 
									RelativePath=".\..\src\driver.cpp"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
@@ -1102,6 +1106,10 @@
 | 
				
			|||||||
				RelativePath=".\..\src\music\dmusic.h"
 | 
									RelativePath=".\..\src\music\dmusic.h"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
			</File>
 | 
								</File>
 | 
				
			||||||
 | 
								<File
 | 
				
			||||||
 | 
									RelativePath=".\..\src\dock_base.h"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
								</File>
 | 
				
			||||||
			<File
 | 
								<File
 | 
				
			||||||
				RelativePath=".\..\src\driver.h"
 | 
									RelativePath=".\..\src\driver.h"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
@@ -1666,6 +1674,10 @@
 | 
				
			|||||||
				RelativePath=".\..\src\video\sdl_v.h"
 | 
									RelativePath=".\..\src\video\sdl_v.h"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
			</File>
 | 
								</File>
 | 
				
			||||||
 | 
								<File
 | 
				
			||||||
 | 
									RelativePath=".\..\src\schdispatch.h"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
								</File>
 | 
				
			||||||
			<File
 | 
								<File
 | 
				
			||||||
				RelativePath=".\..\src\settings_func.h"
 | 
									RelativePath=".\..\src\settings_func.h"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
@@ -1790,6 +1802,10 @@
 | 
				
			|||||||
				RelativePath=".\..\src\string_func.h"
 | 
									RelativePath=".\..\src\string_func.h"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
			</File>
 | 
								</File>
 | 
				
			||||||
 | 
								<File
 | 
				
			||||||
 | 
									RelativePath=".\..\src\string_func_extra.h"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
								</File>
 | 
				
			||||||
			<File
 | 
								<File
 | 
				
			||||||
				RelativePath=".\..\src\string_type.h"
 | 
									RelativePath=".\..\src\string_type.h"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
@@ -2318,6 +2334,10 @@
 | 
				
			|||||||
				RelativePath=".\..\src\roadveh_gui.cpp"
 | 
									RelativePath=".\..\src\roadveh_gui.cpp"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
			</File>
 | 
								</File>
 | 
				
			||||||
 | 
								<File
 | 
				
			||||||
 | 
									RelativePath=".\..\src\schdispatch_gui.cpp"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
								</File>
 | 
				
			||||||
			<File
 | 
								<File
 | 
				
			||||||
				RelativePath=".\..\src\settings_gui.cpp"
 | 
									RelativePath=".\..\src\settings_gui.cpp"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
@@ -2698,6 +2718,10 @@
 | 
				
			|||||||
				RelativePath=".\..\src\roadveh_cmd.cpp"
 | 
									RelativePath=".\..\src\roadveh_cmd.cpp"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
			</File>
 | 
								</File>
 | 
				
			||||||
 | 
								<File
 | 
				
			||||||
 | 
									RelativePath=".\..\src\schdispatch_cmd.cpp"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
								</File>
 | 
				
			||||||
			<File
 | 
								<File
 | 
				
			||||||
				RelativePath=".\..\src\ship_cmd.cpp"
 | 
									RelativePath=".\..\src\ship_cmd.cpp"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -551,6 +551,10 @@
 | 
				
			|||||||
				RelativePath=".\..\src\disaster_vehicle.cpp"
 | 
									RelativePath=".\..\src\disaster_vehicle.cpp"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
			</File>
 | 
								</File>
 | 
				
			||||||
 | 
								<File
 | 
				
			||||||
 | 
									RelativePath=".\..\src\dock.cpp"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
								</File>
 | 
				
			||||||
			<File
 | 
								<File
 | 
				
			||||||
				RelativePath=".\..\src\driver.cpp"
 | 
									RelativePath=".\..\src\driver.cpp"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
@@ -1099,6 +1103,10 @@
 | 
				
			|||||||
				RelativePath=".\..\src\music\dmusic.h"
 | 
									RelativePath=".\..\src\music\dmusic.h"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
			</File>
 | 
								</File>
 | 
				
			||||||
 | 
								<File
 | 
				
			||||||
 | 
									RelativePath=".\..\src\dock_base.h"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
								</File>
 | 
				
			||||||
			<File
 | 
								<File
 | 
				
			||||||
				RelativePath=".\..\src\driver.h"
 | 
									RelativePath=".\..\src\driver.h"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
@@ -1663,6 +1671,10 @@
 | 
				
			|||||||
				RelativePath=".\..\src\video\sdl_v.h"
 | 
									RelativePath=".\..\src\video\sdl_v.h"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
			</File>
 | 
								</File>
 | 
				
			||||||
 | 
								<File
 | 
				
			||||||
 | 
									RelativePath=".\..\src\schdispatch.h"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
								</File>
 | 
				
			||||||
			<File
 | 
								<File
 | 
				
			||||||
				RelativePath=".\..\src\settings_func.h"
 | 
									RelativePath=".\..\src\settings_func.h"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
@@ -1787,6 +1799,10 @@
 | 
				
			|||||||
				RelativePath=".\..\src\string_func.h"
 | 
									RelativePath=".\..\src\string_func.h"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
			</File>
 | 
								</File>
 | 
				
			||||||
 | 
								<File
 | 
				
			||||||
 | 
									RelativePath=".\..\src\string_func_extra.h"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
								</File>
 | 
				
			||||||
			<File
 | 
								<File
 | 
				
			||||||
				RelativePath=".\..\src\string_type.h"
 | 
									RelativePath=".\..\src\string_type.h"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
@@ -2315,6 +2331,10 @@
 | 
				
			|||||||
				RelativePath=".\..\src\roadveh_gui.cpp"
 | 
									RelativePath=".\..\src\roadveh_gui.cpp"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
			</File>
 | 
								</File>
 | 
				
			||||||
 | 
								<File
 | 
				
			||||||
 | 
									RelativePath=".\..\src\schdispatch_gui.cpp"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
								</File>
 | 
				
			||||||
			<File
 | 
								<File
 | 
				
			||||||
				RelativePath=".\..\src\settings_gui.cpp"
 | 
									RelativePath=".\..\src\settings_gui.cpp"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
@@ -2695,6 +2715,10 @@
 | 
				
			|||||||
				RelativePath=".\..\src\roadveh_cmd.cpp"
 | 
									RelativePath=".\..\src\roadveh_cmd.cpp"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
			</File>
 | 
								</File>
 | 
				
			||||||
 | 
								<File
 | 
				
			||||||
 | 
									RelativePath=".\..\src\schdispatch_cmd.cpp"
 | 
				
			||||||
 | 
									>
 | 
				
			||||||
 | 
								</File>
 | 
				
			||||||
			<File
 | 
								<File
 | 
				
			||||||
				RelativePath=".\..\src\ship_cmd.cpp"
 | 
									RelativePath=".\..\src\ship_cmd.cpp"
 | 
				
			||||||
				>
 | 
									>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,6 +30,7 @@ dedicated.cpp
 | 
				
			|||||||
departures.cpp
 | 
					departures.cpp
 | 
				
			||||||
depot.cpp
 | 
					depot.cpp
 | 
				
			||||||
disaster_vehicle.cpp
 | 
					disaster_vehicle.cpp
 | 
				
			||||||
 | 
					dock.cpp
 | 
				
			||||||
driver.cpp
 | 
					driver.cpp
 | 
				
			||||||
economy.cpp
 | 
					economy.cpp
 | 
				
			||||||
effectvehicle.cpp
 | 
					effectvehicle.cpp
 | 
				
			||||||
@@ -197,6 +198,7 @@ direction_func.h
 | 
				
			|||||||
direction_type.h
 | 
					direction_type.h
 | 
				
			||||||
disaster_vehicle.h
 | 
					disaster_vehicle.h
 | 
				
			||||||
music/dmusic.h
 | 
					music/dmusic.h
 | 
				
			||||||
 | 
					dock_base.h
 | 
				
			||||||
driver.h
 | 
					driver.h
 | 
				
			||||||
economy_base.h
 | 
					economy_base.h
 | 
				
			||||||
economy_func.h
 | 
					economy_func.h
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -156,6 +156,16 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
 | 
				
			|||||||
		return (this->facilities & ~FACIL_WAYPOINT) != 0;
 | 
							return (this->facilities & ~FACIL_WAYPOINT) != 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Check whether the base station has given facilities.
 | 
				
			||||||
 | 
						 * @param facilities The facilities to check.
 | 
				
			||||||
 | 
						 * @return True if station has at least one of the given \a facilities.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						inline bool HasFacilities(StationFacility facilities) const
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return (this->facilities & facilities) != 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static void PostDestructor(size_t index);
 | 
						static void PostDestructor(size_t index);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										37
									
								
								src/dock.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								src/dock.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					/* $Id: dock.cpp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					* This file is part of OpenTTD.
 | 
				
			||||||
 | 
					* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 | 
				
			||||||
 | 
					* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 | 
				
			||||||
 | 
					* 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 dock.cpp Implementation of the dock base class. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "stdafx.h"
 | 
				
			||||||
 | 
					#include "core/pool_func.hpp"
 | 
				
			||||||
 | 
					#include "dock_base.h"
 | 
				
			||||||
 | 
					#include "station_base.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** The pool of docks. */
 | 
				
			||||||
 | 
					DockPool _dock_pool("Dock");
 | 
				
			||||||
 | 
					INSTANTIATE_POOL_METHODS(Dock)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					* Find a dock at a given tile.
 | 
				
			||||||
 | 
					* @param tile Tile with a dock.
 | 
				
			||||||
 | 
					* @return The dock in the given tile.
 | 
				
			||||||
 | 
					* @pre IsDockTile()
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					/* static */ Dock *Dock::GetByTile(TileIndex tile)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						const Station *st = Station::GetByTile(tile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (Dock *d = st->GetPrimaryDock();; d = d->next) {
 | 
				
			||||||
 | 
							if (d->sloped == tile || d->flat == tile) return d;
 | 
				
			||||||
 | 
							assert(d->next != NULL);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						NOT_REACHED();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										40
									
								
								src/dock_base.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								src/dock_base.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					/* $Id: dock_base.h $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					* This file is part of OpenTTD.
 | 
				
			||||||
 | 
					* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 | 
				
			||||||
 | 
					* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 | 
				
			||||||
 | 
					* 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 dock_base.h Base class for docks. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef DOCK_BASE_H
 | 
				
			||||||
 | 
					#define DOCK_BASE_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "station_type.h"
 | 
				
			||||||
 | 
					#include "tile_type.h"
 | 
				
			||||||
 | 
					#include "core/pool_type.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef Pool<Dock, DockID, 32, 64000> DockPool;
 | 
				
			||||||
 | 
					extern DockPool _dock_pool;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** A Dock structure. */
 | 
				
			||||||
 | 
					struct Dock : DockPool::PoolItem<&_dock_pool> {
 | 
				
			||||||
 | 
						TileIndex sloped; ///< The sloped tile of the dock.
 | 
				
			||||||
 | 
						TileIndex flat;   ///< Position on the map of the flat tile.
 | 
				
			||||||
 | 
						Dock *next;       ///< Next dock of the given type at this station.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Dock(TileIndex s = INVALID_TILE, TileIndex f = INVALID_TILE) : sloped(s), flat(f), next(NULL) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						~Dock() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						inline Dock *GetNextDock() const { return this->next; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						static Dock *GetByTile(TileIndex tile);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define FOR_ALL_DOCKS_FROM(var, start) FOR_ALL_ITEMS_FROM(Dock, dock_index, var, start)
 | 
				
			||||||
 | 
					#define FOR_ALL_DOCKS(var) FOR_ALL_DOCKS_FROM(var, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* DOCK_BASE_H */
 | 
				
			||||||
@@ -4959,6 +4959,7 @@ STR_ERROR_TOO_MANY_BUS_STOPS                                    :{WHITE}Too many
 | 
				
			|||||||
STR_ERROR_TOO_MANY_TRUCK_STOPS                                  :{WHITE}Too many lorry stations
 | 
					STR_ERROR_TOO_MANY_TRUCK_STOPS                                  :{WHITE}Too many lorry stations
 | 
				
			||||||
STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION                          :{WHITE}Too close to another station/loading area
 | 
					STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION                          :{WHITE}Too close to another station/loading area
 | 
				
			||||||
STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK                             :{WHITE}Too close to another dock
 | 
					STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK                             :{WHITE}Too close to another dock
 | 
				
			||||||
 | 
					STR_ERROR_TOO_MANY_DOCKS                                        :{WHITE}Too many docks
 | 
				
			||||||
STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT                          :{WHITE}Too close to another airport
 | 
					STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT                          :{WHITE}Too close to another airport
 | 
				
			||||||
STR_ERROR_CAN_T_RENAME_STATION                                  :{WHITE}Can't rename station...
 | 
					STR_ERROR_CAN_T_RENAME_STATION                                  :{WHITE}Can't rename station...
 | 
				
			||||||
STR_ERROR_DRIVE_THROUGH_ON_TOWN_ROAD                            :{WHITE}... this is a town owned road
 | 
					STR_ERROR_DRIVE_THROUGH_ON_TOWN_ROAD                            :{WHITE}... this is a town owned road
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2525,7 +2525,7 @@ bool ProcessOrders(Vehicle *v)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	/* If it is unchanged, keep it. */
 | 
						/* If it is unchanged, keep it. */
 | 
				
			||||||
	if (order->Equals(v->current_order) && (v->type == VEH_AIRCRAFT || v->dest_tile != 0) &&
 | 
						if (order->Equals(v->current_order) && (v->type == VEH_AIRCRAFT || v->dest_tile != 0) &&
 | 
				
			||||||
			(v->type != VEH_SHIP || !order->IsType(OT_GOTO_STATION) || Station::Get(order->GetDestination())->dock_tile != INVALID_TILE)) {
 | 
								(v->type != VEH_SHIP || !order->IsType(OT_GOTO_STATION) || Station::Get(order->GetDestination())->HasFacilities(FACIL_DOCK))) {
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,6 +30,7 @@
 | 
				
			|||||||
#include "../station_base.h"
 | 
					#include "../station_base.h"
 | 
				
			||||||
#include "../waypoint_base.h"
 | 
					#include "../waypoint_base.h"
 | 
				
			||||||
#include "../roadstop_base.h"
 | 
					#include "../roadstop_base.h"
 | 
				
			||||||
 | 
					#include "../dock_base.h"
 | 
				
			||||||
#include "../tunnelbridge_map.h"
 | 
					#include "../tunnelbridge_map.h"
 | 
				
			||||||
#include "../pathfinder/yapf/yapf_cache.h"
 | 
					#include "../pathfinder/yapf/yapf_cache.h"
 | 
				
			||||||
#include "../elrail_func.h"
 | 
					#include "../elrail_func.h"
 | 
				
			||||||
@@ -728,9 +729,9 @@ bool AfterLoadGame()
 | 
				
			|||||||
		/* no station is determined by 'tile == INVALID_TILE' now (instead of '0') */
 | 
							/* no station is determined by 'tile == INVALID_TILE' now (instead of '0') */
 | 
				
			||||||
		Station *st;
 | 
							Station *st;
 | 
				
			||||||
		FOR_ALL_STATIONS(st) {
 | 
							FOR_ALL_STATIONS(st) {
 | 
				
			||||||
			if (st->airport.tile       == 0) st->airport.tile = INVALID_TILE;
 | 
								if (st->airport.tile       == 0) st->airport.tile       = INVALID_TILE;
 | 
				
			||||||
			if (st->dock_tile          == 0) st->dock_tile    = INVALID_TILE;
 | 
								if (st->dock_station.tile  == 0) st->dock_station.tile  = INVALID_TILE;
 | 
				
			||||||
			if (st->train_station.tile == 0) st->train_station.tile   = INVALID_TILE;
 | 
								if (st->train_station.tile == 0) st->train_station.tile = INVALID_TILE;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* the same applies to Company::location_of_HQ */
 | 
							/* the same applies to Company::location_of_HQ */
 | 
				
			||||||
@@ -877,7 +878,7 @@ bool AfterLoadGame()
 | 
				
			|||||||
			if (st->airport.tile == INVALID_TILE) continue;
 | 
								if (st->airport.tile == INVALID_TILE) continue;
 | 
				
			||||||
			StringID err = INVALID_STRING_ID;
 | 
								StringID err = INVALID_STRING_ID;
 | 
				
			||||||
			if (st->airport.type == 9) {
 | 
								if (st->airport.type == 9) {
 | 
				
			||||||
				if (st->dock_tile != INVALID_TILE && IsOilRig(st->dock_tile)) {
 | 
									if (st->dock_station.tile != INVALID_TILE && IsOilRig(st->dock_station.tile)) {
 | 
				
			||||||
					/* this airport is probably an oil rig, not a huge airport */
 | 
										/* this airport is probably an oil rig, not a huge airport */
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					err = STR_GAME_SAVELOAD_ERROR_HUGE_AIRPORTS_PRESENT;
 | 
										err = STR_GAME_SAVELOAD_ERROR_HUGE_AIRPORTS_PRESENT;
 | 
				
			||||||
@@ -904,7 +905,7 @@ bool AfterLoadGame()
 | 
				
			|||||||
		Aircraft *v;
 | 
							Aircraft *v;
 | 
				
			||||||
		FOR_ALL_AIRCRAFT(v) {
 | 
							FOR_ALL_AIRCRAFT(v) {
 | 
				
			||||||
			Station *st = GetTargetAirportIfValid(v);
 | 
								Station *st = GetTargetAirportIfValid(v);
 | 
				
			||||||
			if (st != NULL && ((st->dock_tile != INVALID_TILE && IsOilRig(st->dock_tile)) || st->airport.type == AT_OILRIG)) {
 | 
								if (st != NULL && ((st->dock_station.tile != INVALID_TILE && IsOilRig(st->dock_station.tile)) || st->airport.type == AT_OILRIG)) {
 | 
				
			||||||
				/* aircraft is on approach to an oil rig, bail out now */
 | 
									/* aircraft is on approach to an oil rig, bail out now */
 | 
				
			||||||
				SetSaveLoadError(STR_GAME_SAVELOAD_ERROR_HELI_OILRIG_BUG);
 | 
									SetSaveLoadError(STR_GAME_SAVELOAD_ERROR_HELI_OILRIG_BUG);
 | 
				
			||||||
				/* Restore the signals */
 | 
									/* Restore the signals */
 | 
				
			||||||
@@ -1015,6 +1016,26 @@ bool AfterLoadGame()
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (SlXvIsFeatureMissing(XSLFI_MULTIPLE_DOCKS)) {
 | 
				
			||||||
 | 
							/* Dock type has changed. */
 | 
				
			||||||
 | 
							Station *st;
 | 
				
			||||||
 | 
							FOR_ALL_STATIONS(st) {
 | 
				
			||||||
 | 
								if (st->dock_station.tile == INVALID_TILE) continue;
 | 
				
			||||||
 | 
								assert(Dock::CanAllocateItem());
 | 
				
			||||||
 | 
								if (IsOilRig(st->dock_station.tile)) {
 | 
				
			||||||
 | 
									/* Set dock station tile to dest tile instead of station. */
 | 
				
			||||||
 | 
									st->docks = new Dock(st->dock_station.tile, st->dock_station.tile + ToTileIndexDiff({ 1, 0 }));
 | 
				
			||||||
 | 
								} else if (IsDock(st->dock_station.tile)) {
 | 
				
			||||||
 | 
									/* A normal two-tiles dock. */
 | 
				
			||||||
 | 
									st->docks = new Dock(st->dock_station.tile, TileAddByDiagDir(st->dock_station.tile, GetDockDirection(st->dock_station.tile)));
 | 
				
			||||||
 | 
								} else if (IsBuoy(st->dock_station.tile)) {
 | 
				
			||||||
 | 
									/* A buoy. */
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									NOT_REACHED();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (TileIndex t = 0; t < map_size; t++) {
 | 
						for (TileIndex t = 0; t < map_size; t++) {
 | 
				
			||||||
		switch (GetTileType(t)) {
 | 
							switch (GetTileType(t)) {
 | 
				
			||||||
			case MP_STATION: {
 | 
								case MP_STATION: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -78,6 +78,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
 | 
				
			|||||||
	{ XSLFI_CHUNNEL,                XSCF_NULL,                1,   1, "chunnel",                   NULL, NULL, "TUNN"      },
 | 
						{ XSLFI_CHUNNEL,                XSCF_NULL,                1,   1, "chunnel",                   NULL, NULL, "TUNN"      },
 | 
				
			||||||
	{ XSLFI_SCHEDULED_DISPATCH,     XSCF_NULL,                1,   1, "scheduled_dispatch",        NULL, NULL, NULL        },
 | 
						{ XSLFI_SCHEDULED_DISPATCH,     XSCF_NULL,                1,   1, "scheduled_dispatch",        NULL, NULL, NULL        },
 | 
				
			||||||
	{ XSLFI_MORE_TOWN_GROWTH_RATES, XSCF_NULL,                1,   1, "more_town_growth_rates",    NULL, NULL, NULL        },
 | 
						{ XSLFI_MORE_TOWN_GROWTH_RATES, XSCF_NULL,                1,   1, "more_town_growth_rates",    NULL, NULL, NULL        },
 | 
				
			||||||
 | 
						{ XSLFI_MULTIPLE_DOCKS,         XSCF_NULL,                1,   1, "multiple_docks",            NULL, NULL, "DOCK"      },
 | 
				
			||||||
	{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
 | 
						{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,6 +52,7 @@ enum SlXvFeatureIndex {
 | 
				
			|||||||
	XSLFI_CHUNNEL,                                ///< Tunnels under water (channel tunnel)
 | 
						XSLFI_CHUNNEL,                                ///< Tunnels under water (channel tunnel)
 | 
				
			||||||
	XSLFI_SCHEDULED_DISPATCH,                     ///< Scheduled vehicle dispatching
 | 
						XSLFI_SCHEDULED_DISPATCH,                     ///< Scheduled vehicle dispatching
 | 
				
			||||||
	XSLFI_MORE_TOWN_GROWTH_RATES,                 ///< More town growth rates
 | 
						XSLFI_MORE_TOWN_GROWTH_RATES,                 ///< More town growth rates
 | 
				
			||||||
 | 
						XSLFI_MULTIPLE_DOCKS,                         ///< Multiple docks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	XSLFI_RIFF_HEADER_60_BIT,                     ///< Size field in RIFF chunk header is 60 bit
 | 
						XSLFI_RIFF_HEADER_60_BIT,                     ///< Size field in RIFF chunk header is 60 bit
 | 
				
			||||||
	XSLFI_HEIGHT_8_BIT,                           ///< Map tile height is 8 bit instead of 4 bit, but savegame version may be before this became true in trunk
 | 
						XSLFI_HEIGHT_8_BIT,                           ///< Map tile height is 8 bit instead of 4 bit, but savegame version may be before this became true in trunk
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -728,7 +728,7 @@ static const OldChunks station_chunk[] = {
 | 
				
			|||||||
	OCL_NULL( 4 ), ///< bus/lorry tile
 | 
						OCL_NULL( 4 ), ///< bus/lorry tile
 | 
				
			||||||
	OCL_SVAR(   OC_TILE, Station, train_station.tile ),
 | 
						OCL_SVAR(   OC_TILE, Station, train_station.tile ),
 | 
				
			||||||
	OCL_SVAR(   OC_TILE, Station, airport.tile ),
 | 
						OCL_SVAR(   OC_TILE, Station, airport.tile ),
 | 
				
			||||||
	OCL_SVAR(   OC_TILE, Station, dock_tile ),
 | 
						OCL_SVAR(   OC_TILE, Station, dock_station.tile),
 | 
				
			||||||
	OCL_SVAR( OC_FILE_U8 | OC_VAR_U16, Station, train_station.w ),
 | 
						OCL_SVAR( OC_FILE_U8 | OC_VAR_U16, Station, train_station.w ),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	OCL_NULL( 1 ),         ///< sort-index, no longer in use
 | 
						OCL_NULL( 1 ),         ///< sort-index, no longer in use
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,6 +24,7 @@
 | 
				
			|||||||
#include "../stdafx.h"
 | 
					#include "../stdafx.h"
 | 
				
			||||||
#include "../debug.h"
 | 
					#include "../debug.h"
 | 
				
			||||||
#include "../station_base.h"
 | 
					#include "../station_base.h"
 | 
				
			||||||
 | 
					#include "../dock_base.h"
 | 
				
			||||||
#include "../thread/thread.h"
 | 
					#include "../thread/thread.h"
 | 
				
			||||||
#include "../town.h"
 | 
					#include "../town.h"
 | 
				
			||||||
#include "../network/network.h"
 | 
					#include "../network/network.h"
 | 
				
			||||||
@@ -1344,6 +1345,7 @@ static size_t ReferenceToInt(const void *obj, SLRefType rt)
 | 
				
			|||||||
		case REF_STORAGE:        return ((const PersistentStorage*)obj)->index + 1;
 | 
							case REF_STORAGE:        return ((const PersistentStorage*)obj)->index + 1;
 | 
				
			||||||
		case REF_LINK_GRAPH:     return ((const         LinkGraph*)obj)->index + 1;
 | 
							case REF_LINK_GRAPH:     return ((const         LinkGraph*)obj)->index + 1;
 | 
				
			||||||
		case REF_LINK_GRAPH_JOB: return ((const      LinkGraphJob*)obj)->index + 1;
 | 
							case REF_LINK_GRAPH_JOB: return ((const      LinkGraphJob*)obj)->index + 1;
 | 
				
			||||||
 | 
							case REF_DOCKS:          return ((const              Dock*)obj)->index + 1;
 | 
				
			||||||
		default: NOT_REACHED();
 | 
							default: NOT_REACHED();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1409,6 +1411,10 @@ static void *IntToReference(size_t index, SLRefType rt)
 | 
				
			|||||||
			if (RoadStop::IsValidID(index)) return RoadStop::Get(index);
 | 
								if (RoadStop::IsValidID(index)) return RoadStop::Get(index);
 | 
				
			||||||
			SlErrorCorrupt("Referencing invalid RoadStop");
 | 
								SlErrorCorrupt("Referencing invalid RoadStop");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							case REF_DOCKS:
 | 
				
			||||||
 | 
								if (Dock::IsValidID(index)) return Dock::Get(index);
 | 
				
			||||||
 | 
								SlErrorCorrupt("Referencing invalid Dock");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case REF_ENGINE_RENEWS:
 | 
							case REF_ENGINE_RENEWS:
 | 
				
			||||||
			if (EngineRenew::IsValidID(index)) return EngineRenew::Get(index);
 | 
								if (EngineRenew::IsValidID(index)) return EngineRenew::Get(index);
 | 
				
			||||||
			SlErrorCorrupt("Referencing invalid EngineRenew");
 | 
								SlErrorCorrupt("Referencing invalid EngineRenew");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -81,19 +81,20 @@ struct NullStruct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/** Type of reference (#SLE_REF, #SLE_CONDREF). */
 | 
					/** Type of reference (#SLE_REF, #SLE_CONDREF). */
 | 
				
			||||||
enum SLRefType {
 | 
					enum SLRefType {
 | 
				
			||||||
	REF_ORDER          =  0, ///< Load/save a reference to an order.
 | 
						REF_ORDER            =  0,	///< Load/save a reference to an order.
 | 
				
			||||||
	REF_VEHICLE        =  1, ///< Load/save a reference to a vehicle.
 | 
						REF_VEHICLE          =  1,	///< Load/save a reference to a vehicle.
 | 
				
			||||||
	REF_STATION        =  2, ///< Load/save a reference to a station.
 | 
						REF_STATION          =  2,	///< Load/save a reference to a station.
 | 
				
			||||||
	REF_TOWN           =  3, ///< Load/save a reference to a town.
 | 
						REF_TOWN             =  3,	///< Load/save a reference to a town.
 | 
				
			||||||
	REF_VEHICLE_OLD    =  4, ///< Load/save an old-style reference to a vehicle (for pre-4.4 savegames).
 | 
						REF_VEHICLE_OLD      =  4,	///< Load/save an old-style reference to a vehicle (for pre-4.4 savegames).
 | 
				
			||||||
	REF_ROADSTOPS      =  5, ///< Load/save a reference to a bus/truck stop.
 | 
						REF_ROADSTOPS        =  5,	///< Load/save a reference to a bus/truck stop.
 | 
				
			||||||
	REF_ENGINE_RENEWS  =  6, ///< Load/save a reference to an engine renewal (autoreplace).
 | 
						REF_ENGINE_RENEWS    =  6,	///< Load/save a reference to an engine renewal (autoreplace).
 | 
				
			||||||
	REF_CARGO_PACKET   =  7, ///< Load/save a reference to a cargo packet.
 | 
						REF_CARGO_PACKET     =  7,	///< Load/save a reference to a cargo packet.
 | 
				
			||||||
	REF_ORDERLIST      =  8, ///< Load/save a reference to an orderlist.
 | 
						REF_ORDERLIST        =  8,	///< Load/save a reference to an orderlist.
 | 
				
			||||||
	REF_STORAGE        =  9, ///< Load/save a reference to a persistent storage.
 | 
						REF_STORAGE          =  9,	///< Load/save a reference to a persistent storage.
 | 
				
			||||||
	REF_LINK_GRAPH     = 10, ///< Load/save a reference to a link graph.
 | 
						REF_LINK_GRAPH       = 10,	///< Load/save a reference to a link graph.
 | 
				
			||||||
	REF_LINK_GRAPH_JOB = 11, ///< Load/save a reference to a link graph job.
 | 
						REF_LINK_GRAPH_JOB   = 11,	///< Load/save a reference to a link graph job.
 | 
				
			||||||
	REF_TEMPLATE_VEHICLE = 12, ///< Load/save a reference to a template vehicle
 | 
						REF_TEMPLATE_VEHICLE = 12,	///< Load/save a reference to a template vehicle
 | 
				
			||||||
 | 
						REF_DOCKS            = 13,	///< Load/save a reference to a dock.
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Highest possible savegame version. */
 | 
					/** Highest possible savegame version. */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,7 @@
 | 
				
			|||||||
#include "../station_base.h"
 | 
					#include "../station_base.h"
 | 
				
			||||||
#include "../waypoint_base.h"
 | 
					#include "../waypoint_base.h"
 | 
				
			||||||
#include "../roadstop_base.h"
 | 
					#include "../roadstop_base.h"
 | 
				
			||||||
 | 
					#include "../dock_base.h"
 | 
				
			||||||
#include "../vehicle_base.h"
 | 
					#include "../vehicle_base.h"
 | 
				
			||||||
#include "../newgrf_station.h"
 | 
					#include "../newgrf_station.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -123,6 +124,11 @@ void AfterLoadStations()
 | 
				
			|||||||
			Station *sta = Station::From(st);
 | 
								Station *sta = Station::From(st);
 | 
				
			||||||
			for (const RoadStop *rs = sta->bus_stops; rs != NULL; rs = rs->next) sta->bus_station.Add(rs->xy);
 | 
								for (const RoadStop *rs = sta->bus_stops; rs != NULL; rs = rs->next) sta->bus_station.Add(rs->xy);
 | 
				
			||||||
			for (const RoadStop *rs = sta->truck_stops; rs != NULL; rs = rs->next) sta->truck_station.Add(rs->xy);
 | 
								for (const RoadStop *rs = sta->truck_stops; rs != NULL; rs = rs->next) sta->truck_station.Add(rs->xy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								for (const Dock *d = sta->docks; d != NULL; d = d->next) {
 | 
				
			||||||
 | 
									sta->dock_station.Add(d->sloped);
 | 
				
			||||||
 | 
									sta->dock_station.Add(d->flat);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		StationUpdateCachedTriggers(st);
 | 
							StationUpdateCachedTriggers(st);
 | 
				
			||||||
@@ -166,6 +172,14 @@ static const SaveLoad _roadstop_desc[] = {
 | 
				
			|||||||
	SLE_END()
 | 
						SLE_END()
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const SaveLoad _dock_desc[] = {
 | 
				
			||||||
 | 
						SLE_VAR(Dock, sloped,       SLE_UINT32),
 | 
				
			||||||
 | 
						SLE_VAR(Dock, flat,         SLE_UINT32),
 | 
				
			||||||
 | 
						SLE_REF(Dock, next,         REF_DOCKS),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						SLE_END()
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const SaveLoad _old_station_desc[] = {
 | 
					static const SaveLoad _old_station_desc[] = {
 | 
				
			||||||
	SLE_CONDVAR(Station, xy,                         SLE_FILE_U16 | SLE_VAR_U32,  0, 5),
 | 
						SLE_CONDVAR(Station, xy,                         SLE_FILE_U16 | SLE_VAR_U32,  0, 5),
 | 
				
			||||||
	SLE_CONDVAR(Station, xy,                         SLE_UINT32,                  6, SL_MAX_VERSION),
 | 
						SLE_CONDVAR(Station, xy,                         SLE_UINT32,                  6, SL_MAX_VERSION),
 | 
				
			||||||
@@ -174,8 +188,8 @@ static const SaveLoad _old_station_desc[] = {
 | 
				
			|||||||
	SLE_CONDVAR(Station, train_station.tile,         SLE_UINT32,                  6, SL_MAX_VERSION),
 | 
						SLE_CONDVAR(Station, train_station.tile,         SLE_UINT32,                  6, SL_MAX_VERSION),
 | 
				
			||||||
	SLE_CONDVAR(Station, airport.tile,               SLE_FILE_U16 | SLE_VAR_U32,  0, 5),
 | 
						SLE_CONDVAR(Station, airport.tile,               SLE_FILE_U16 | SLE_VAR_U32,  0, 5),
 | 
				
			||||||
	SLE_CONDVAR(Station, airport.tile,               SLE_UINT32,                  6, SL_MAX_VERSION),
 | 
						SLE_CONDVAR(Station, airport.tile,               SLE_UINT32,                  6, SL_MAX_VERSION),
 | 
				
			||||||
	SLE_CONDVAR(Station, dock_tile,                  SLE_FILE_U16 | SLE_VAR_U32,  0, 5),
 | 
						SLE_CONDVAR(Station, dock_station.tile,          SLE_FILE_U16 | SLE_VAR_U32,  0, 5),
 | 
				
			||||||
	SLE_CONDVAR(Station, dock_tile,                  SLE_UINT32,                  6, SL_MAX_VERSION),
 | 
						SLE_CONDVAR(Station, dock_station.tile,          SLE_UINT32,                  6, SL_MAX_VERSION),
 | 
				
			||||||
	    SLE_REF(Station, town,                       REF_TOWN),
 | 
						    SLE_REF(Station, town,                       REF_TOWN),
 | 
				
			||||||
	    SLE_VAR(Station, train_station.w,            SLE_FILE_U8 | SLE_VAR_U16),
 | 
						    SLE_VAR(Station, train_station.w,            SLE_FILE_U8 | SLE_VAR_U16),
 | 
				
			||||||
	SLE_CONDVAR(Station, train_station.h,            SLE_FILE_U8 | SLE_VAR_U16,   2, SL_MAX_VERSION),
 | 
						SLE_CONDVAR(Station, train_station.h,            SLE_FILE_U8 | SLE_VAR_U16,   2, SL_MAX_VERSION),
 | 
				
			||||||
@@ -425,7 +439,8 @@ static const SaveLoad _station_desc[] = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	      SLE_REF(Station, bus_stops,                  REF_ROADSTOPS),
 | 
						      SLE_REF(Station, bus_stops,                  REF_ROADSTOPS),
 | 
				
			||||||
	      SLE_REF(Station, truck_stops,                REF_ROADSTOPS),
 | 
						      SLE_REF(Station, truck_stops,                REF_ROADSTOPS),
 | 
				
			||||||
	      SLE_VAR(Station, dock_tile,                  SLE_UINT32),
 | 
					    SLE_CONDVAR_X(Station, dock_station.tile,          SLE_UINT32,                  0, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_MULTIPLE_DOCKS, 0, 0)),
 | 
				
			||||||
 | 
					    SLE_CONDREF_X(Station, docks,                      REF_DOCKS,                   0, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_MULTIPLE_DOCKS, 1)),
 | 
				
			||||||
	      SLE_VAR(Station, airport.tile,               SLE_UINT32),
 | 
						      SLE_VAR(Station, airport.tile,               SLE_UINT32),
 | 
				
			||||||
	  SLE_CONDVAR(Station, airport.w,                  SLE_FILE_U8 | SLE_VAR_U16, 140, SL_MAX_VERSION),
 | 
						  SLE_CONDVAR(Station, airport.w,                  SLE_FILE_U8 | SLE_VAR_U16, 140, SL_MAX_VERSION),
 | 
				
			||||||
	  SLE_CONDVAR(Station, airport.h,                  SLE_FILE_U8 | SLE_VAR_U16, 140, SL_MAX_VERSION),
 | 
						  SLE_CONDVAR(Station, airport.h,                  SLE_FILE_U8 | SLE_VAR_U16, 140, SL_MAX_VERSION),
 | 
				
			||||||
@@ -638,8 +653,38 @@ static void Ptrs_ROADSTOP()
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void Save_DOCK()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						Dock *d;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						FOR_ALL_DOCKS(d) {
 | 
				
			||||||
 | 
							SlSetArrayIndex(d->index);
 | 
				
			||||||
 | 
							SlObject(d, _dock_desc);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void Load_DOCK()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int index;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						while ((index = SlIterateArray()) != -1) {
 | 
				
			||||||
 | 
							Dock *d = new (index) Dock();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							SlObject(d, _dock_desc);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void Ptrs_DOCK()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						Dock *d;
 | 
				
			||||||
 | 
						FOR_ALL_DOCKS(d) {
 | 
				
			||||||
 | 
							SlObject(d, _dock_desc);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern const ChunkHandler _station_chunk_handlers[] = {
 | 
					extern const ChunkHandler _station_chunk_handlers[] = {
 | 
				
			||||||
	{ 'STNS', NULL,          Load_STNS,     Ptrs_STNS,     NULL, CH_ARRAY },
 | 
						{ 'STNS', NULL,          Load_STNS,     Ptrs_STNS,     NULL, CH_ARRAY },
 | 
				
			||||||
	{ 'STNN', Save_STNN,     Load_STNN,     Ptrs_STNN,     NULL, CH_ARRAY },
 | 
						{ 'STNN', Save_STNN,     Load_STNN,     Ptrs_STNN,     NULL, CH_ARRAY },
 | 
				
			||||||
	{ 'ROAD', Save_ROADSTOP, Load_ROADSTOP, Ptrs_ROADSTOP, NULL, CH_ARRAY | CH_LAST},
 | 
						{ 'ROAD', Save_ROADSTOP, Load_ROADSTOP, Ptrs_ROADSTOP, NULL, CH_ARRAY},
 | 
				
			||||||
 | 
						{ 'DOCK', Save_DOCK,     Load_DOCK,     Ptrs_DOCK,     NULL, CH_ARRAY | CH_LAST},
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,10 +34,10 @@ void SQAIStation_Register(Squirrel *engine)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	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_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_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_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_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_TOO_MANY_BUS_STOPS,              ScriptStation::ERR_STATION_TOO_MANY_STATIONS);
 | 
				
			||||||
 | 
						ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_DOCKS,                  ScriptStation::ERR_STATION_TOO_MANY_STATIONS);
 | 
				
			||||||
	ScriptError::RegisterErrorMap(STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT, ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN);
 | 
						ScriptError::RegisterErrorMap(STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT, ScriptStation::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_CLOSE_TO_ANOTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,10 +34,10 @@ void SQGSStation_Register(Squirrel *engine)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	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_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_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_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_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_TOO_MANY_BUS_STOPS,              ScriptStation::ERR_STATION_TOO_MANY_STATIONS);
 | 
				
			||||||
 | 
						ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_DOCKS,                  ScriptStation::ERR_STATION_TOO_MANY_STATIONS);
 | 
				
			||||||
	ScriptError::RegisterErrorMap(STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT, ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN);
 | 
						ScriptError::RegisterErrorMap(STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT, ScriptStation::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_CLOSE_TO_ANOTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,6 +17,7 @@
 | 
				
			|||||||
#include "../../debug.h"
 | 
					#include "../../debug.h"
 | 
				
			||||||
#include "../../vehicle_base.h"
 | 
					#include "../../vehicle_base.h"
 | 
				
			||||||
#include "../../roadstop_base.h"
 | 
					#include "../../roadstop_base.h"
 | 
				
			||||||
 | 
					#include "../../dock_base.h"
 | 
				
			||||||
#include "../../depot_base.h"
 | 
					#include "../../depot_base.h"
 | 
				
			||||||
#include "../../station_base.h"
 | 
					#include "../../station_base.h"
 | 
				
			||||||
#include "../../waypoint_base.h"
 | 
					#include "../../waypoint_base.h"
 | 
				
			||||||
@@ -260,8 +261,8 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
 | 
				
			|||||||
				TILE_AREA_LOOP(t, st->train_station) {
 | 
									TILE_AREA_LOOP(t, st->train_station) {
 | 
				
			||||||
					if (st->TileBelongsToRailStation(t)) return t;
 | 
										if (st->TileBelongsToRailStation(t)) return t;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			} else if (st->dock_tile != INVALID_TILE) {
 | 
								} else if (st->docks != NULL) {
 | 
				
			||||||
				return st->dock_tile;
 | 
									return st->docks->flat;
 | 
				
			||||||
			} else if (st->bus_stops != NULL) {
 | 
								} else if (st->bus_stops != NULL) {
 | 
				
			||||||
				return st->bus_stops->xy;
 | 
									return st->bus_stops->xy;
 | 
				
			||||||
			} else if (st->truck_stops != NULL) {
 | 
								} else if (st->truck_stops != NULL) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,10 +30,10 @@ public:
 | 
				
			|||||||
		ERR_STATION_BASE = ScriptError::ERR_CAT_STATION << ScriptError::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 */
 | 
							/** 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]
 | 
							ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, // [STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT, STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/** There are too many stations, airports and docks in the game */
 | 
							/** There are too many stations, airports and docks in the game */
 | 
				
			||||||
		ERR_STATION_TOO_MANY_STATIONS,            // [STR_ERROR_TOO_MANY_STATIONS_LOADING, STR_ERROR_TOO_MANY_TRUCK_STOPS, STR_ERROR_TOO_MANY_BUS_STOPS]
 | 
							ERR_STATION_TOO_MANY_STATIONS,            // [STR_ERROR_TOO_MANY_STATIONS_LOADING, STR_ERROR_TOO_MANY_TRUCK_STOPS, STR_ERROR_TOO_MANY_BUS_STOPS, STR_ERROR_TOO_MANY_DOCKS]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/** There are too many stations, airports of docks in a town */
 | 
							/** There are too many stations, airports of docks in a town */
 | 
				
			||||||
		ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,    // [STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT]
 | 
							ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,    // [STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "stdafx.h"
 | 
					#include "stdafx.h"
 | 
				
			||||||
#include "ship.h"
 | 
					#include "ship.h"
 | 
				
			||||||
 | 
					#include "dock_base.h"
 | 
				
			||||||
#include "landscape.h"
 | 
					#include "landscape.h"
 | 
				
			||||||
#include "timetable.h"
 | 
					#include "timetable.h"
 | 
				
			||||||
#include "news_func.h"
 | 
					#include "news_func.h"
 | 
				
			||||||
@@ -285,13 +286,48 @@ void Ship::PlayLeaveStationSound() const
 | 
				
			|||||||
	PlayShipSound(this);
 | 
						PlayShipSound(this);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Of all the docks a station has, return the best destination for a ship.
 | 
				
			||||||
 | 
					 * @param v The ship.
 | 
				
			||||||
 | 
					 * @param st Station the ship \a v is heading for.
 | 
				
			||||||
 | 
					 * @return The free and closest (if none is free, just closest) dock of station \a st to ship \a v.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					const Dock* GetBestDock(const Ship *v, const Station *st)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						assert(st != NULL && st->HasFacilities(FACIL_DOCK) && st->docks != NULL);
 | 
				
			||||||
 | 
						if (st->docks->next == NULL) return st->docks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Dock *best_dock = NULL;
 | 
				
			||||||
 | 
						uint best_distance = UINT_MAX;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (Dock *dock = st->docks; dock != NULL; dock = dock->next) {
 | 
				
			||||||
 | 
							uint new_distance = DistanceManhattan(v->tile, dock->flat);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (new_distance < best_distance) {
 | 
				
			||||||
 | 
								best_dock = dock;
 | 
				
			||||||
 | 
								best_distance = new_distance;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						assert(best_dock != NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return best_dock;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TileIndex Ship::GetOrderStationLocation(StationID station)
 | 
					TileIndex Ship::GetOrderStationLocation(StationID station)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (station == this->last_station_visited) this->last_station_visited = INVALID_STATION;
 | 
						if (station == this->last_station_visited) this->last_station_visited = INVALID_STATION;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const Station *st = Station::Get(station);
 | 
						const Station *st = Station::Get(station);
 | 
				
			||||||
	if (st->dock_tile != INVALID_TILE) {
 | 
						if (st->HasFacilities(FACIL_DOCK)) {
 | 
				
			||||||
		return TILE_ADD(st->dock_tile, ToTileIndexDiff(GetDockOffset(st->dock_tile)));
 | 
							if (st->docks == NULL) {
 | 
				
			||||||
 | 
								return st->xy; // A buoy
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								const Dock* dock = GetBestDock(this, st);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								DiagDirection direction = DiagdirBetweenTiles(dock->sloped, dock->flat);
 | 
				
			||||||
 | 
								return dock->flat + TileOffsByDiagDir(direction);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		this->IncrementRealOrderIndex();
 | 
							this->IncrementRealOrderIndex();
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,7 @@
 | 
				
			|||||||
#include "core/pool_func.hpp"
 | 
					#include "core/pool_func.hpp"
 | 
				
			||||||
#include "station_base.h"
 | 
					#include "station_base.h"
 | 
				
			||||||
#include "roadstop_base.h"
 | 
					#include "roadstop_base.h"
 | 
				
			||||||
 | 
					#include "dock_base.h"
 | 
				
			||||||
#include "industry.h"
 | 
					#include "industry.h"
 | 
				
			||||||
#include "core/random_func.hpp"
 | 
					#include "core/random_func.hpp"
 | 
				
			||||||
#include "linkgraph/linkgraph.h"
 | 
					#include "linkgraph/linkgraph.h"
 | 
				
			||||||
@@ -59,7 +60,7 @@ Station::Station(TileIndex tile) :
 | 
				
			|||||||
	SpecializedStation<Station, false>(tile),
 | 
						SpecializedStation<Station, false>(tile),
 | 
				
			||||||
	bus_station(INVALID_TILE, 0, 0),
 | 
						bus_station(INVALID_TILE, 0, 0),
 | 
				
			||||||
	truck_station(INVALID_TILE, 0, 0),
 | 
						truck_station(INVALID_TILE, 0, 0),
 | 
				
			||||||
	dock_tile(INVALID_TILE),
 | 
						dock_station(INVALID_TILE, 0, 0),
 | 
				
			||||||
	indtype(IT_INVALID),
 | 
						indtype(IT_INVALID),
 | 
				
			||||||
	time_since_load(255),
 | 
						time_since_load(255),
 | 
				
			||||||
	time_since_unload(255),
 | 
						time_since_unload(255),
 | 
				
			||||||
@@ -280,10 +281,10 @@ uint Station::GetCatchmentRadius() const
 | 
				
			|||||||
		if (this->bus_stops          != NULL)         ret = max<uint>(ret, CA_BUS);
 | 
							if (this->bus_stops          != NULL)         ret = max<uint>(ret, CA_BUS);
 | 
				
			||||||
		if (this->truck_stops        != NULL)         ret = max<uint>(ret, CA_TRUCK);
 | 
							if (this->truck_stops        != NULL)         ret = max<uint>(ret, CA_TRUCK);
 | 
				
			||||||
		if (this->train_station.tile != INVALID_TILE) ret = max<uint>(ret, CA_TRAIN);
 | 
							if (this->train_station.tile != INVALID_TILE) ret = max<uint>(ret, CA_TRAIN);
 | 
				
			||||||
		if (this->dock_tile          != INVALID_TILE) ret = max<uint>(ret, CA_DOCK);
 | 
							if (this->docks              != NULL)         ret = max<uint>(ret, CA_DOCK);
 | 
				
			||||||
		if (this->airport.tile       != INVALID_TILE) ret = max<uint>(ret, this->airport.GetSpec()->catchment);
 | 
							if (this->airport.tile       != INVALID_TILE) ret = max<uint>(ret, this->airport.GetSpec()->catchment);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		if (this->bus_stops != NULL || this->truck_stops != NULL || this->train_station.tile != INVALID_TILE || this->dock_tile != INVALID_TILE || this->airport.tile != INVALID_TILE) {
 | 
							if (this->bus_stops != NULL || this->truck_stops != NULL || this->train_station.tile != INVALID_TILE || this->docks != NULL || this->airport.tile != INVALID_TILE) {
 | 
				
			||||||
			ret = CA_UNMODIFIED;
 | 
								ret = CA_UNMODIFIED;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -458,9 +458,10 @@ public:
 | 
				
			|||||||
	TileArea bus_station;   ///< Tile area the bus 'station' part covers
 | 
						TileArea bus_station;   ///< Tile area the bus 'station' part covers
 | 
				
			||||||
	RoadStop *truck_stops;  ///< All the truck stops
 | 
						RoadStop *truck_stops;  ///< All the truck stops
 | 
				
			||||||
	TileArea truck_station; ///< Tile area the truck 'station' part covers
 | 
						TileArea truck_station; ///< Tile area the truck 'station' part covers
 | 
				
			||||||
 | 
						Dock *docks;            ///< All the docks
 | 
				
			||||||
 | 
						TileArea dock_station;  ///< Tile area dock 'station' part covers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Airport airport;        ///< Tile area the airport covers
 | 
						Airport airport;        ///< Tile area the airport covers
 | 
				
			||||||
	TileIndex dock_tile;    ///< The location of the dock
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	IndustryType indtype;   ///< Industry type to get the name from
 | 
						IndustryType indtype;   ///< Industry type to get the name from
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -490,6 +491,8 @@ public:
 | 
				
			|||||||
	void RecomputeIndustriesNear();
 | 
						void RecomputeIndustriesNear();
 | 
				
			||||||
	static void RecomputeIndustriesNearForAll();
 | 
						static void RecomputeIndustriesNearForAll();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Dock *GetPrimaryDock() const { return docks; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint GetCatchmentRadius() const;
 | 
						uint GetCatchmentRadius() const;
 | 
				
			||||||
	Rect GetCatchmentRectUsingRadius(uint radius) const;
 | 
						Rect GetCatchmentRectUsingRadius(uint radius) const;
 | 
				
			||||||
	inline Rect GetCatchmentRect() const
 | 
						inline Rect GetCatchmentRect() const
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,6 +38,7 @@
 | 
				
			|||||||
#include "elrail_func.h"
 | 
					#include "elrail_func.h"
 | 
				
			||||||
#include "station_base.h"
 | 
					#include "station_base.h"
 | 
				
			||||||
#include "roadstop_base.h"
 | 
					#include "roadstop_base.h"
 | 
				
			||||||
 | 
					#include "dock_base.h"
 | 
				
			||||||
#include "newgrf_railtype.h"
 | 
					#include "newgrf_railtype.h"
 | 
				
			||||||
#include "waypoint_base.h"
 | 
					#include "waypoint_base.h"
 | 
				
			||||||
#include "waypoint_func.h"
 | 
					#include "waypoint_func.h"
 | 
				
			||||||
@@ -399,7 +400,7 @@ void Station::GetTileArea(TileArea *ta, StationType type) const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		case STATION_DOCK:
 | 
							case STATION_DOCK:
 | 
				
			||||||
		case STATION_OILRIG:
 | 
							case STATION_OILRIG:
 | 
				
			||||||
			ta->tile = this->dock_tile;
 | 
								*ta = this->dock_station;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		default: NOT_REACHED();
 | 
							default: NOT_REACHED();
 | 
				
			||||||
@@ -2599,41 +2600,43 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (distant_join && (!_settings_game.station.distant_join_stations || !Station::IsValidID(station_to_join))) return CMD_ERROR;
 | 
						if (distant_join && (!_settings_game.station.distant_join_stations || !Station::IsValidID(station_to_join))) return CMD_ERROR;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DiagDirection direction = GetInclinedSlopeDirection(GetTileSlope(tile));
 | 
						TileIndex slope_tile = tile;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						DiagDirection direction = GetInclinedSlopeDirection(GetTileSlope(slope_tile));
 | 
				
			||||||
	if (direction == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 | 
						if (direction == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 | 
				
			||||||
	direction = ReverseDiagDir(direction);
 | 
						direction = ReverseDiagDir(direction);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						TileIndex flat_tile = slope_tile + TileOffsByDiagDir(direction);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Docks cannot be placed on rapids */
 | 
						/* Docks cannot be placed on rapids */
 | 
				
			||||||
	if (HasTileWaterGround(tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 | 
						if (HasTileWaterGround(slope_tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	CommandCost ret = CheckIfAuthorityAllowsNewStation(tile, flags);
 | 
						CommandCost ret = CheckIfAuthorityAllowsNewStation(slope_tile, flags);
 | 
				
			||||||
	if (ret.Failed()) return ret;
 | 
						if (ret.Failed()) return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
 | 
						if (IsBridgeAbove(slope_tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 | 
						ret = DoCommand(slope_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 | 
				
			||||||
	if (ret.Failed()) return ret;
 | 
						if (ret.Failed()) return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	TileIndex tile_cur = tile + TileOffsByDiagDir(direction);
 | 
						if (!IsTileType(flat_tile, MP_WATER) || !IsTileFlat(flat_tile)) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (!IsTileType(tile_cur, MP_WATER) || !IsTileFlat(tile_cur)) {
 | 
					 | 
				
			||||||
		return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 | 
							return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (IsBridgeAbove(tile_cur)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
 | 
						if (IsBridgeAbove(flat_tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Get the water class of the water tile before it is cleared.*/
 | 
						/* Get the water class of the water tile before it is cleared.*/
 | 
				
			||||||
	WaterClass wc = GetWaterClass(tile_cur);
 | 
						WaterClass wc = GetWaterClass(flat_tile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 | 
						ret = DoCommand(flat_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 | 
				
			||||||
	if (ret.Failed()) return ret;
 | 
						if (ret.Failed()) return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tile_cur += TileOffsByDiagDir(direction);
 | 
						TileIndex adjacent_tile = flat_tile + TileOffsByDiagDir(direction);
 | 
				
			||||||
	if (!IsTileType(tile_cur, MP_WATER) || !IsTileFlat(tile_cur)) {
 | 
						if (!IsTileType(adjacent_tile, MP_WATER) || !IsTileFlat(adjacent_tile)) {
 | 
				
			||||||
		return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 | 
							return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	TileArea dock_area = TileArea(tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
 | 
						TileArea dock_area = TileArea(slope_tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
 | 
				
			||||||
			_dock_w_chk[direction], _dock_h_chk[direction]);
 | 
								_dock_w_chk[direction], _dock_h_chk[direction]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* middle */
 | 
						/* middle */
 | 
				
			||||||
@@ -2644,14 +2647,20 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
 | 
				
			|||||||
	/* Distant join */
 | 
						/* Distant join */
 | 
				
			||||||
	if (st == NULL && distant_join) st = Station::GetIfValid(station_to_join);
 | 
						if (st == NULL && distant_join) st = Station::GetIfValid(station_to_join);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!Dock::CanAllocateItem()) return_cmd_error(STR_ERROR_TOO_MANY_DOCKS);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = BuildStationPart(&st, flags, reuse, dock_area, STATIONNAMING_DOCK);
 | 
						ret = BuildStationPart(&st, flags, reuse, dock_area, STATIONNAMING_DOCK);
 | 
				
			||||||
	if (ret.Failed()) return ret;
 | 
						if (ret.Failed()) return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (st != NULL && st->dock_tile != INVALID_TILE) return_cmd_error(STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (flags & DC_EXEC) {
 | 
						if (flags & DC_EXEC) {
 | 
				
			||||||
		st->dock_tile = tile;
 | 
							/* Create the dock and insert it into the list of docks. */
 | 
				
			||||||
		st->AddFacility(FACIL_DOCK, tile);
 | 
							Dock *dock = new Dock(slope_tile, flat_tile);
 | 
				
			||||||
 | 
							dock->next = st->docks;
 | 
				
			||||||
 | 
							st->docks = dock;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							st->dock_station.Add(slope_tile);
 | 
				
			||||||
 | 
							st->dock_station.Add(flat_tile);
 | 
				
			||||||
 | 
							st->AddFacility(FACIL_DOCK, slope_tile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		st->rect.BeforeAddRect(dock_area.tile, dock_area.w, dock_area.h, StationRect::ADD_TRY);
 | 
							st->rect.BeforeAddRect(dock_area.tile, dock_area.w, dock_area.h, StationRect::ADD_TRY);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2663,7 +2672,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
 | 
				
			|||||||
		Company::Get(st->owner)->infrastructure.station += 2;
 | 
							Company::Get(st->owner)->infrastructure.station += 2;
 | 
				
			||||||
		DirtyCompanyInfrastructureWindows(st->owner);
 | 
							DirtyCompanyInfrastructureWindows(st->owner);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		MakeDock(tile, st->owner, st->index, direction, wc);
 | 
							MakeDock(slope_tile, st->owner, st->index, direction, wc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		st->UpdateVirtCoord();
 | 
							st->UpdateVirtCoord();
 | 
				
			||||||
		UpdateStationAcceptance(st, false);
 | 
							UpdateStationAcceptance(st, false);
 | 
				
			||||||
@@ -2689,10 +2698,14 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
 | 
				
			|||||||
	CommandCost ret = CheckOwnership(st->owner);
 | 
						CommandCost ret = CheckOwnership(st->owner);
 | 
				
			||||||
	if (ret.Failed()) return ret;
 | 
						if (ret.Failed()) return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	TileIndex docking_location = TILE_ADD(st->dock_tile, ToTileIndexDiff(GetDockOffset(st->dock_tile)));
 | 
						Dock *removing_dock = Dock::GetByTile(tile);
 | 
				
			||||||
 | 
						assert(removing_dock != NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	TileIndex tile1 = st->dock_tile;
 | 
						TileIndex tile1 = removing_dock->sloped;
 | 
				
			||||||
	TileIndex tile2 = tile1 + TileOffsByDiagDir(GetDockDirection(tile1));
 | 
						TileIndex tile2 = removing_dock->flat;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						DiagDirection direction = DiagdirBetweenTiles(removing_dock->sloped, removing_dock->flat);
 | 
				
			||||||
 | 
						TileIndex docking_location = removing_dock->flat + TileOffsByDiagDir(direction);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = EnsureNoVehicleOnGround(tile1);
 | 
						ret = EnsureNoVehicleOnGround(tile1);
 | 
				
			||||||
	if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile2);
 | 
						if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile2);
 | 
				
			||||||
@@ -2700,6 +2713,23 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (flags & DC_EXEC) {
 | 
						if (flags & DC_EXEC) {
 | 
				
			||||||
		ZoningMarkDirtyStationCoverageArea(st);
 | 
							ZoningMarkDirtyStationCoverageArea(st);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (st->docks == removing_dock) {
 | 
				
			||||||
 | 
								/* The first dock in the list is removed. */
 | 
				
			||||||
 | 
								st->docks = removing_dock->next;
 | 
				
			||||||
 | 
								/* Last dock is removed. */
 | 
				
			||||||
 | 
								if (st->docks == NULL) {
 | 
				
			||||||
 | 
									st->facilities &= ~FACIL_DOCK;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								/* Tell the predecessor in the list to skip this dock. */
 | 
				
			||||||
 | 
								Dock *pred = st->docks;
 | 
				
			||||||
 | 
								while (pred->next != removing_dock) pred = pred->next;
 | 
				
			||||||
 | 
								pred->next = removing_dock->next;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							delete removing_dock;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		DoClearSquare(tile1);
 | 
							DoClearSquare(tile1);
 | 
				
			||||||
		MarkTileDirtyByTile(tile1);
 | 
							MarkTileDirtyByTile(tile1);
 | 
				
			||||||
		MakeWaterKeepingClass(tile2, st->owner);
 | 
							MakeWaterKeepingClass(tile2, st->owner);
 | 
				
			||||||
@@ -2707,8 +2737,11 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
 | 
				
			|||||||
		st->rect.AfterRemoveTile(st, tile1);
 | 
							st->rect.AfterRemoveTile(st, tile1);
 | 
				
			||||||
		st->rect.AfterRemoveTile(st, tile2);
 | 
							st->rect.AfterRemoveTile(st, tile2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		st->dock_tile = INVALID_TILE;
 | 
							st->dock_station.Clear();
 | 
				
			||||||
		st->facilities &= ~FACIL_DOCK;
 | 
							for (Dock *dock = st->docks; dock != NULL; dock = dock->next) {
 | 
				
			||||||
 | 
								st->dock_station.Add(dock->flat);
 | 
				
			||||||
 | 
								st->dock_station.Add(dock->sloped);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Company::Get(st->owner)->infrastructure.station -= 2;
 | 
							Company::Get(st->owner)->infrastructure.station -= 2;
 | 
				
			||||||
		DirtyCompanyInfrastructureWindows(st->owner);
 | 
							DirtyCompanyInfrastructureWindows(st->owner);
 | 
				
			||||||
@@ -4028,8 +4061,17 @@ void BuildOilRig(TileIndex tile)
 | 
				
			|||||||
	st->owner = OWNER_NONE;
 | 
						st->owner = OWNER_NONE;
 | 
				
			||||||
	st->airport.type = AT_OILRIG;
 | 
						st->airport.type = AT_OILRIG;
 | 
				
			||||||
	st->airport.Add(tile);
 | 
						st->airport.Add(tile);
 | 
				
			||||||
	st->dock_tile = tile;
 | 
						st->dock_station.tile = tile;
 | 
				
			||||||
	st->facilities = FACIL_AIRPORT | FACIL_DOCK;
 | 
						st->facilities = FACIL_AIRPORT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!Dock::CanAllocateItem()) {
 | 
				
			||||||
 | 
							DEBUG(misc, 0, "Can't allocate dock for oilrig at 0x%X, reverting to oilrig with airport only", tile);
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							st->docks = new Dock(tile, tile + ToTileIndexDiff({1, 0}));
 | 
				
			||||||
 | 
							st->dock_station.tile = tile;
 | 
				
			||||||
 | 
							st->facilities |= FACIL_DOCK;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	st->build_date = _date;
 | 
						st->build_date = _date;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	st->rect.BeforeAddTile(tile, StationRect::ADD_FORCE);
 | 
						st->rect.BeforeAddTile(tile, StationRect::ADD_FORCE);
 | 
				
			||||||
@@ -4047,7 +4089,11 @@ void DeleteOilRig(TileIndex tile)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	MakeWaterKeepingClass(tile, OWNER_NONE);
 | 
						MakeWaterKeepingClass(tile, OWNER_NONE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	st->dock_tile = INVALID_TILE;
 | 
						st->dock_station.tile = INVALID_TILE;
 | 
				
			||||||
 | 
						if (st->docks != NULL) {
 | 
				
			||||||
 | 
							delete st->docks;
 | 
				
			||||||
 | 
							st->docks = NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	st->airport.Clear();
 | 
						st->airport.Clear();
 | 
				
			||||||
	st->facilities &= ~(FACIL_AIRPORT | FACIL_DOCK);
 | 
						st->facilities &= ~(FACIL_AIRPORT | FACIL_DOCK);
 | 
				
			||||||
	st->airport.flags = 0;
 | 
						st->airport.flags = 0;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,10 +19,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
typedef uint16 StationID;
 | 
					typedef uint16 StationID;
 | 
				
			||||||
typedef uint16 RoadStopID;
 | 
					typedef uint16 RoadStopID;
 | 
				
			||||||
 | 
					typedef uint16 DockID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct BaseStation;
 | 
					struct BaseStation;
 | 
				
			||||||
struct Station;
 | 
					struct Station;
 | 
				
			||||||
struct RoadStop;
 | 
					struct RoadStop;
 | 
				
			||||||
 | 
					struct Dock;
 | 
				
			||||||
struct StationSpec;
 | 
					struct StationSpec;
 | 
				
			||||||
struct Waypoint;
 | 
					struct Waypoint;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user