train_cmd.c
changeset 2874 3dcc067a7946
parent 2855 56c39efde08a
child 2883 90f7db6e078e
equal deleted inserted replaced
2873:64296f203ac4 2874:3dcc067a7946
  3292 static bool TrainCheckIfLineEnds(Vehicle *v)
  3292 static bool TrainCheckIfLineEnds(Vehicle *v)
  3293 {
  3293 {
  3294 	TileIndex tile;
  3294 	TileIndex tile;
  3295 	uint x,y;
  3295 	uint x,y;
  3296 	uint16 break_speed;
  3296 	uint16 break_speed;
  3297 	int t;
  3297 	DiagDirection t;
  3298 	uint32 ts;
  3298 	uint32 ts;
  3299 	byte trackdir;
  3299 	byte trackdir;
  3300 
  3300 
  3301 	t = v->breakdown_ctr;
  3301 	t = v->breakdown_ctr;
  3302 	if (t > 1) {
  3302 	if (t > 1) {
  3366 		x = (~y) + x + 8;
  3366 		x = (~y) + x + 8;
  3367 		break;
  3367 		break;
  3368 	}
  3368 	}
  3369 
  3369 
  3370 	if (GB(ts, 0, 16) != 0) {
  3370 	if (GB(ts, 0, 16) != 0) {
  3371 		/* If we approach a rail-piece which we can't enter, don't enter it! */
  3371 		/* If we approach a rail-piece which we can't enter, or the back of a depot, don't enter it! */
  3372 		if (x + 4 > 15 && !CheckCompatibleRail(v, tile)) {
  3372 		if (x + 4 > 15 &&
       
  3373 				(!CheckCompatibleRail(v, tile) ||
       
  3374 				(IsTileDepotType(tile, TRANSPORT_RAIL) &&
       
  3375 				GetDepotDirection(tile, TRANSPORT_RAIL) == t))) {
  3373 			v->cur_speed = 0;
  3376 			v->cur_speed = 0;
  3374 			ReverseTrainDirection(v);
  3377 			ReverseTrainDirection(v);
  3375 			return false;
  3378 			return false;
  3376 		}
  3379 		}
  3377 		if ((ts &= (ts >> 16)) == 0) {
  3380 		if ((ts &= (ts >> 16)) == 0) {