# HG changeset patch # User hackykid # Date 1120489135 0 # Node ID c9d6585c96c8c9b7d69ce62dd8a6f4e7d71c45fb # Parent b3bdf698ee26f59e0be087ab715d2ce8cf00ad77 (svn r2516) - Feature: [pbs] Implement path-based-signalling. This allows multiple trains within the same signal block, provided their paths dont intersect. For this the block must have all exit and entry signals be pbs signals. Place these by ctrl-clicking 4 times on a normal signal. - Feature: [pbs] Implement autoplacement of pbs blocks, when a block has an entry and an exit pbs signal, covert the entire block to pbs. Can be turned off in the patch settings. - Feature: [pbs] Allow showing of reserved status by making the tracks darker, when the pbs debug level is at least 1. diff -r b3bdf698ee26 -r c9d6585c96c8 Makefile --- a/Makefile Mon Jul 04 10:01:06 2005 +0000 +++ b/Makefile Mon Jul 04 14:58:55 2005 +0000 @@ -651,6 +651,7 @@ 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 -r b3bdf698ee26 -r c9d6585c96c8 ai_pathfinder.c --- a/ai_pathfinder.c Mon Jul 04 10:01:06 2005 +0000 +++ b/ai_pathfinder.c Mon Jul 04 14:58:55 2005 +0000 @@ -97,6 +97,8 @@ result->FoundEndNode = AyStar_AiPathFinder_FoundEndNode; result->GetNeighbours = AyStar_AiPathFinder_GetNeighbours; + result->BeforeExit = NULL; + result->free = AyStar_AiPathFinder_Free; // Set some information diff -r b3bdf698ee26 -r c9d6585c96c8 aystar.c --- a/aystar.c Mon Jul 04 10:01:06 2005 +0000 +++ b/aystar.c Mon Jul 04 14:58:55 2005 +0000 @@ -230,6 +230,10 @@ 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 -r b3bdf698ee26 -r c9d6585c96c8 aystar.h --- a/aystar.h Mon Jul 04 10:01:06 2005 +0000 +++ b/aystar.h Mon Jul 04 14:58:55 2005 +0000 @@ -96,6 +96,11 @@ */ 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 @@ 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 -r b3bdf698ee26 -r c9d6585c96c8 data/nsignalsw.grf Binary file data/nsignalsw.grf has changed diff -r b3bdf698ee26 -r c9d6585c96c8 data/signalsw.grf Binary file data/signalsw.grf has changed diff -r b3bdf698ee26 -r c9d6585c96c8 debug.c --- a/debug.c Mon Jul 04 10:01:06 2005 +0000 +++ b/debug.c Mon Jul 04 14:58:55 2005 +0000 @@ -14,6 +14,7 @@ int _debug_net_level; int _debug_spritecache_level; int _debug_oldloader_level; +int _debug_pbs_level; int _debug_npf_level; @@ -44,6 +45,7 @@ DEBUG_LEVEL(net), DEBUG_LEVEL(spritecache), DEBUG_LEVEL(oldloader), + DEBUG_LEVEL(pbs), DEBUG_LEVEL(npf) }; #undef DEBUG_LEVEL diff -r b3bdf698ee26 -r c9d6585c96c8 debug.h --- a/debug.h Mon Jul 04 10:01:06 2005 +0000 +++ b/debug.h Mon Jul 04 14:58:55 2005 +0000 @@ -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 -r b3bdf698ee26 -r c9d6585c96c8 docs/landscape.html --- a/docs/landscape.html Mon Jul 04 10:01:06 2005 +0000 +++ b/docs/landscape.html Mon Jul 04 14:58:55 2005 +0000 @@ -93,11 +93,12 @@
  • 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 @@ 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 @@ @@ -542,6 +550,8 @@
  • 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