Update to 13.0-beta1

This commit is contained in:
Pavel Stupnikov
2022-11-23 14:30:36 +04:00
parent 269352680c
commit be23283677
504 changed files with 14161 additions and 9678 deletions

View File

@@ -9,7 +9,6 @@
#include "stdafx.h"
#include "cmd_helper.h"
#include "command_func.h"
#include "landscape.h"
#include "bridge_map.h"
@@ -28,6 +27,8 @@
#include "company_base.h"
#include "water.h"
#include "company_gui.h"
#include "waypoint_cmd.h"
#include "landscape_cmd.h"
#include "table/strings.h"
@@ -160,32 +161,20 @@ extern CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta,
/**
* Convert existing rail to waypoint. Eg build a waypoint station over
* piece of rail
* @param start_tile northern most tile where waypoint will be built
* @param flags type of operation
* @param p1 various bitstuffed elements
* - p1 = (bit 0- 5) - railtype (not used)
* - p1 = (bit 6) - orientation (Axis)
* - p1 = (bit 8-15) - width of waypoint
* - p1 = (bit 16-23) - height of waypoint
* - p1 = (bit 24) - allow waypoints directly adjacent to other waypoints.
* @param p2 various bitstuffed elements
* - p2 = (bit 0- 7) - custom station class
* - p2 = (bit 8-15) - custom station id
* @param text unused
* @param start_tile northern most tile where waypoint will be built
* @param axis orientation (Axis)
* @param width width of waypoint
* @param height height of waypoint
* @param spec_class custom station class
* @param spec_index custom station id
* @param station_to_join station ID to join (NEW_STATION if build new one)
* @param adjacent allow waypoints directly adjacent to other waypoints.
* @return the cost of this operation or an error
*/
CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
CommandCost CmdBuildRailWaypoint(DoCommandFlag flags, TileIndex start_tile, Axis axis, byte width, byte height, StationClassID spec_class, byte spec_index, StationID station_to_join, bool adjacent)
{
/* Unpack parameters */
Axis axis = Extract<Axis, 6, 1>(p1);
byte width = GB(p1, 8, 8);
byte height = GB(p1, 16, 8);
bool adjacent = HasBit(p1, 24);
StationClassID spec_class = Extract<StationClassID, 0, 8>(p2);
byte spec_index = GB(p2, 8, 8);
StationID station_to_join = GB(p2, 16, 16);
if (!IsValidAxis(axis)) return CMD_ERROR;
/* Check if the given station class is valid */
if (spec_class != STAT_CLASS_WAYP) return CMD_ERROR;
if (spec_index >= StationClass::Get(spec_class)->GetSpecCount()) return CMD_ERROR;
@@ -295,14 +284,11 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint
/**
* Build a buoy.
* @param tile tile where to place the buoy
* @param flags operation to perform
* @param p1 unused
* @param p2 unused
* @param text unused
* @param tile tile where to place the buoy
* @return the cost of this operation or an error
*/
CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
CommandCost CmdBuildBuoy(DoCommandFlag flags, TileIndex tile)
{
if (tile == 0 || !HasTileWaterGround(tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
@@ -315,7 +301,7 @@ CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
CommandCost cost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_WAYPOINT_BUOY]);
if (!IsWaterTile(tile)) {
CommandCost ret = DoCommand(tile, 0, 0, flags | DC_AUTO, CMD_LANDSCAPE_CLEAR);
CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags | DC_AUTO, tile);
if (ret.Failed()) return ret;
cost.AddCost(ret);
}
@@ -406,16 +392,14 @@ static bool IsUniqueWaypointName(const std::string &name)
/**
* Rename a waypoint.
* @param tile unused
* @param flags type of operation
* @param p1 id of waypoint
* @param p2 unused
* @param waypoint_id id of waypoint
* @param text the new name or an empty string when resetting to the default
* @return the cost of this operation or an error
*/
CommandCost CmdRenameWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
CommandCost CmdRenameWaypoint(DoCommandFlag flags, StationID waypoint_id, const std::string &text)
{
Waypoint *wp = Waypoint::GetIfValid(p1);
Waypoint *wp = Waypoint::GetIfValid(waypoint_id);
if (wp == nullptr) return CMD_ERROR;
if (wp->owner != OWNER_NONE) {