rail_cmd.c
changeset 3777 bffc9d12cfba
parent 3775 f3f1ba3111fa
child 3778 1d32787783cf
equal deleted inserted replaced
3776:1a8d467577f4 3777:bffc9d12cfba
   850 
   850 
   851 static int32 DoConvertRail(TileIndex tile, RailType totype, bool exec)
   851 static int32 DoConvertRail(TileIndex tile, RailType totype, bool exec)
   852 {
   852 {
   853 	if (!CheckTileOwnership(tile)) return CMD_ERROR;
   853 	if (!CheckTileOwnership(tile)) return CMD_ERROR;
   854 
   854 
   855 	if (!EnsureNoVehicle(tile) && (!IsCompatibleRail(GetRailType(tile), totype) || IsPlainRailTile(tile))) return CMD_ERROR;
   855 	if (!(EnsureNoVehicle(tile) || (GetRailType(tile) == RAILTYPE_RAIL && totype == RAILTYPE_ELECTRIC)) && (!IsCompatibleRail(GetRailType(tile), totype) || IsPlainRailTile(tile))) return CMD_ERROR;
   856 
   856 
   857 	// tile is already of requested type?
   857 	// tile is already of requested type?
   858 	if (GetRailType(tile) == totype) return CMD_ERROR;
   858 	if (GetRailType(tile) == totype) return CMD_ERROR;
   859 
   859 
   860 	// change type.
   860 	// change type.