Changeset - r23476:0c9f98112112
[Not reviewed]
projects/openttd_vs140.vcxproj
Show inline comments
 
@@ -1288,14 +1288,12 @@
 
    <ClCompile Include="..\src\network\core\tcp_http.cpp" />
 
    <ClInclude Include="..\src\network\core\tcp_http.h" />
 
    <ClInclude Include="..\src\network\core\tcp_listen.h" />
 
    <ClCompile Include="..\src\network\core\udp.cpp" />
 
    <ClInclude Include="..\src\network\core\udp.h" />
 
    <ClInclude Include="..\src\pathfinder\follow_track.hpp" />
 
    <ClCompile Include="..\src\pathfinder\opf\opf_ship.cpp" />
 
    <ClInclude Include="..\src\pathfinder\opf\opf_ship.h" />
 
    <ClInclude Include="..\src\pathfinder\pathfinder_func.h" />
 
    <ClInclude Include="..\src\pathfinder\pathfinder_type.h" />
 
    <ClInclude Include="..\src\pathfinder\pf_performance_timer.hpp" />
 
    <ClCompile Include="..\src\pathfinder\npf\aystar.cpp" />
 
    <ClInclude Include="..\src\pathfinder\npf\aystar.h" />
 
    <ClCompile Include="..\src\pathfinder\npf\npf.cpp" />
projects/openttd_vs140.vcxproj.filters
Show inline comments
 
@@ -2958,18 +2958,12 @@
 
    <ClInclude Include="..\src\network\core\udp.h">
 
      <Filter>Network Core</Filter>
 
    </ClInclude>
 
    <ClInclude Include="..\src\pathfinder\follow_track.hpp">
 
      <Filter>Pathfinder</Filter>
 
    </ClInclude>
 
    <ClCompile Include="..\src\pathfinder\opf\opf_ship.cpp">
 
      <Filter>Pathfinder</Filter>
 
    </ClCompile>
 
    <ClInclude Include="..\src\pathfinder\opf\opf_ship.h">
 
      <Filter>Pathfinder</Filter>
 
    </ClInclude>
 
    <ClInclude Include="..\src\pathfinder\pathfinder_func.h">
 
      <Filter>Pathfinder</Filter>
 
    </ClInclude>
 
    <ClInclude Include="..\src\pathfinder\pathfinder_type.h">
 
      <Filter>Pathfinder</Filter>
 
    </ClInclude>
projects/openttd_vs141.vcxproj
Show inline comments
 
@@ -1288,14 +1288,12 @@
 
    <ClCompile Include="..\src\network\core\tcp_http.cpp" />
 
    <ClInclude Include="..\src\network\core\tcp_http.h" />
 
    <ClInclude Include="..\src\network\core\tcp_listen.h" />
 
    <ClCompile Include="..\src\network\core\udp.cpp" />
 
    <ClInclude Include="..\src\network\core\udp.h" />
 
    <ClInclude Include="..\src\pathfinder\follow_track.hpp" />
 
    <ClCompile Include="..\src\pathfinder\opf\opf_ship.cpp" />
 
    <ClInclude Include="..\src\pathfinder\opf\opf_ship.h" />
 
    <ClInclude Include="..\src\pathfinder\pathfinder_func.h" />
 
    <ClInclude Include="..\src\pathfinder\pathfinder_type.h" />
 
    <ClInclude Include="..\src\pathfinder\pf_performance_timer.hpp" />
 
    <ClCompile Include="..\src\pathfinder\npf\aystar.cpp" />
 
    <ClInclude Include="..\src\pathfinder\npf\aystar.h" />
 
    <ClCompile Include="..\src\pathfinder\npf\npf.cpp" />
projects/openttd_vs141.vcxproj.filters
Show inline comments
 
