src/station_cmd.cpp
branchgamebalance
changeset 9909 dce9a6923bb7
parent 9908 0fa543611bbe
child 9910 0b2aebc8283e
equal deleted inserted replaced
9908:0fa543611bbe 9909:dce9a6923bb7
   787 	}
   787 	}
   788 }
   788 }
   789 
   789 
   790 /** Build railroad station
   790 /** Build railroad station
   791  * @param tile_org starting position of station dragging/placement
   791  * @param tile_org starting position of station dragging/placement
       
   792  * @param flags operation to perform
   792  * @param p1 various bitstuffed elements
   793  * @param p1 various bitstuffed elements
   793  * - p1 = (bit  0)    - orientation (Axis)
   794  * - p1 = (bit  0)    - orientation (Axis)
   794  * - p1 = (bit  8-15) - number of tracks
   795  * - p1 = (bit  8-15) - number of tracks
   795  * - p1 = (bit 16-23) - platform length
   796  * - p1 = (bit 16-23) - platform length
   796  * @param p2 various bitstuffed elements
   797  * @param p2 various bitstuffed elements
  1021 }
  1022 }
  1022 
  1023 
  1023 /** Remove a single tile from a railroad station.
  1024 /** Remove a single tile from a railroad station.
  1024  * This allows for custom-built station with holes and weird layouts
  1025  * This allows for custom-built station with holes and weird layouts
  1025  * @param tile tile of station piece to remove
  1026  * @param tile tile of station piece to remove
       
  1027  * @param flags operation to perform
  1026  * @param p1 unused
  1028  * @param p1 unused
  1027  * @param p2 unused
  1029  * @param p2 unused
  1028  */
  1030  */
  1029 int32 CmdRemoveFromRailroadStation(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1031 int32 CmdRemoveFromRailroadStation(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1030 {
  1032 {
  1151 
  1153 
  1152 	return _eco->GetPrice(CEconomy::PRICE_RAIL_BUILD) / 2;
  1154 	return _eco->GetPrice(CEconomy::PRICE_RAIL_BUILD) / 2;
  1153 }
  1155 }
  1154 
  1156 
  1155 /**
  1157 /**
  1156  * @param[in] truck_station Determines whether a stop is RoadStop::BUS or RoadStop::TRUCK
  1158  * @param truck_station Determines whether a stop is RoadStop::BUS or RoadStop::TRUCK
  1157  * @param[in] station The station to do the whole procedure for
  1159  * @param st The Station to do the whole procedure for
  1158  * @return a pointer to where to link a new RoadStop*
  1160  * @return a pointer to where to link a new RoadStop*
  1159  */
  1161  */
  1160 static RoadStop **FindRoadStopSpot(bool truck_station, Station* st)
  1162 static RoadStop **FindRoadStopSpot(bool truck_station, Station* st)
  1161 {
  1163 {
  1162 	RoadStop **primary_stop = (truck_station) ? &st->truck_stops : &st->bus_stops;
  1164 	RoadStop **primary_stop = (truck_station) ? &st->truck_stops : &st->bus_stops;
  1163 
  1165 
  1164 	if (*primary_stop == NULL) {
  1166 	if (*primary_stop == NULL) {
  1165 		//we have no roadstop of the type yet, so write a "primary stop"
  1167 		/* we have no roadstop of the type yet, so write a "primary stop" */
  1166 		return primary_stop;
  1168 		return primary_stop;
  1167 	} else {
  1169 	} else {
  1168 		//there are stops already, so append to the end of the list
  1170 		/* there are stops already, so append to the end of the list */
  1169 		RoadStop *stop = *primary_stop;
  1171 		RoadStop *stop = *primary_stop;
  1170 		while (stop->next != NULL) stop = stop->next;
  1172 		while (stop->next != NULL) stop = stop->next;
  1171 		return &stop->next;
  1173 		return &stop->next;
  1172 	}
  1174 	}
  1173 }
  1175 }
  1174 
  1176 
  1175 /** Build a bus or truck stop
  1177 /** Build a bus or truck stop
  1176  * @param tile tile to build the stop at
  1178  * @param tile tile to build the stop at
       
  1179  * @param flags operation to perform
  1177  * @param p1 entrance direction (DiagDirection)
  1180  * @param p1 entrance direction (DiagDirection)
  1178  * @param p2 bit 0: 0 for Bus stops, 1 for truck stops
  1181  * @param p2 bit 0: 0 for Bus stops, 1 for truck stops
  1179  *           bit 1: 0 for normal, 1 for drive-through
  1182  *           bit 1: 0 for normal, 1 for drive-through
  1180  */
  1183  */
  1181 int32 CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1184 int32 CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1339 	return (is_truck) ? _eco->GetPrice(CEconomy::REMOVE_TRUCK_STATION) : _eco->GetPrice(CEconomy::REMOVE_BUS_STATION);
  1342 	return (is_truck) ? _eco->GetPrice(CEconomy::REMOVE_TRUCK_STATION) : _eco->GetPrice(CEconomy::REMOVE_BUS_STATION);
  1340 }
  1343 }
  1341 
  1344 
  1342 /** Remove a bus or truck stop
  1345 /** Remove a bus or truck stop
  1343  * @param tile tile to remove the stop from
  1346  * @param tile tile to remove the stop from
       
  1347  * @param flags operation to perform
  1344  * @param p1 not used
  1348  * @param p1 not used
  1345  * @param p2 bit 0: 0 for Bus stops, 1 for truck stops
  1349  * @param p2 bit 0: 0 for Bus stops, 1 for truck stops
  1346  */
  1350  */
  1347 int32 CmdRemoveRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1351 int32 CmdRemoveRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1348 {
  1352 {
  1464 	_airport_sections_helistation        // Helistation
  1468 	_airport_sections_helistation        // Helistation
  1465 };
  1469 };
  1466 
  1470 
  1467 /** Place an Airport.
  1471 /** Place an Airport.
  1468  * @param tile tile where airport will be built
  1472  * @param tile tile where airport will be built
       
  1473  * @param flags operation to perform
  1469  * @param p1 airport type, @see airport.h
  1474  * @param p1 airport type, @see airport.h
  1470  * @param p2 unused
  1475  * @param p2 unused
  1471  */
  1476  */
  1472 int32 CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1477 int32 CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1473 {
  1478 {
  1639 	return cost;
  1644 	return cost;
  1640 }
  1645 }
  1641 
  1646 
  1642 /** Build a buoy.
  1647 /** Build a buoy.
  1643  * @param tile tile where to place the bouy
  1648  * @param tile tile where to place the bouy
       
  1649  * @param flags operation to perform
  1644  * @param p1 unused
  1650  * @param p1 unused
  1645  * @param p2 unused
  1651  * @param p2 unused
  1646  */
  1652  */
  1647 int32 CmdBuildBuoy(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1653 int32 CmdBuildBuoy(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1648 {
  1654 {
  1747 static const byte _dock_w_chk[4] = { 2, 1, 2, 1 };
  1753 static const byte _dock_w_chk[4] = { 2, 1, 2, 1 };
  1748 static const byte _dock_h_chk[4] = { 1, 2, 1, 2 };
  1754 static const byte _dock_h_chk[4] = { 1, 2, 1, 2 };
  1749 
  1755 
  1750 /** Build a dock/haven.
  1756 /** Build a dock/haven.
  1751  * @param tile tile where dock will be built
  1757  * @param tile tile where dock will be built
       
  1758  * @param flags operation to perform
  1752  * @param p1 unused
  1759  * @param p1 unused
  1753  * @param p2 unused
  1760  * @param p2 unused
  1754  */
  1761  */
  1755 int32 CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1762 int32 CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1756 {
  1763 {
  2379 	st->MarkTilesDirty();
  2386 	st->MarkTilesDirty();
  2380 }
  2387 }
  2381 
  2388 
  2382 /** Rename a station
  2389 /** Rename a station
  2383  * @param tile unused
  2390  * @param tile unused
       
  2391  * @param flags operation to perform
  2384  * @param p1 station ID that is to be renamed
  2392  * @param p1 station ID that is to be renamed
  2385  * @param p2 unused
  2393  * @param p2 unused
  2386  */
  2394  */
  2387 int32 CmdRenameStation(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  2395 int32 CmdRenameStation(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  2388 {
  2396 {
  2818 
  2826 
  2819 
  2827 
  2820 static void SaveLoad_STNS(Station *st)
  2828 static void SaveLoad_STNS(Station *st)
  2821 {
  2829 {
  2822 	SlObject(st, _station_desc);
  2830 	SlObject(st, _station_desc);
  2823 	for (CargoID i = 0; i < NUM_CARGO; i++) {
  2831 
       
  2832 	uint num_cargo = CheckSavegameVersion(55) ? 12 : NUM_CARGO;
       
  2833 	for (CargoID i = 0; i < num_cargo; i++) {
  2824 		SlObject(&st->goods[i], _goods_desc);
  2834 		SlObject(&st->goods[i], _goods_desc);
  2825 	}
  2835 	}
  2826 
  2836 
  2827 	if (st->num_specs != 0) {
  2837 	if (st->num_specs != 0) {
  2828 		/* Allocate speclist memory when loading a game */
  2838 		/* Allocate speclist memory when loading a game */