Changeset - r2874:99c420424735
[Not reviewed]
master
0 1 0
peter1138 - 19 years ago 2006-01-23 21:05:05
peter1138@openttd.org
(svn r3422) - Fix: If an engine reaches the rear of a depot, make the engine turn around before it reaches the tile end (same as a normal end of line.) This fixes a bug whereby the engine could poke into the depot and crash with another engine just leaving it.
1 file changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
train_cmd.c
Show inline comments
 
@@ -3291,13 +3291,13 @@ static const byte _breakdown_speeds[16] 
 

	
 
static bool TrainCheckIfLineEnds(Vehicle *v)
 
{
 
	TileIndex tile;
 
	uint x,y;
 
	uint16 break_speed;
 
	int t;
 
	DiagDirection t;
 
	uint32 ts;
 
	byte trackdir;
 

	
 
	t = v->breakdown_ctr;
 
	if (t > 1) {
 
		v->vehstatus |= VS_TRAIN_SLOWING;
 
@@ -3365,14 +3365,17 @@ static bool TrainCheckIfLineEnds(Vehicle
 
	case 6:
 
		x = (~y) + x + 8;
 
		break;
 
	}
 

	
 
	if (GB(ts, 0, 16) != 0) {
 
		/* If we approach a rail-piece which we can't enter, don't enter it! */
 
		if (x + 4 > 15 && !CheckCompatibleRail(v, tile)) {
 
		/* If we approach a rail-piece which we can't enter, or the back of a depot, don't enter it! */
 
		if (x + 4 > 15 &&
 
				(!CheckCompatibleRail(v, tile) ||
 
				(IsTileDepotType(tile, TRANSPORT_RAIL) &&
 
				GetDepotDirection(tile, TRANSPORT_RAIL) == t))) {
 
			v->cur_speed = 0;
 
			ReverseTrainDirection(v);
 
			return false;
 
		}
 
		if ((ts &= (ts >> 16)) == 0) {
 
			// make a rail/road crossing red
0 comments (0 inline, 0 general)