@@ -2958,18 +2958,12 @@
 
    <ClInclude Include="..\src\network\core\udp.h">
 
      <Filter>Network Core</Filter>
 
    </ClInclude>
 
    <ClInclude Include="..\src\pathfinder\follow_track.hpp">
 
      <Filter>Pathfinder</Filter>
 
    </ClInclude>
 
    <ClCompile Include="..\src\pathfinder\opf\opf_ship.cpp">
 
      <Filter>Pathfinder</Filter>
 
    </ClCompile>
 
    <ClInclude Include="..\src\pathfinder\opf\opf_ship.h">
 
      <Filter>Pathfinder</Filter>
 
    </ClInclude>
 
    <ClInclude Include="..\src\pathfinder\pathfinder_func.h">
 
      <Filter>Pathfinder</Filter>
 
    </ClInclude>
 
    <ClInclude Include="..\src\pathfinder\pathfinder_type.h">
 
      <Filter>Pathfinder</Filter>
 
    </ClInclude>
projects/openttd_vs142.vcxproj
Show inline comments
 
@@ -1288,14 +1288,12 @@
 
    <ClCompile Include="..\src\network\core\tcp_http.cpp" />
 
    <ClInclude Include="..\src\network\core\tcp_http.h" />
 
    <ClInclude Include="..\src\network\core\tcp_listen.h" />
 
    <ClCompile Include="..\src\network\core\udp.cpp" />
 
    <ClInclude Include="..\src\network\core\udp.h" />
 
    <ClInclude Include="..\src\pathfinder\follow_track.hpp" />
 
    <ClCompile Include="..\src\pathfinder\opf\opf_ship.cpp" />
 
    <ClInclude Include="..\src\pathfinder\opf\opf_ship.h" />
 
    <ClInclude Include="..\src\pathfinder\pathfinder_func.h" />
 
    <ClInclude Include="..\src\pathfinder\pathfinder_type.h" />
 
    <ClInclude Include="..\src\pathfinder\pf_performance_timer.hpp" />
 
    <ClCompile Include="..\src\pathfinder\npf\aystar.cpp" />
 
    <ClInclude Include="..\src\pathfinder\npf\aystar.h" />
 
    <ClCompile Include="..\src\pathfinder\npf\npf.cpp" />
projects/openttd_vs142.vcxproj.filters
Show inline comments
 
@@ -2958,18 +2958,12 @@
 
    <ClInclude Include="..\src\network\core\udp.h">
 
      <Filter>Network Core</Filter>
 
    </ClInclude>
 
    <ClInclude Include="..\src\pathfinder\follow_track.hpp">
 
      <Filter>Pathfinder</Filter>
 
    </ClInclude>
 
    <ClCompile Include="..\src\pathfinder\opf\opf_ship.cpp">
 
      <Filter>Pathfinder</Filter>
 
    </ClCompile>
 
    <ClInclude Include="..\src\pathfinder\opf\opf_ship.h">
 
      <Filter>Pathfinder</Filter>
 
    </ClInclude>
 
    <ClInclude Include="..\src\pathfinder\pathfinder_func.h">
 
      <Filter>Pathfinder</Filter>
 
    </ClInclude>
 
    <ClInclude Include="..\src\pathfinder\pathfinder_type.h">
 
      <Filter>Pathfinder</Filter>
 
    </ClInclude>
source.list
Show inline comments
 
@@ -1046,14 +1046,12 @@ network/core/tcp_http.h
 
network/core/tcp_listen.h
 
network/core/udp.cpp
 
network/core/udp.h
 

	
 
# Pathfinder
 
pathfinder/follow_track.hpp
 
pathfinder/opf/opf_ship.cpp
 
pathfinder/opf/opf_ship.h
 
pathfinder/pathfinder_func.h
 
pathfinder/pathfinder_type.h
 
pathfinder/pf_performance_timer.hpp
 

	
 
# NPF
 
pathfinder/npf/aystar.cpp
src/openttd.cpp
Show inline comments
 
@@ -431,13 +431,12 @@ struct AfterNewGRFScan : NewGRFScanCallb
 
		/* Since the default for the palette might have changed due to
 
		 * reading the configuration file, recalculate that now. */
 
		UpdateNewGRFConfigPalette();
 

	
 
		Game::Uninitialize(true);
 
		AI::Uninitialize(true);
 
		CheckConfig();
 
		LoadFromHighScore();
 
		LoadHotkeysFromConfig();
 
		WindowDesc::LoadFromConfig();
 

	
 
		/* We have loaded the config, so we may possibly save it. */
 
		*save_config_ptr = save_config;
