src/station_cmd.cpp
branchnoai
changeset 9517 be1775555bbd
parent 9505 9711235f5693
child 9574 698395509d12
equal deleted inserted replaced
9516:defc90b7898a 9517:be1775555bbd
   248 	/* Check woods */
   248 	/* Check woods */
   249 	if (HASBIT(free_names, M(STR_SV_STNAME_WOODS)) && (
   249 	if (HASBIT(free_names, M(STR_SV_STNAME_WOODS)) && (
   250 				CountMapSquareAround(tile, MP_TREES, 0) >= 8 ||
   250 				CountMapSquareAround(tile, MP_TREES, 0) >= 8 ||
   251 				CountMapSquareAround(tile, MP_INDUSTRY, IT_FOREST) >= 2)
   251 				CountMapSquareAround(tile, MP_INDUSTRY, IT_FOREST) >= 2)
   252 			) {
   252 			) {
   253 		found = _opt.landscape == LT_DESERT ?
   253 		found = _opt.landscape == LT_TROPIC ?
   254 			M(STR_SV_STNAME_FOREST) : M(STR_SV_STNAME_WOODS);
   254 			M(STR_SV_STNAME_FOREST) : M(STR_SV_STNAME_WOODS);
   255 		goto done;
   255 		goto done;
   256 	}
   256 	}
   257 
   257 
   258 	/* check elevation compared to town */
   258 	/* check elevation compared to town */
  1118 	}
  1118 	}
  1119 
  1119 
  1120 	return cost;
  1120 	return cost;
  1121 }
  1121 }
  1122 
  1122 
       
  1123 /**
       
  1124  * Switches the rail type at a railway station tile.
       
  1125  * @param tile        The tile on which the railtype is to be convert.
       
  1126  * @param totype      The railtype we want to convert to
       
  1127  * @param exec        Switches between test and execute mode
       
  1128  * @return            The cost and state of the operation
       
  1129  * @retval CMD_ERROR  An error occured during the operation.
       
  1130  */
  1123 int32 DoConvertStationRail(TileIndex tile, RailType totype, bool exec)
  1131 int32 DoConvertStationRail(TileIndex tile, RailType totype, bool exec)
  1124 {
  1132 {
  1125 	const Station* st = GetStationByTile(tile);
  1133 	const Station* st = GetStationByTile(tile);
  1126 
  1134 
  1127 	if (!CheckOwnership(st->owner) || !EnsureNoVehicle(tile)) return CMD_ERROR;
  1135 	if (!CheckOwnership(st->owner) || !EnsureNoVehicle(tile)) return CMD_ERROR;
  1138 		SetRailType(tile, totype);
  1146 		SetRailType(tile, totype);
  1139 		MarkTileDirtyByTile(tile);
  1147 		MarkTileDirtyByTile(tile);
  1140 		YapfNotifyTrackLayoutChange(tile, GetRailStationTrack(tile));
  1148 		YapfNotifyTrackLayoutChange(tile, GetRailStationTrack(tile));
  1141 	}
  1149 	}
  1142 
  1150 
  1143 	return _price.build_rail >> 1;
  1151 	return _price.build_rail / 2;
  1144 }
  1152 }
  1145 
  1153 
  1146 /**
  1154 /**
  1147  * @param[in] truck_station Determines whether a stop is RoadStop::BUS or RoadStop::TRUCK
  1155  * @param[in] truck_station Determines whether a stop is RoadStop::BUS or RoadStop::TRUCK
  1148  * @param[in] station The station to do the whole procedure for
  1156  * @param[in] station The station to do the whole procedure for