diff --git a/Makefile b/Makefile index be76e3d741..c1e20799cd 100644 --- a/Makefile +++ b/Makefile @@ -651,6 +651,7 @@ C_SOURCES += order_cmd.c C_SOURCES += order_gui.c C_SOURCES += openttd.c C_SOURCES += pathfind.c +C_SOURCES += pbs.c C_SOURCES += player_gui.c C_SOURCES += players.c C_SOURCES += pool.c diff --git a/ai_pathfinder.c b/ai_pathfinder.c index a3ddda9829..f26cead738 100644 --- a/ai_pathfinder.c +++ b/ai_pathfinder.c @@ -97,6 +97,8 @@ AyStar *new_AyStar_AiPathFinder(int max_tiles_around, Ai_PathFinderInfo *PathFin result->FoundEndNode = AyStar_AiPathFinder_FoundEndNode; result->GetNeighbours = AyStar_AiPathFinder_GetNeighbours; + result->BeforeExit = NULL; + result->free = AyStar_AiPathFinder_Free; // Set some information diff --git a/aystar.c b/aystar.c index e2f9109fed..785746185b 100644 --- a/aystar.c +++ b/aystar.c @@ -230,6 +230,10 @@ int AyStarMain_Main(AyStar *aystar) { else if (r == AYSTAR_LIMIT_REACHED) printf("[AyStar] Exceeded search_nodes, no path found\n"); #endif + + if (aystar->BeforeExit != NULL) + aystar->BeforeExit(aystar); + if (r != AYSTAR_STILL_BUSY) /* We're done, clean up */ aystar->clear(aystar); diff --git a/aystar.h b/aystar.h index adda33abab..52c93e9119 100644 --- a/aystar.h +++ b/aystar.h @@ -96,6 +96,11 @@ typedef void AyStar_GetNeighbours(AyStar *aystar, OpenListNode *current); */ typedef void AyStar_FoundEndNode(AyStar *aystar, OpenListNode *current); +/* + * Is called when aystar ends it pathfinding, but before cleanup. + */ +typedef void AyStar_BeforeExit(AyStar *aystar); + // For internal use, see aystar.c typedef void AyStar_AddStartNode(AyStar *aystar, AyStarNode* start_node, uint g); typedef int AyStar_Main(AyStar *aystar); @@ -115,6 +120,7 @@ struct AyStar { AyStar_GetNeighbours* GetNeighbours; AyStar_EndNodeCheck* EndNodeCheck; AyStar_FoundEndNode* FoundEndNode; + AyStar_BeforeExit* BeforeExit; /* These are completely untouched by AyStar, they can be accesed by * the application specific routines to input and output data. diff --git a/data/nsignalsw.grf b/data/nsignalsw.grf new file mode 100644 index 0000000000..03dee78637 Binary files /dev/null and b/data/nsignalsw.grf differ diff --git a/data/signalsw.grf b/data/signalsw.grf deleted file mode 100644 index ca78876d09..0000000000 Binary files a/data/signalsw.grf and /dev/null differ diff --git a/debug.c b/debug.c index 3230c96d7d..fe36348fc8 100644 --- a/debug.c +++ b/debug.c @@ -14,6 +14,7 @@ int _debug_ms_level; int _debug_net_level; int _debug_spritecache_level; int _debug_oldloader_level; +int _debug_pbs_level; int _debug_npf_level; @@ -44,6 +45,7 @@ typedef struct DebugLevel { DEBUG_LEVEL(net), DEBUG_LEVEL(spritecache), DEBUG_LEVEL(oldloader), + DEBUG_LEVEL(pbs), DEBUG_LEVEL(npf) }; #undef DEBUG_LEVEL diff --git a/debug.h b/debug.h index 44237fecaa..320e1d5dea 100644 --- a/debug.h +++ b/debug.h @@ -14,6 +14,7 @@ extern int _debug_net_level; extern int _debug_spritecache_level; extern int _debug_oldloader_level; + extern int _debug_pbs_level; extern int _debug_npf_level; #endif diff --git a/docs/landscape.html b/docs/landscape.html index de298b09de..7bbed0a5eb 100644 --- a/docs/landscape.html +++ b/docs/landscape.html @@ -93,11 +93,12 @@ map5 bit 7 clear: railway track
  • map2 bits 7..4: bit clear = signal shows red; same bits as in map3_lo
  • OpenTTD bits in map3_hi: - - - - - + + + + + +
    bits 1..0: type of signal:
    00: normal signals
    01: pre-signals
    10: exit-signals
    11: combo-signals
    bits 2..0: type of signal:
    000: normal signals
    001: pre-signals
    010: exit-signals
    011: combo-signals
    100: PBS signals
    bit 3: set = semaphore signals, clear = light signals
  • @@ -120,7 +121,11 @@ map5 bit 7 clear: railway track C  on snow or desert
  • map3_lo bits 0..3 = track type: 0 - conventional railway, 1 - monorail, 2 - maglev -
  • +
  • map3_lo bits 4..7 = Pbs reserved status: + + + +
    bits 4..6  'Track'number of reserved track + 1, if this is zero it means nothing is reserved on this tile
    bit 7  If this is set, then the opposite track ('Track'number^1) is also reserved
  • map5 bits 7 and 6 set: railway depot / checkpoints @@ -157,6 +163,7 @@ map5 bit 4 set, bits 7..5 clear: level crossing @@ -542,6 +550,8 @@ map5 bits 7..4 clear: tunnel entrance/exit
  • map_owner: owner of the tunnel
  • map3_lo bits 3..0 = track type for railway tunnel, must be 0 for road tunnel
  • map3_hi bit 7 set = on snow or desert
  • +
  • map3hi bit 0 set = track with 'Track'number 0 is reserved by pbs
  • +
  • map3hi bit 1 set = track with 'Track'number 1 is reserved by pbs
  • map5 bit 7 set: bridge