rail_cmd.c
branchcustombridgeheads
changeset 5603 f3aa14b91b0a
parent 5601 51f241d43769
child 5623 ef2a8a524a95
equal deleted inserted replaced
5602:de5228fb1871 5603:f3aa14b91b0a
   362 				MakeRoadNormal(tile, GetCrossingRoadOwner(tile), GetCrossingRoadBits(tile), GetTownIndex(tile));
   362 				MakeRoadNormal(tile, GetCrossingRoadOwner(tile), GetCrossingRoadBits(tile), GetTownIndex(tile));
   363 			}
   363 			}
   364 			break;
   364 			break;
   365 		}
   365 		}
   366 
   366 
       
   367 		case MP_RAILWAY_BRIDGE: {
       
   368 			TrackBits trackbits = GetTrackBits(tile);
       
   369 
       
   370 			/* The track the user is seeking to remove is not there */
       
   371 			if ((trackbits & trackbit) == 0) return CMD_ERROR;
       
   372 
       
   373 			trackbits ^= trackbit; /* configuration after removal */
       
   374 			/* For the time being, we make sure that the bridge has some kind of exit */
       
   375 			switch (GetBridgeRampDirection(tile)) {
       
   376 				case DIAGDIR_NE:
       
   377 					if ((trackbits & TRACK_BIT_3WAY_NE) == 0) return CMD_ERROR;
       
   378 					break;
       
   379 				case DIAGDIR_SE:
       
   380 					if ((trackbits & TRACK_BIT_3WAY_SE) == 0) return CMD_ERROR;
       
   381 					break;
       
   382 				case DIAGDIR_SW:
       
   383 					if ((trackbits & TRACK_BIT_3WAY_SW) == 0) return CMD_ERROR;
       
   384 					break;
       
   385 				case DIAGDIR_NW:
       
   386 					if ((trackbits & TRACK_BIT_3WAY_NW) == 0) return CMD_ERROR;
       
   387 					break;
       
   388 				default:
       
   389 					NOT_REACHED();
       
   390 			}
       
   391 		} /* Fall through */
       
   392 
   367 		case MP_RAILWAY: {
   393 		case MP_RAILWAY: {
   368 			TrackBits present;
   394 			TrackBits present;
   369 
   395 
   370 			if (!IsPlainRailTile(tile) ||
   396 			if (!IsPlainRailTile(tile) ||
   371 					(_current_player != OWNER_WATER && !CheckTileOwnership(tile)) ||
   397 					(_current_player != OWNER_WATER && !CheckTileOwnership(tile)) ||