src/train_cmd.cpp
changeset 6498 aff910a05c6e
parent 6481 c069e5454782
child 6501 1e95e8d993ff
equal deleted inserted replaced
6497:b7170a1ffb33 6498:aff910a05c6e
    65 
    65 
    66 	for (const Vehicle *u = v; u != NULL; u = u->next) {
    66 	for (const Vehicle *u = v; u != NULL; u = u->next) {
    67 		/* Power is not added for articulated parts */
    67 		/* Power is not added for articulated parts */
    68 		if (IsArticulatedPart(u)) continue;
    68 		if (IsArticulatedPart(u)) continue;
    69 
    69 
    70 		RailType railtype = (IsLevelCrossingTile(u->tile) ? GetRailTypeCrossing(u->tile) : GetRailType(u->tile));
    70 		RailType railtype = GetRailType(u->tile);
    71 		bool engine_has_power = HasPowerOnRail(u->u.rail.railtype, railtype);
    71 		bool engine_has_power = HasPowerOnRail(u->u.rail.railtype, railtype);
    72 		bool wagon_has_power  = HasPowerOnRail(v->u.rail.railtype, railtype);
    72 		bool wagon_has_power  = HasPowerOnRail(v->u.rail.railtype, railtype);
    73 
    73 
    74 		const RailVehicleInfo *rvi_u = RailVehInfo(u->engine_type);
    74 		const RailVehicleInfo *rvi_u = RailVehInfo(u->engine_type);
    75 
    75 
  2703 static bool CheckCompatibleRail(const Vehicle *v, TileIndex tile)
  2703 static bool CheckCompatibleRail(const Vehicle *v, TileIndex tile)
  2704 {
  2704 {
  2705 	return
  2705 	return
  2706 		IsTileOwner(tile, v->owner) && (
  2706 		IsTileOwner(tile, v->owner) && (
  2707 			!IsFrontEngine(v) ||
  2707 			!IsFrontEngine(v) ||
  2708 			HASBIT(
  2708 			HASBIT(v->u.rail.compatible_railtypes, GetRailType(tile))
  2709 				v->u.rail.compatible_railtypes,
       
  2710 				IsTileType(tile, MP_STREET) ? GetRailTypeCrossing(tile) : GetRailType(tile)
       
  2711 			)
       
  2712 		);
  2709 		);
  2713 }
  2710 }
  2714 
  2711 
  2715 typedef struct {
  2712 typedef struct {
  2716 	byte small_turn, large_turn;
  2713 	byte small_turn, large_turn;