1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 13:39:09 +00:00

(svn r1751) - Feature: New PathFinder (NPF).

- Supports trains, road vehicles and ships.
	- Uses A* pathfinding (same codebase as the new ai).
	- Currently unlimited search depth, so might perform badly on large maps/networks (especially ships).
	- Will always find a route if there is one.
	- Allows custom penalties for obstacles to be set in openttd.cfg (npf_ values).
	- With NPF enabled, ships can have orders that are very far apart. Be careful, this will break (ships get lost) when the old pathfinder is used again.
- Feature: Disabling 90 degree turns for trains and ships.
	- Requires NPF to be enabled.
	- Ships and trains can no longer make weird 90 degree turns on tile borders.
- Codechange: Removed table/directions.h.
	- table/directions.h contained ugly static tables but was included more than once. The tables, along with a few new ones are in npf.[ch] now. Better suggestions for a location?
- Fix: Binary heap in queue.c did not allocate enough space, resulting in a segfault.
- Codechange: Rewritten FindFirstBit2x64, added KillFirstBit2x64.
- Codechange: Introduced constant INVALID_TILE, to replace the usage of 0 as an invalid tile. Also replaces TILE_WRAPPED.
- Codechange: Moved TileAddWrap() to map.[ch] 
- Add TileIndexDiffCByDir(), TileIndexDiffCByDir(). 
- Codechange: Moved IsTrainStationTile() to station.h
- Add: IsRoadStationTile() and GetRoadStationDir().
This commit is contained in:
matthijs
2005-01-31 11:23:10 +00:00
parent b64c375f2f
commit a2dec6c32a
25 changed files with 1418 additions and 265 deletions

View File

@@ -128,6 +128,7 @@ typedef struct Patches {
bool nonuniform_stations;// allow nonuniform train stations
bool always_small_airport; // always allow small airports
bool realistic_acceleration; // realistic acceleration for trains
bool forbid_90_deg; // forbid trains to make 90 deg turns
bool invisible_trees; // don't show trees when buildings are transparent
bool no_servicing_if_no_breakdowns; // dont send vehicles to depot when breakdowns are disabled
@@ -186,6 +187,13 @@ typedef struct Patches {
byte drag_signals_density; // many signals density
bool ainew_active; // Is the new AI active?
/* New Path Finding */
bool new_pathfinding_all; /* Use the newest pathfinding algorithm for all */
uint32 npf_rail_firstred_penalty; /* The penalty for when the first signal is red */
uint32 npf_rail_station_penalty; /* The penalty for station tiles */
uint32 npf_rail_slope_penalty; /* The penalty for sloping upwards */
bool population_in_label; // Show the population of a town in his label?
} Patches;
@@ -434,6 +442,9 @@ VARDEF byte _vehicle_design_names;
/* tunnelbridge */
#define MAX_BRIDGES 13
/* For new pathfinding. Define here so it is globally available */
#define NPF_TILE_LENGTH 100
/* Autoreplace vehicle stuff*/
VARDEF byte _autoreplace_array[256];
VARDEF uint16 _player_num_engines[256];