Changeset - r2451:d5fea856d273
[Not reviewed]
master
0 1 0
hackykid - 19 years ago 2005-09-23 17:37:21
hackykid@openttd.org
(svn r2977) - CodeChange: [pbs] Use a check to see if a rail segment is a pbs segment, instead of letting the pathfinder determine this.
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
train_cmd.c
Show inline comments
 
@@ -2737,25 +2737,25 @@ static void TrainController(Vehicle *v)
 
				}
 

	
 
				if (prev == NULL) {
 
					byte trackdir;
 
					/* Currently the locomotive is active. Determine which one of the
 
					 * available tracks to choose */
 
					chosen_track = 1 << ChooseTrainTrack(v, gp.new_tile, enterdir, bits);
 
					assert(chosen_track & tracks);
 

	
 
					trackdir = TrackEnterdirToTrackdir(FIND_FIRST_BIT(chosen_track), enterdir);
 
					assert(trackdir != 0xff);
 

	
 
					if (PBSIsPbsSignal(gp.new_tile,trackdir)) {
 
					if (PBSIsPbsSignal(gp.new_tile,trackdir) && PBSIsPbsSegment(gp.new_tile,trackdir)) {
 
						// encountered a pbs signal, and possible a pbs block
 
						DEBUG(pbs, 3) ("pbs: (%i) arrive AT signal, tile:%x  pbs_stat:%i",v->unitnumber, gp.new_tile, v->u.rail.pbs_status);
 

	
 
						if (v->u.rail.pbs_status == PBS_STAT_NONE) {
 
							// we havent planned a path already, so try to find one now
 
							NPFFindStationOrTileData fstd;
 
							NPFFoundTargetData ftd;
 

	
 
							NPFFillWithOrderData(&fstd, v);
 

	
 
							DEBUG(pbs, 2) ("pbs: (%i) choose signal (TC), tile:%x, trackdir:%i",v->unitnumber,  gp.new_tile, trackdir);
 
							ftd = NPFRouteToStationOrTile(gp.new_tile, trackdir, &fstd, TRANSPORT_RAIL, v->owner, v->u.rail.railtype, PBS_MODE_GREEN);
 
@@ -3175,25 +3175,25 @@ static bool TrainCheckIfLineEnds(Vehicle
 
			}
 
			return true;
 
		}
 
	} else if (x + 4 > 15) {
 
		v->cur_speed = 0;
 
		ReverseTrainDirection(v);
 
		return false;
 
	}
 

	
 
	if  (v->u.rail.pbs_status == PBS_STAT_HAS_PATH)
 
		return true;
 

	
 
	if ((trackdir != INVALID_TRACKDIR) && (PBSIsPbsSignal(tile,trackdir)) && !(IsTileType(v->tile, MP_STATION) && (v->current_order.station == _m[v->tile].m2))) {
 
	if ((trackdir != INVALID_TRACKDIR) && (PBSIsPbsSignal(tile,trackdir) && PBSIsPbsSegment(tile,trackdir)) && !(IsTileType(v->tile, MP_STATION) && (v->current_order.station == _m[v->tile].m2))) {
 
		NPFFindStationOrTileData fstd;
 
		NPFFoundTargetData ftd;
 

	
 
		NPFFillWithOrderData(&fstd, v);
 

	
 
		DEBUG(pbs, 2) ("pbs: (%i) choose signal (CEOL), tile:%x  trackdir:%i", v->unitnumber, tile, trackdir);
 
		ftd = NPFRouteToStationOrTile(tile, trackdir, &fstd, TRANSPORT_RAIL, v->owner, v->u.rail.railtype, PBS_MODE_GREEN);
 

	
 
		if (ftd.best_trackdir != 0xFF && NPFGetFlag(&ftd.node, NPF_FLAG_PBS_EXIT)) {
 
			if (!(NPFGetFlag(&ftd.node, NPF_FLAG_PBS_BLOCKED) || NPFGetFlag(&ftd.node, NPF_FLAG_PBS_RED))) {
 
				v->u.rail.pbs_status = PBS_STAT_HAS_PATH;
 
				v->u.rail.pbs_end_tile = ftd.node.tile;
0 comments (0 inline, 0 general)