src/pathfinder/opf/opf_ship.cpp
Show inline comments
 
deleted file
src/pathfinder/opf/opf_ship.h
Show inline comments
 
deleted file
src/saveload/afterload.cpp
Show inline comments
 
@@ -1872,13 +1872,13 @@ bool AfterLoadGame()
 
			_settings_game.pf.pathfinder_for_roadvehs = VPF_NPF;
 
		}
 

	
 
		if (_settings_game.pf.yapf.ship_use_yapf) {
 
			_settings_game.pf.pathfinder_for_ships = VPF_YAPF;
 
		} else {
 
			_settings_game.pf.pathfinder_for_ships = (_settings_game.pf.new_pathfinding_all ? VPF_NPF : VPF_OPF);
 
			_settings_game.pf.pathfinder_for_ships = VPF_NPF;
 
		}
 
	}
 

	
 
	if (IsSavegameVersionBefore(SLV_88)) {
 
		/* Profits are now with 8 bit fract */
 
		Vehicle *v;
src/saveload/saveload.h
Show inline comments
 
@@ -293,12 +293,13 @@ enum SaveLoadVersion : uint16 {
 
	SLV_FIX_CARGO_MONITOR,                  ///< 207  PR#7175 v1.9  Cargo monitor data packing fix to support 64 cargotypes.
 
	SLV_TOWN_CARGOGEN,                      ///< 208  PR#6965 New algorithms for town building cargo generation.
 
	SLV_SHIP_CURVE_PENALTY,                 ///< 209  PR#7289 Configurable ship curve penalties.
 

	
 
	SLV_SERVE_NEUTRAL_INDUSTRIES,           ///< 210  PR#7234 Company stations can serve industries with attached neutral stations.
 
	SLV_ROADVEH_PATH_CACHE,                 ///< 211  PR#7261 Add path cache for road vehicles.
 
	SLV_REMOVE_OPF,                         ///< 212  PR#7245 Remove OPF.
 

	
 
	SL_MAX_VERSION,                         ///< Highest possible saveload version
 
};
 

	
 
/** Save or load result codes. */
 
enum SaveOrLoadResult {
src/settings.cpp
Show inline comments
 
@@ -2272,24 +2272,12 @@ static void Check_PATS()
 

	
 
static void Save_PATS()
 
{
 
	SaveSettings(_settings, &_settings_game);
 
}
 

	
 
void CheckConfig()
 
{
 
	/*
 
	 * Increase old default values for pf_maxdepth and pf_maxlength
 
	 * to support big networks.
 
	 */
 
	if (_settings_newgame.pf.opf.pf_maxdepth == 16 && _settings_newgame.pf.opf.pf_maxlength == 512) {
 
		_settings_newgame.pf.opf.pf_maxdepth = 48;
 
		_settings_newgame.pf.opf.pf_maxlength = 4096;
 
	}
 
}
 

	
 
extern const ChunkHandler _setting_chunk_handlers[] = {
 
	{ 'OPTS', NULL,      Load_OPTS, NULL, NULL,       CH_RIFF},
 
	{ 'PATS', Save_PATS, Load_PATS, NULL, Check_PATS, CH_RIFF | CH_LAST},
 
};
 

	
 
static bool IsSignedVarMemType(VarType vt)
src/settings_func.h
Show inline comments
 
@@ -21,13 +21,12 @@ void IConsoleSetSetting(const char *name
 
void IConsoleSetSetting(const char *name, int32 value);
 
void IConsoleGetSetting(const char *name, bool force_newgame = false);
 
void IConsoleListSettings(const char *prefilter);
 

	
 
void LoadFromConfig(bool minimal = false);
 
void SaveToConfig();
 
void CheckConfig();
 

	
 
void IniLoadWindowSettings(IniFile *ini, const char *grpname, void *desc);
 
void IniSaveWindowSettings(IniFile *ini, const char *grpname, void *desc);
 

	
 
/* Functions to load and save NewGRF settings to a separate
 
 * configuration file, used for presets. */
src/settings_type.h
Show inline comments
 
@@ -343,18 +343,12 @@ struct AISettings {
 
/** Settings related to scripts. */
 
struct ScriptSettings {
 
	uint8  settings_profile;                 ///< difficulty profile to set initial settings of scripts, esp. random AIs
 
	uint32 script_max_opcode_till_suspend;   ///< max opcode calls till scripts will suspend
 
};
 

	
 
/** Settings related to the old pathfinder. */
 
struct OPFSettings {
 
	uint16 pf_maxlength;                     ///< maximum length when searching for a train route for new pathfinder
 
	byte   pf_maxdepth;                      ///< maximum recursion depth when searching for a train route for new pathfinder
 
};
 

	
 
/** Settings related to the new pathfinder. */
 
struct NPFSettings {
 
	/**
 
	 * The maximum amount of search nodes a single NPF run should take. This
 
	 * limit should make sure performance stays at acceptable levels at the cost
 
	 * of not being perfect anymore.
 
@@ -437,13 +431,12 @@ struct PathfinderSettings {
 
	byte   wait_twoway_signal;               ///< waitingtime in days before a twoway signal
 

	
 
	bool   reserve_paths;                    ///< always reserve paths regardless of signal type.
 
	byte   wait_for_pbs_path;                ///< how long to wait for a path reservation.
 
	byte   path_backoff_interval;            ///< ticks between checks for a free path.
 

	
 
	OPFSettings  opf;                        ///< pathfinder settings for the old pathfinder
 
	NPFSettings  npf;                        ///< pathfinder settings for the new pathfinder
 
	YAPFSettings yapf;                       ///< pathfinder settings for the yet another pathfinder
 
};
 

	
 
/** Settings related to orders. */
 
struct OrderSettings {
src/ship_cmd.cpp
Show inline comments
 
@@ -26,13 +26,12 @@
 
#include "window_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 
#include "sound_func.h"
 
#include "ai/ai.hpp"
 
#include "game/game.hpp"
 
#include "pathfinder/opf/opf_ship.h"
 
#include "engine_base.h"
 
#include "company_base.h"
 
#include "tunnelbridge_map.h"
 
#include "zoom_func.h"
 
#include "framerate_type.h"
 

	
 
@@ -175,13 +174,12 @@ static void CheckIfShipNeedsService(Vehi
 
		VehicleServiceInDepot(v);
 
		return;
 
	}
 

	
 
	uint max_distance;
 
	switch (_settings_game.pf.pathfinder_for_ships) {
 
		case VPF_OPF:  max_distance = 12; break;
 
		case VPF_NPF:  max_distance = _settings_game.pf.npf.maximum_go_to_depot_penalty  / NPF_TILE_LENGTH;  break;
 
		case VPF_YAPF: max_distance = _settings_game.pf.yapf.maximum_go_to_depot_penalty / YAPF_TILE_LENGTH; break;
 
		default: NOT_REACHED();
 
	}
 

	
 
	const Depot *depot = FindClosestShipDepot(v, max_distance);
 
@@ -366,15 +364,13 @@ static bool CheckShipLeaveDepot(Ship *v)
 

	
 
	TrackBits north_tracks = DiagdirReachesTracks(north_dir) & GetTileShipTrackStatus(north_neighbour);
 
	TrackBits south_tracks = DiagdirReachesTracks(south_dir) & GetTileShipTrackStatus(south_neighbour);
 
	if (north_tracks && south_tracks) {
 
		/* Ask pathfinder for best direction */
 
		bool reverse = false;
 
		bool path_found;
 
		switch (_settings_game.pf.pathfinder_for_ships) {
 
			case VPF_OPF: reverse = OPFShipChooseTrack(v, north_neighbour, north_dir, north_tracks, path_found) == INVALID_TRACK; break; // OPF always allows reversing
 
			case VPF_NPF: reverse = NPFShipCheckReverse(v); break;
 
			case VPF_YAPF: reverse = YapfShipCheckReverse(v); break;
 
			default: NOT_REACHED();
 
		}
 
		if (reverse) north_tracks = TRACK_BIT_NONE;
 
	}
 
@@ -489,13 +485,12 @@ static Track ChooseShipTrack(Ship *v, Ti
 

	
 
			/* Cached path is invalid so continue with pathfinder. */
 
			v->path.clear();
 
		}
 

	
 
		switch (_settings_game.pf.pathfinder_for_ships) {
 
			case VPF_OPF: track = OPFShipChooseTrack(v, tile, enterdir, tracks, path_found); break;
 
			case VPF_NPF: track = NPFShipChooseTrack(v, path_found); break;
 
			case VPF_YAPF: track = YapfShipChooseTrack(v, tile, enterdir, tracks, path_found, v->path); break;
 
			default: NOT_REACHED();
 
		}
 
	}
 

	
 
@@ -511,14 +506,13 @@ static Track ChooseShipTrack(Ship *v, Ti
 
 * @return The available trackbits on the next tile.
 
 */
 
static inline TrackBits GetAvailShipTracks(TileIndex tile, DiagDirection dir, Trackdir trackdir)
 
{
 
	TrackBits tracks = GetTileShipTrackStatus(tile) & DiagdirReachesTracks(dir);
 

	
 
	/* Do not remove 90 degree turns for OPF, as it isn't able to find paths taking it into account. */
 
	if (_settings_game.pf.forbid_90_deg && _settings_game.pf.pathfinder_for_ships != VPF_OPF) tracks &= ~TrackCrossesTracks(TrackdirToTrack(trackdir));
 
	if (_settings_game.pf.forbid_90_deg) tracks &= ~TrackCrossesTracks(TrackdirToTrack(trackdir));
 

	
 
	return tracks;
 
}
 

	
 
static const byte _ship_subcoord[4][6][3] = {
 
	{
src/table/settings.ini
Show inline comments
 
@@ -950,18 +950,18 @@ cat      = SC_EXPERT
 
base     = GameSettings
 
var      = pf.pathfinder_for_ships
 
type     = SLE_UINT8
 
from     = SLV_87
 
guiflags = SGF_MULTISTRING
 
def      = 2
 
min      = 0
 
min      = 1
 
max      = 2
 
interval = 1
 
str      = STR_CONFIG_SETTING_PATHFINDER_FOR_SHIPS
 
strhelp  = STR_CONFIG_SETTING_PATHFINDER_FOR_SHIPS_HELPTEXT
 
strval   = STR_CONFIG_SETTING_PATHFINDER_OPF
 
strval   = STR_CONFIG_SETTING_PATHFINDER_NPF
 
proc     = InvalidateShipPathCache
 
cat      = SC_EXPERT
 

	
 
[SDT_BOOL]
 
base     = GameSettings
 
var      = vehicle.never_expire_vehicles
 
@@ -1667,29 +1667,16 @@ from     = SLV_100
 
def      = 20
 
min      = 1
 
max      = 255
 
cat      = SC_EXPERT
 

	
 
##
 
[SDT_VAR]
 
base     = GameSettings
 
var      = pf.opf.pf_maxlength
 
type     = SLE_UINT16
 
def      = 4096
 
min      = 64
 
max      = 65535
 
cat      = SC_EXPERT
 

	
 
[SDT_VAR]
 
base     = GameSettings
 
var      = pf.opf.pf_maxdepth
 
type     = SLE_UINT8
 
def      = 48
 
min      = 4
 
max      = 255
 
cat      = SC_EXPERT
 
; Used to be pf.opf.pf_maxlength & pf.opf.pf_maxdepth
 
[SDT_NULL]
 
length   = 3
 
to       = SLV_REMOVE_OPF
 

	
 
##
 
[SDT_VAR]
 
base     = GameSettings
 
var      = pf.npf.npf_max_search_nodes
 
type     = SLE_UINT
src/vehicle_type.h
Show inline comments
 
@@ -57,13 +57,13 @@ struct BaseVehicle
 
};
 

	
 
static const VehicleID INVALID_VEHICLE = 0xFFFFF; ///< Constant representing a non-existing vehicle.
 

	
 
/** Pathfinding option states */
 
enum VehiclePathFinders {
 
	VPF_OPF  = 0, ///< The Original PathFinder (only for ships)
 
	// Original PathFinder (OPF) used to be 0
 
	VPF_NPF  = 1, ///< New PathFinder
 
	VPF_YAPF = 2, ///< Yet Another PathFinder
 
};
 

	
 
/** Flags to add to p1 for goto depot commands. */
 
enum DepotCommand {
0 comments (0 inline, 0 general)