mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Move flags in CommandProc in front of the command arguments.
This commit is contained in:
parent
33ca4f2b99
commit
7048e1522f
|
@ -259,14 +259,14 @@ void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height, int &xoff
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build an aircraft.
|
* Build an aircraft.
|
||||||
* @param tile tile of the depot where aircraft is built.
|
|
||||||
* @param flags type of operation.
|
* @param flags type of operation.
|
||||||
|
* @param tile tile of the depot where aircraft is built.
|
||||||
* @param e the engine to build.
|
* @param e the engine to build.
|
||||||
* @param data unused.
|
* @param data unused.
|
||||||
* @param[out] ret the vehicle that has been built.
|
* @param[out] ret the vehicle that has been built.
|
||||||
* @return the cost of this operation or an error.
|
* @return the cost of this operation or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **ret)
|
CommandCost CmdBuildAircraft(DoCommandFlag flags, TileIndex tile, const Engine *e, uint16 data, Vehicle **ret)
|
||||||
{
|
{
|
||||||
const AircraftVehicleInfo *avi = &e->u.air;
|
const AircraftVehicleInfo *avi = &e->u.air;
|
||||||
const Station *st = Station::GetByTile(tile);
|
const Station *st = Station::GetByTile(tile);
|
||||||
|
|
|
@ -14,6 +14,6 @@
|
||||||
#include "engine_type.h"
|
#include "engine_type.h"
|
||||||
#include "vehicle_type.h"
|
#include "vehicle_type.h"
|
||||||
|
|
||||||
CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **v);
|
CommandCost CmdBuildAircraft(DoCommandFlag flags, TileIndex tile, const Engine *e, uint16 data, Vehicle **v);
|
||||||
|
|
||||||
#endif /* AIRCRAFT_CMD_H */
|
#endif /* AIRCRAFT_CMD_H */
|
||||||
|
|
|
@ -708,14 +708,14 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
|
||||||
/**
|
/**
|
||||||
* Autoreplaces a vehicle
|
* Autoreplaces a vehicle
|
||||||
* Trains are replaced as a whole chain, free wagons in depot are replaced on their own
|
* Trains are replaced as a whole chain, free wagons in depot are replaced on their own
|
||||||
* @param tile not used
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile not used
|
||||||
* @param p1 Index of vehicle
|
* @param p1 Index of vehicle
|
||||||
* @param p2 not used
|
* @param p2 not used
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdAutoreplaceVehicle(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||||
if (v == nullptr) return CMD_ERROR;
|
if (v == nullptr) return CMD_ERROR;
|
||||||
|
@ -797,8 +797,8 @@ CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change engine renewal parameters
|
* Change engine renewal parameters
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 packed data
|
* @param p1 packed data
|
||||||
* - bit 0 = replace when engine gets old?
|
* - bit 0 = replace when engine gets old?
|
||||||
* - bits 16-31 = engine group
|
* - bits 16-31 = engine group
|
||||||
|
@ -808,7 +808,7 @@ CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSetAutoReplace(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Company *c = Company::GetIfValid(_current_company);
|
Company *c = Company::GetIfValid(_current_company);
|
||||||
if (c == nullptr) return CMD_ERROR;
|
if (c == nullptr) return CMD_ERROR;
|
||||||
|
|
|
@ -204,7 +204,7 @@ CommandCost DoCommand(DoCommandFlag flags, Commands cmd, TileIndex tile, uint32
|
||||||
if (_docommand_recursive == 1 || !(flags & DC_EXEC) ) {
|
if (_docommand_recursive == 1 || !(flags & DC_EXEC) ) {
|
||||||
if (_docommand_recursive == 1) _cleared_object_areas.clear();
|
if (_docommand_recursive == 1) _cleared_object_areas.clear();
|
||||||
SetTownRatingTestMode(true);
|
SetTownRatingTestMode(true);
|
||||||
res = proc(tile, flags & ~DC_EXEC, p1, p2, text);
|
res = proc(flags & ~DC_EXEC, tile, p1, p2, text);
|
||||||
SetTownRatingTestMode(false);
|
SetTownRatingTestMode(false);
|
||||||
if (res.Failed()) {
|
if (res.Failed()) {
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -226,7 +226,7 @@ CommandCost DoCommand(DoCommandFlag flags, Commands cmd, TileIndex tile, uint32
|
||||||
/* Execute the command here. All cost-relevant functions set the expenses type
|
/* Execute the command here. All cost-relevant functions set the expenses type
|
||||||
* themselves to the cost object at some point */
|
* themselves to the cost object at some point */
|
||||||
if (_docommand_recursive == 1) _cleared_object_areas.clear();
|
if (_docommand_recursive == 1) _cleared_object_areas.clear();
|
||||||
res = proc(tile, flags, p1, p2, text);
|
res = proc(flags, tile, p1, p2, text);
|
||||||
if (res.Failed()) {
|
if (res.Failed()) {
|
||||||
error:
|
error:
|
||||||
_docommand_recursive--;
|
_docommand_recursive--;
|
||||||
|
@ -465,7 +465,7 @@ CommandCost DoCommandPInternal(Commands cmd, StringID err_message, CommandCallba
|
||||||
_cleared_object_areas.clear();
|
_cleared_object_areas.clear();
|
||||||
SetTownRatingTestMode(true);
|
SetTownRatingTestMode(true);
|
||||||
BasePersistentStorageArray::SwitchMode(PSM_ENTER_TESTMODE);
|
BasePersistentStorageArray::SwitchMode(PSM_ENTER_TESTMODE);
|
||||||
CommandCost res = proc(tile, flags, p1, p2, text);
|
CommandCost res = proc(flags, tile, p1, p2, text);
|
||||||
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_TESTMODE);
|
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_TESTMODE);
|
||||||
SetTownRatingTestMode(false);
|
SetTownRatingTestMode(false);
|
||||||
|
|
||||||
|
@ -508,7 +508,7 @@ CommandCost DoCommandPInternal(Commands cmd, StringID err_message, CommandCallba
|
||||||
* use the construction one */
|
* use the construction one */
|
||||||
_cleared_object_areas.clear();
|
_cleared_object_areas.clear();
|
||||||
BasePersistentStorageArray::SwitchMode(PSM_ENTER_COMMAND);
|
BasePersistentStorageArray::SwitchMode(PSM_ENTER_COMMAND);
|
||||||
CommandCost res2 = proc(tile, flags | DC_EXEC, p1, p2, text);
|
CommandCost res2 = proc(flags | DC_EXEC, tile, p1, p2, text);
|
||||||
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_COMMAND);
|
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_COMMAND);
|
||||||
|
|
||||||
if (cmd == CMD_COMPANY_CTRL) {
|
if (cmd == CMD_COMPANY_CTRL) {
|
||||||
|
|
|
@ -421,7 +421,7 @@ enum CommandPauseLevel {
|
||||||
* @param text Additional text
|
* @param text Additional text
|
||||||
* @return The CommandCost of the command, which can be succeeded or failed.
|
* @return The CommandCost of the command, which can be succeeded or failed.
|
||||||
*/
|
*/
|
||||||
typedef CommandCost CommandProc(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text);
|
typedef CommandCost CommandProc(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text);
|
||||||
|
|
||||||
|
|
||||||
/** Defines the traits of a command. */
|
/** Defines the traits of a command. */
|
||||||
|
|
|
@ -795,8 +795,8 @@ void CompanyAdminRemove(CompanyID company_id, CompanyRemoveReason reason)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Control the companies: add, delete, etc.
|
* Control the companies: add, delete, etc.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 various functionality
|
* @param p1 various functionality
|
||||||
* - bits 0..15: CompanyCtrlAction
|
* - bits 0..15: CompanyCtrlAction
|
||||||
* - bits 16..23: CompanyID
|
* - bits 16..23: CompanyID
|
||||||
|
@ -805,7 +805,7 @@ void CompanyAdminRemove(CompanyID company_id, CompanyRemoveReason reason)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdCompanyCtrl(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
InvalidateWindowData(WC_COMPANY_LEAGUE, 0, 0);
|
InvalidateWindowData(WC_COMPANY_LEAGUE, 0, 0);
|
||||||
CompanyID company_id = (CompanyID)GB(p1, 16, 8);
|
CompanyID company_id = (CompanyID)GB(p1, 16, 8);
|
||||||
|
@ -922,14 +922,14 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the company manager's face.
|
* Change the company manager's face.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 unused
|
* @param p1 unused
|
||||||
* @param p2 face bitmasked
|
* @param p2 face bitmasked
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetCompanyManagerFace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSetCompanyManagerFace(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
CompanyManagerFace cmf = (CompanyManagerFace)p2;
|
CompanyManagerFace cmf = (CompanyManagerFace)p2;
|
||||||
|
|
||||||
|
@ -944,8 +944,8 @@ CommandCost CmdSetCompanyManagerFace(TileIndex tile, DoCommandFlag flags, uint32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the company's company-colour
|
* Change the company's company-colour
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 bitstuffed:
|
* @param p1 bitstuffed:
|
||||||
* p1 bits 0-7 scheme to set
|
* p1 bits 0-7 scheme to set
|
||||||
* p1 bit 8 set first/second colour
|
* p1 bit 8 set first/second colour
|
||||||
|
@ -953,7 +953,7 @@ CommandCost CmdSetCompanyManagerFace(TileIndex tile, DoCommandFlag flags, uint32
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetCompanyColour(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSetCompanyColour(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Colours colour = Extract<Colours, 0, 8>(p2);
|
Colours colour = Extract<Colours, 0, 8>(p2);
|
||||||
LiveryScheme scheme = Extract<LiveryScheme, 0, 8>(p1);
|
LiveryScheme scheme = Extract<LiveryScheme, 0, 8>(p1);
|
||||||
|
@ -1057,14 +1057,14 @@ static bool IsUniqueCompanyName(const std::string &name)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the name of the company.
|
* Change the name of the company.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 unused
|
* @param p1 unused
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text the new name or an empty string when resetting to the default
|
* @param text the new name or an empty string when resetting to the default
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRenameCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRenameCompany(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
bool reset = text.empty();
|
bool reset = text.empty();
|
||||||
|
|
||||||
|
@ -1103,14 +1103,14 @@ static bool IsUniquePresidentName(const std::string &name)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the name of the president.
|
* Change the name of the president.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 unused
|
* @param p1 unused
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text the new name or an empty string when resetting to the default
|
* @param text the new name or an empty string when resetting to the default
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRenamePresident(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRenamePresident(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
bool reset = text.empty();
|
bool reset = text.empty();
|
||||||
|
|
||||||
|
@ -1188,14 +1188,14 @@ uint32 CompanyInfrastructure::GetTramTotal() const
|
||||||
* To prevent abuse in multiplayer games you can only send money to other
|
* To prevent abuse in multiplayer games you can only send money to other
|
||||||
* companies if you have paid off your loan (either explicitly, or implicitly
|
* companies if you have paid off your loan (either explicitly, or implicitly
|
||||||
* given the fact that you have more money than loan).
|
* given the fact that you have more money than loan).
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 the amount of money to transfer; max 20.000.000
|
* @param p1 the amount of money to transfer; max 20.000.000
|
||||||
* @param p2 the company to transfer the money to
|
* @param p2 the company to transfer the money to
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdGiveMoney(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdGiveMoney(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (!_settings_game.economy.give_money) return CMD_ERROR;
|
if (!_settings_game.economy.give_money) return CMD_ERROR;
|
||||||
|
|
||||||
|
|
|
@ -38,14 +38,14 @@ static bool IsUniqueDepotName(const std::string &name)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename a depot.
|
* Rename a depot.
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 id of depot
|
* @param p1 id of depot
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text the new name or an empty string when resetting to the default
|
* @param text the new name or an empty string when resetting to the default
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRenameDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRenameDepot(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Depot *d = Depot::GetIfValid(p1);
|
Depot *d = Depot::GetIfValid(p1);
|
||||||
if (d == nullptr) return CMD_ERROR;
|
if (d == nullptr) return CMD_ERROR;
|
||||||
|
|
|
@ -2010,14 +2010,14 @@ extern int GetAmountOwnedBy(const Company *c, Owner owner);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acquire shares in an opposing company.
|
* Acquire shares in an opposing company.
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 company to buy the shares from
|
* @param p1 company to buy the shares from
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuyShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuyShareInCompany(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
CommandCost cost(EXPENSES_OTHER);
|
CommandCost cost(EXPENSES_OTHER);
|
||||||
CompanyID target_company = (CompanyID)p1;
|
CompanyID target_company = (CompanyID)p1;
|
||||||
|
@ -2062,14 +2062,14 @@ CommandCost CmdBuyShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sell shares in an opposing company.
|
* Sell shares in an opposing company.
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 company to sell the shares from
|
* @param p1 company to sell the shares from
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSellShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSellShareInCompany(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
CompanyID target_company = (CompanyID)p1;
|
CompanyID target_company = (CompanyID)p1;
|
||||||
Company *c = Company::GetIfValid(target_company);
|
Company *c = Company::GetIfValid(target_company);
|
||||||
|
@ -2103,14 +2103,14 @@ CommandCost CmdSellShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||||
* When a competing company is gone bankrupt you get the chance to purchase
|
* When a competing company is gone bankrupt you get the chance to purchase
|
||||||
* that company.
|
* that company.
|
||||||
* @todo currently this only works for AI companies
|
* @todo currently this only works for AI companies
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 company to buy up
|
* @param p1 company to buy up
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuyCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuyCompany(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
CompanyID target_company = (CompanyID)p1;
|
CompanyID target_company = (CompanyID)p1;
|
||||||
Company *c = Company::GetIfValid(target_company);
|
Company *c = Company::GetIfValid(target_company);
|
||||||
|
|
|
@ -875,14 +875,14 @@ void ClearEnginesHiddenFlagOfCompany(CompanyID cid)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the visibility of an engine.
|
* Set the visibility of an engine.
|
||||||
* @param tile Unused.
|
|
||||||
* @param flags Operation to perform.
|
* @param flags Operation to perform.
|
||||||
|
* @param tile Unused.
|
||||||
* @param p1 Unused.
|
* @param p1 Unused.
|
||||||
* @param p2 Bit 31: 0=visible, 1=hidden, other bits for the #EngineID.
|
* @param p2 Bit 31: 0=visible, 1=hidden, other bits for the #EngineID.
|
||||||
* @param text Unused.
|
* @param text Unused.
|
||||||
* @return The cost of this operation or an error.
|
* @return The cost of this operation or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetVehicleVisibility(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSetVehicleVisibility(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Engine *e = Engine::GetIfValid(GB(p2, 0, 31));
|
Engine *e = Engine::GetIfValid(GB(p2, 0, 31));
|
||||||
if (e == nullptr || _current_company >= MAX_COMPANIES) return CMD_ERROR;
|
if (e == nullptr || _current_company >= MAX_COMPANIES) return CMD_ERROR;
|
||||||
|
@ -899,14 +899,14 @@ CommandCost CmdSetVehicleVisibility(TileIndex tile, DoCommandFlag flags, uint32
|
||||||
/**
|
/**
|
||||||
* Accept an engine prototype. XXX - it is possible that the top-company
|
* Accept an engine prototype. XXX - it is possible that the top-company
|
||||||
* changes while you are waiting to accept the offer? Then it becomes invalid
|
* changes while you are waiting to accept the offer? Then it becomes invalid
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 engine-prototype offered
|
* @param p1 engine-prototype offered
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdWantEnginePreview(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdWantEnginePreview(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Engine *e = Engine::GetIfValid(p1);
|
Engine *e = Engine::GetIfValid(p1);
|
||||||
if (e == nullptr || !(e->flags & ENGINE_EXCLUSIVE_PREVIEW) || e->preview_company != _current_company) return CMD_ERROR;
|
if (e == nullptr || !(e->flags & ENGINE_EXCLUSIVE_PREVIEW) || e->preview_company != _current_company) return CMD_ERROR;
|
||||||
|
@ -918,8 +918,8 @@ CommandCost CmdWantEnginePreview(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow or forbid a specific company to use an engine
|
* Allow or forbid a specific company to use an engine
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 engine id
|
* @param p1 engine id
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = (bit 0 - 7) - Company to allow/forbid the use of an engine.
|
* - p2 = (bit 0 - 7) - Company to allow/forbid the use of an engine.
|
||||||
|
@ -927,7 +927,7 @@ CommandCost CmdWantEnginePreview(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdEngineCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdEngineCtrl(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
EngineID engine_id = (EngineID)p1;
|
EngineID engine_id = (EngineID)p1;
|
||||||
|
@ -1072,14 +1072,14 @@ static bool IsUniqueEngineName(const std::string &name)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename an engine.
|
* Rename an engine.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 engine ID to rename
|
* @param p1 engine ID to rename
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text the new name or an empty string when resetting to the default
|
* @param text the new name or an empty string when resetting to the default
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRenameEngine(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRenameEngine(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Engine *e = Engine::GetIfValid(p1);
|
Engine *e = Engine::GetIfValid(p1);
|
||||||
if (e == nullptr) return CMD_ERROR;
|
if (e == nullptr) return CMD_ERROR;
|
||||||
|
|
28
src/goal.cpp
28
src/goal.cpp
|
@ -35,8 +35,8 @@ INSTANTIATE_POOL_METHODS(Goal)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new goal.
|
* Create a new goal.
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0 - 7) - GoalType of destination.
|
* - p1 = (bit 0 - 7) - GoalType of destination.
|
||||||
* - p1 = (bit 8 - 15) - Company for which this goal is.
|
* - p1 = (bit 8 - 15) - Company for which this goal is.
|
||||||
|
@ -44,7 +44,7 @@ INSTANTIATE_POOL_METHODS(Goal)
|
||||||
* @param text Text of the goal.
|
* @param text Text of the goal.
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdCreateGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdCreateGoal(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (!Goal::CanAllocateItem()) return CMD_ERROR;
|
if (!Goal::CanAllocateItem()) return CMD_ERROR;
|
||||||
|
|
||||||
|
@ -110,14 +110,14 @@ CommandCost CmdCreateGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a goal.
|
* Remove a goal.
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 GoalID to remove.
|
* @param p1 GoalID to remove.
|
||||||
* @param p2 unused.
|
* @param p2 unused.
|
||||||
* @param text unused.
|
* @param text unused.
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRemoveGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRemoveGoal(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
if (!Goal::IsValidID(p1)) return CMD_ERROR;
|
if (!Goal::IsValidID(p1)) return CMD_ERROR;
|
||||||
|
@ -140,14 +140,14 @@ CommandCost CmdRemoveGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update goal text of a goal.
|
* Update goal text of a goal.
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 GoalID to update.
|
* @param p1 GoalID to update.
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text Text of the goal.
|
* @param text Text of the goal.
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetGoalText(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSetGoalText(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
if (!Goal::IsValidID(p1)) return CMD_ERROR;
|
if (!Goal::IsValidID(p1)) return CMD_ERROR;
|
||||||
|
@ -170,14 +170,14 @@ CommandCost CmdSetGoalText(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update progress text of a goal.
|
* Update progress text of a goal.
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 GoalID to update.
|
* @param p1 GoalID to update.
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text Progress text of the goal.
|
* @param text Progress text of the goal.
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetGoalProgress(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSetGoalProgress(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
if (!Goal::IsValidID(p1)) return CMD_ERROR;
|
if (!Goal::IsValidID(p1)) return CMD_ERROR;
|
||||||
|
@ -203,14 +203,14 @@ CommandCost CmdSetGoalProgress(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update completed state of a goal.
|
* Update completed state of a goal.
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 GoalID to update.
|
* @param p1 GoalID to update.
|
||||||
* @param p2 completed state. If goal is completed, set to 1, otherwise 0.
|
* @param p2 completed state. If goal is completed, set to 1, otherwise 0.
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetGoalCompleted(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSetGoalCompleted(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
if (!Goal::IsValidID(p1)) return CMD_ERROR;
|
if (!Goal::IsValidID(p1)) return CMD_ERROR;
|
||||||
|
@ -231,8 +231,8 @@ CommandCost CmdSetGoalCompleted(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ask a goal related question
|
* Ask a goal related question
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0 - 15) - Unique ID to use for this question.
|
* - p1 = (bit 0 - 15) - Unique ID to use for this question.
|
||||||
* - p1 = (bit 16 - 31) - Company or client for which this question is.
|
* - p1 = (bit 16 - 31) - Company or client for which this question is.
|
||||||
|
@ -243,7 +243,7 @@ CommandCost CmdSetGoalCompleted(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
* @param text Text of the question.
|
* @param text Text of the question.
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdGoalQuestion(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdGoalQuestion(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
uint16 uniqueid = (uint16)GB(p1, 0, 16);
|
uint16 uniqueid = (uint16)GB(p1, 0, 16);
|
||||||
CompanyID company = (CompanyID)GB(p1, 16, 8);
|
CompanyID company = (CompanyID)GB(p1, 16, 8);
|
||||||
|
@ -283,14 +283,14 @@ CommandCost CmdGoalQuestion(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reply to a goal question.
|
* Reply to a goal question.
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 Unique ID to use for this question.
|
* @param p1 Unique ID to use for this question.
|
||||||
* @param p2 Button the company pressed
|
* @param p2 Button the company pressed
|
||||||
* @param text Text of the question.
|
* @param text Text of the question.
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdGoalQuestionAnswer(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdGoalQuestionAnswer(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (p1 > UINT16_MAX) return CMD_ERROR;
|
if (p1 > UINT16_MAX) return CMD_ERROR;
|
||||||
if (p2 >= GOAL_QUESTION_BUTTON_COUNT) return CMD_ERROR;
|
if (p2 >= GOAL_QUESTION_BUTTON_COUNT) return CMD_ERROR;
|
||||||
|
|
|
@ -294,14 +294,14 @@ Group::Group(Owner owner)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new vehicle group.
|
* Create a new vehicle group.
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 vehicle type
|
* @param p1 vehicle type
|
||||||
* @param p2 parent groupid
|
* @param p2 parent groupid
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdCreateGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdCreateGroup(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleType vt = Extract<VehicleType, 0, 3>(p1);
|
VehicleType vt = Extract<VehicleType, 0, 3>(p1);
|
||||||
if (!IsCompanyBuildableVehicleType(vt)) return CMD_ERROR;
|
if (!IsCompanyBuildableVehicleType(vt)) return CMD_ERROR;
|
||||||
|
@ -343,15 +343,15 @@ CommandCost CmdCreateGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add all vehicles in the given group to the default group and then deletes the group.
|
* Add all vehicles in the given group to the default group and then deletes the group.
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 index of array group
|
* @param p1 index of array group
|
||||||
* - p1 bit 0-15 : GroupID
|
* - p1 bit 0-15 : GroupID
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdDeleteGroup(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Group *g = Group::GetIfValid(p1);
|
Group *g = Group::GetIfValid(p1);
|
||||||
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
||||||
|
@ -395,8 +395,8 @@ CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alter a group
|
* Alter a group
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 index of array group
|
* @param p1 index of array group
|
||||||
* - p1 bit 0-15 : GroupID
|
* - p1 bit 0-15 : GroupID
|
||||||
* - p1 bit 16: 0 - Rename grouop
|
* - p1 bit 16: 0 - Rename grouop
|
||||||
|
@ -405,7 +405,7 @@ CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
* @param text the new name or an empty string when resetting to the default
|
* @param text the new name or an empty string when resetting to the default
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdAlterGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdAlterGroup(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Group *g = Group::GetIfValid(GB(p1, 0, 16));
|
Group *g = Group::GetIfValid(GB(p1, 0, 16));
|
||||||
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
||||||
|
@ -499,8 +499,8 @@ static void AddVehicleToGroup(Vehicle *v, GroupID new_g)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a vehicle to a group
|
* Add a vehicle to a group
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 index of array group
|
* @param p1 index of array group
|
||||||
* - p1 bit 0-15 : GroupID
|
* - p1 bit 0-15 : GroupID
|
||||||
* @param p2 vehicle to add to a group
|
* @param p2 vehicle to add to a group
|
||||||
|
@ -509,7 +509,7 @@ static void AddVehicleToGroup(Vehicle *v, GroupID new_g)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdAddVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdAddVehicleGroup(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Vehicle *v = Vehicle::GetIfValid(GB(p2, 0, 20));
|
Vehicle *v = Vehicle::GetIfValid(GB(p2, 0, 20));
|
||||||
GroupID new_g = p1;
|
GroupID new_g = p1;
|
||||||
|
@ -525,7 +525,7 @@ CommandCost CmdAddVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||||
|
|
||||||
if (new_g == NEW_GROUP) {
|
if (new_g == NEW_GROUP) {
|
||||||
/* Create new group. */
|
/* Create new group. */
|
||||||
CommandCost ret = CmdCreateGroup(0, flags, v->type, INVALID_GROUP, {});
|
CommandCost ret = CmdCreateGroup(flags, 0, v->type, INVALID_GROUP, {});
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
new_g = _new_group_id;
|
new_g = _new_group_id;
|
||||||
|
@ -558,15 +558,15 @@ CommandCost CmdAddVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add all shared vehicles of all vehicles from a group
|
* Add all shared vehicles of all vehicles from a group
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 index of group array
|
* @param p1 index of group array
|
||||||
* - p1 bit 0-15 : GroupID
|
* - p1 bit 0-15 : GroupID
|
||||||
* @param p2 type of vehicles
|
* @param p2 type of vehicles
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdAddSharedVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdAddSharedVehicleGroup(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleType type = Extract<VehicleType, 0, 3>(p2);
|
VehicleType type = Extract<VehicleType, 0, 3>(p2);
|
||||||
GroupID id_g = p1;
|
GroupID id_g = p1;
|
||||||
|
@ -595,15 +595,15 @@ CommandCost CmdAddSharedVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all vehicles from a group
|
* Remove all vehicles from a group
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 index of group array
|
* @param p1 index of group array
|
||||||
* - p1 bit 0-15 : GroupID
|
* - p1 bit 0-15 : GroupID
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRemoveAllVehiclesGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRemoveAllVehiclesGroup(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
GroupID old_g = p1;
|
GroupID old_g = p1;
|
||||||
Group *g = Group::GetIfValid(old_g);
|
Group *g = Group::GetIfValid(old_g);
|
||||||
|
@ -629,15 +629,15 @@ CommandCost CmdRemoveAllVehiclesGroup(TileIndex tile, DoCommandFlag flags, uint3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the livery for a vehicle group.
|
* Set the livery for a vehicle group.
|
||||||
* @param tile Unused.
|
|
||||||
* @param flags Command flags.
|
* @param flags Command flags.
|
||||||
|
* @param tile Unused.
|
||||||
* @param p1
|
* @param p1
|
||||||
* - p1 bit 0-15 Group ID.
|
* - p1 bit 0-15 Group ID.
|
||||||
* @param p2
|
* @param p2
|
||||||
* - p2 bit 8 Set secondary instead of primary colour
|
* - p2 bit 8 Set secondary instead of primary colour
|
||||||
* - p2 bit 16-23 Colour.
|
* - p2 bit 16-23 Colour.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetGroupLivery(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSetGroupLivery(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Group *g = Group::GetIfValid(p1);
|
Group *g = Group::GetIfValid(p1);
|
||||||
bool primary = !HasBit(p2, 8);
|
bool primary = !HasBit(p2, 8);
|
||||||
|
@ -687,8 +687,8 @@ static void SetGroupFlag(Group *g, GroupFlags flag, bool set, bool children)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (Un)set group flag from a group
|
* (Un)set group flag from a group
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 index of group array
|
* @param p1 index of group array
|
||||||
* - p1 bit 0-15 : GroupID
|
* - p1 bit 0-15 : GroupID
|
||||||
* - p1 bit 16-18 : Flag to set, by value not bit.
|
* - p1 bit 16-18 : Flag to set, by value not bit.
|
||||||
|
@ -698,7 +698,7 @@ static void SetGroupFlag(Group *g, GroupFlags flag, bool set, bool children)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetGroupFlag(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSetGroupFlag(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Group *g = Group::GetIfValid(GB(p1, 0, 16));
|
Group *g = Group::GetIfValid(GB(p1, 0, 16));
|
||||||
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
||||||
|
|
|
@ -1973,8 +1973,8 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build/Fund an industry
|
* Build/Fund an industry
|
||||||
* @param tile tile where industry is built
|
|
||||||
* @param flags of operations to conduct
|
* @param flags of operations to conduct
|
||||||
|
* @param tile tile where industry is built
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0 - 7) - industry type see build_industry.h and see industry.h
|
* - p1 = (bit 0 - 7) - industry type see build_industry.h and see industry.h
|
||||||
* - p1 = (bit 8 - 15) - first layout to try
|
* - p1 = (bit 8 - 15) - first layout to try
|
||||||
|
@ -1983,7 +1983,7 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildIndustry(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
IndustryType it = GB(p1, 0, 8);
|
IndustryType it = GB(p1, 0, 8);
|
||||||
if (it >= NUM_INDUSTRYTYPES) return CMD_ERROR;
|
if (it >= NUM_INDUSTRYTYPES) return CMD_ERROR;
|
||||||
|
@ -2062,8 +2062,8 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change industry properties
|
* Change industry properties
|
||||||
* @param tile Unused.
|
|
||||||
* @param flags Type of operation.
|
* @param flags Type of operation.
|
||||||
|
* @param tile Unused.
|
||||||
* @param p1 IndustryID
|
* @param p1 IndustryID
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = (bit 0 - 7) - IndustryAction to perform
|
* - p2 = (bit 0 - 7) - IndustryAction to perform
|
||||||
|
@ -2075,7 +2075,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||||
* @param text - Additional industry text (only used with set text action)
|
* @param text - Additional industry text (only used with set text action)
|
||||||
* @return Empty cost or an error.
|
* @return Empty cost or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdIndustryCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdIndustryCtrl(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
|
|
||||||
|
|
|
@ -684,14 +684,14 @@ void ClearSnowLine()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear a piece of landscape
|
* Clear a piece of landscape
|
||||||
* @param tile tile to clear
|
|
||||||
* @param flags of operation to conduct
|
* @param flags of operation to conduct
|
||||||
|
* @param tile tile to clear
|
||||||
* @param p1 unused
|
* @param p1 unused
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdLandscapeClear(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdLandscapeClear(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||||
bool do_clear = false;
|
bool do_clear = false;
|
||||||
|
@ -733,15 +733,15 @@ CommandCost CmdLandscapeClear(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear a big piece of landscape
|
* Clear a big piece of landscape
|
||||||
* @param tile end tile of area dragging
|
|
||||||
* @param flags of operation to conduct
|
* @param flags of operation to conduct
|
||||||
|
* @param tile end tile of area dragging
|
||||||
* @param p1 start tile of area dragging
|
* @param p1 start tile of area dragging
|
||||||
* @param p2 various bitstuffed data.
|
* @param p2 various bitstuffed data.
|
||||||
* bit 0: Whether to use the Orthogonal (0) or Diagonal (1) iterator.
|
* bit 0: Whether to use the Orthogonal (0) or Diagonal (1) iterator.
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdClearArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdClearArea(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (p1 >= MapSize()) return CMD_ERROR;
|
if (p1 >= MapSize()) return CMD_ERROR;
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ static_assert((LOAN_INTERVAL & 3) == 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Increase the loan of your company.
|
* Increase the loan of your company.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 higher half of amount to increase the loan with, multitude of LOAN_INTERVAL. Only used when (p2 & 3) == 2.
|
* @param p1 higher half of amount to increase the loan with, multitude of LOAN_INTERVAL. Only used when (p2 & 3) == 2.
|
||||||
* @param p2 (bit 2-31) - lower half of amount (lower 2 bits assumed to be 0)
|
* @param p2 (bit 2-31) - lower half of amount (lower 2 bits assumed to be 0)
|
||||||
* (bit 0-1) - when 0: loans LOAN_INTERVAL
|
* (bit 0-1) - when 0: loans LOAN_INTERVAL
|
||||||
|
@ -43,7 +43,7 @@ static_assert((LOAN_INTERVAL & 3) == 0);
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdIncreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdIncreaseLoan(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Company *c = Company::Get(_current_company);
|
Company *c = Company::Get(_current_company);
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@ CommandCost CmdIncreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decrease the loan of your company.
|
* Decrease the loan of your company.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 higher half of amount to decrease the loan with, multitude of LOAN_INTERVAL. Only used when (p2 & 3) == 2.
|
* @param p1 higher half of amount to decrease the loan with, multitude of LOAN_INTERVAL. Only used when (p2 & 3) == 2.
|
||||||
* @param p2 (bit 2-31) - lower half of amount (lower 2 bits assumed to be 0)
|
* @param p2 (bit 2-31) - lower half of amount (lower 2 bits assumed to be 0)
|
||||||
* (bit 0-1) - when 0: pays back LOAN_INTERVAL
|
* (bit 0-1) - when 0: pays back LOAN_INTERVAL
|
||||||
|
@ -91,7 +91,7 @@ CommandCost CmdIncreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdDecreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdDecreaseLoan(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Company *c = Company::Get(_current_company);
|
Company *c = Company::Get(_current_company);
|
||||||
|
|
||||||
|
@ -144,14 +144,14 @@ static void AskUnsafeUnpauseCallback(Window *w, bool confirmed)
|
||||||
* Set or unset a bit in the pause mode. If pause mode is zero the game is
|
* Set or unset a bit in the pause mode. If pause mode is zero the game is
|
||||||
* unpaused. A bitset is used instead of a boolean value/counter to have
|
* unpaused. A bitset is used instead of a boolean value/counter to have
|
||||||
* more control over the game when saving/loading, etc.
|
* more control over the game when saving/loading, etc.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 the pause mode to change
|
* @param p1 the pause mode to change
|
||||||
* @param p2 1 pauses, 0 unpauses this mode
|
* @param p2 1 pauses, 0 unpauses this mode
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdPause(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
switch (p1) {
|
switch (p1) {
|
||||||
case PM_PAUSED_SAVELOAD:
|
case PM_PAUSED_SAVELOAD:
|
||||||
|
@ -196,29 +196,29 @@ CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the financial flow of your company.
|
* Change the financial flow of your company.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 the amount of money to receive (if positive), or spend (if negative)
|
* @param p1 the amount of money to receive (if positive), or spend (if negative)
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdMoneyCheat(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdMoneyCheat(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
return CommandCost(EXPENSES_OTHER, -(int32)p1);
|
return CommandCost(EXPENSES_OTHER, -(int32)p1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the bank bank balance of a company by inserting or removing money without affecting the loan.
|
* Change the bank bank balance of a company by inserting or removing money without affecting the loan.
|
||||||
* @param tile tile to show text effect on (if not 0)
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile tile to show text effect on (if not 0)
|
||||||
* @param p1 the amount of money to receive (if positive), or spend (if negative)
|
* @param p1 the amount of money to receive (if positive), or spend (if negative)
|
||||||
* @param p2 (bit 0-7) - the company ID.
|
* @param p2 (bit 0-7) - the company ID.
|
||||||
* (bit 8-15) - the expenses type which should register the cost/income @see ExpensesType.
|
* (bit 8-15) - the expenses type which should register the cost/income @see ExpensesType.
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return zero cost or an error
|
* @return zero cost or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdChangeBankBalance(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdChangeBankBalance(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
int32 delta = (int32)p1;
|
int32 delta = (int32)p1;
|
||||||
CompanyID company = (CompanyID) GB(p2, 0, 8);
|
CompanyID company = (CompanyID) GB(p2, 0, 8);
|
||||||
|
|
|
@ -836,8 +836,8 @@ void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceTy
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new custom news item.
|
* Create a new custom news item.
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0 - 7) - NewsType of the message.
|
* - p1 = (bit 0 - 7) - NewsType of the message.
|
||||||
* - p1 = (bit 8 - 15) - NewsReferenceType of first reference.
|
* - p1 = (bit 8 - 15) - NewsReferenceType of first reference.
|
||||||
|
@ -846,7 +846,7 @@ void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceTy
|
||||||
* @param text The text of the news message.
|
* @param text The text of the news message.
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdCustomNewsItem(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdCustomNewsItem(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
|
|
||||||
|
|
|
@ -196,14 +196,14 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build an object object
|
* Build an object object
|
||||||
* @param tile tile where the object will be located
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile tile where the object will be located
|
||||||
* @param p1 the object type to build
|
* @param p1 the object type to build
|
||||||
* @param p2 the view for the object
|
* @param p2 the view for the object
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||||
|
|
||||||
|
@ -776,7 +776,7 @@ void GenerateObjects()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
uint8 view = RandomRange(spec->views);
|
uint8 view = RandomRange(spec->views);
|
||||||
if (CmdBuildObject(RandomTile(), DC_EXEC | DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, i, view, {}).Succeeded()) amount--;
|
if (CmdBuildObject(DC_EXEC | DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, RandomTile(), i, view, {}).Succeeded()) amount--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,14 +141,14 @@ void OrderBackup::DoRestore(Vehicle *v)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear an OrderBackup
|
* Clear an OrderBackup
|
||||||
* @param tile Tile related to the to-be-cleared OrderBackup.
|
|
||||||
* @param flags For command.
|
* @param flags For command.
|
||||||
|
* @param tile Tile related to the to-be-cleared OrderBackup.
|
||||||
* @param p1 Unused.
|
* @param p1 Unused.
|
||||||
* @param p2 User that had the OrderBackup.
|
* @param p2 User that had the OrderBackup.
|
||||||
* @param text Unused.
|
* @param text Unused.
|
||||||
* @return The cost of this operation or an error.
|
* @return The cost of this operation or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdClearOrderBackup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdClearOrderBackup(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
/* No need to check anything. If the tile or user don't exist we just ignore it. */
|
/* No need to check anything. If the tile or user don't exist we just ignore it. */
|
||||||
if (flags & DC_EXEC) OrderBackup::ResetOfUser(tile == 0 ? INVALID_TILE : tile, p2);
|
if (flags & DC_EXEC) OrderBackup::ResetOfUser(tile == 0 ? INVALID_TILE : tile, p2);
|
||||||
|
|
|
@ -727,8 +727,8 @@ uint GetOrderDistance(const Order *prev, const Order *cur, const Vehicle *v, int
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an order to the orderlist of a vehicle.
|
* Add an order to the orderlist of a vehicle.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0 - 19) - ID of the vehicle
|
* - p1 = (bit 0 - 19) - ID of the vehicle
|
||||||
* - p1 = (bit 24 - 31) - the selected order (if any). If the last order is given,
|
* - p1 = (bit 24 - 31) - the selected order (if any). If the last order is given,
|
||||||
|
@ -738,7 +738,7 @@ uint GetOrderDistance(const Order *prev, const Order *cur, const Vehicle *v, int
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdInsertOrder(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleID veh = GB(p1, 0, 20);
|
VehicleID veh = GB(p1, 0, 20);
|
||||||
VehicleOrderID sel_ord = GB(p1, 20, 8);
|
VehicleOrderID sel_ord = GB(p1, 20, 8);
|
||||||
|
@ -1006,14 +1006,14 @@ static CommandCost DecloneOrder(Vehicle *dst, DoCommandFlag flags)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an order from the orderlist of a vehicle.
|
* Delete an order from the orderlist of a vehicle.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 the ID of the vehicle
|
* @param p1 the ID of the vehicle
|
||||||
* @param p2 the order to delete (max 255)
|
* @param p2 the order to delete (max 255)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdDeleteOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdDeleteOrder(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleID veh_id = GB(p1, 0, 20);
|
VehicleID veh_id = GB(p1, 0, 20);
|
||||||
VehicleOrderID sel_ord = GB(p2, 0, 8);
|
VehicleOrderID sel_ord = GB(p2, 0, 8);
|
||||||
|
@ -1111,14 +1111,14 @@ void DeleteOrder(Vehicle *v, VehicleOrderID sel_ord)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Goto order of order-list.
|
* Goto order of order-list.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 The ID of the vehicle which order is skipped
|
* @param p1 The ID of the vehicle which order is skipped
|
||||||
* @param p2 the selected order to which we want to skip
|
* @param p2 the selected order to which we want to skip
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSkipToOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSkipToOrder(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleID veh_id = GB(p1, 0, 20);
|
VehicleID veh_id = GB(p1, 0, 20);
|
||||||
VehicleOrderID sel_ord = GB(p2, 0, 8);
|
VehicleOrderID sel_ord = GB(p2, 0, 8);
|
||||||
|
@ -1148,8 +1148,8 @@ CommandCost CmdSkipToOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move an order inside the orderlist
|
* Move an order inside the orderlist
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 the ID of the vehicle
|
* @param p1 the ID of the vehicle
|
||||||
* @param p2 order to move and target
|
* @param p2 order to move and target
|
||||||
* bit 0-15 : the order to move
|
* bit 0-15 : the order to move
|
||||||
|
@ -1159,7 +1159,7 @@ CommandCost CmdSkipToOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
* @note The target order will move one place down in the orderlist
|
* @note The target order will move one place down in the orderlist
|
||||||
* if you move the order upwards else it'll move it one place down
|
* if you move the order upwards else it'll move it one place down
|
||||||
*/
|
*/
|
||||||
CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdMoveOrder(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleID veh = GB(p1, 0, 20);
|
VehicleID veh = GB(p1, 0, 20);
|
||||||
VehicleOrderID moving_order = GB(p2, 0, 16);
|
VehicleOrderID moving_order = GB(p2, 0, 16);
|
||||||
|
@ -1249,8 +1249,8 @@ CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify an order in the orderlist of a vehicle.
|
* Modify an order in the orderlist of a vehicle.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0 - 19) - ID of the vehicle
|
* - p1 = (bit 0 - 19) - ID of the vehicle
|
||||||
* - p1 = (bit 24 - 31) - the selected order (if any). If the last order is given,
|
* - p1 = (bit 24 - 31) - the selected order (if any). If the last order is given,
|
||||||
|
@ -1262,7 +1262,7 @@ CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdModifyOrder(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleOrderID sel_ord = GB(p1, 20, 8);
|
VehicleOrderID sel_ord = GB(p1, 20, 8);
|
||||||
VehicleID veh = GB(p1, 0, 20);
|
VehicleID veh = GB(p1, 0, 20);
|
||||||
|
@ -1522,8 +1522,8 @@ static bool CheckAircraftOrderDistance(const Aircraft *v_new, const Vehicle *v_o
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone/share/copy an order-list of another vehicle.
|
* Clone/share/copy an order-list of another vehicle.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0-19) - destination vehicle to clone orders to
|
* - p1 = (bit 0-19) - destination vehicle to clone orders to
|
||||||
* - p1 = (bit 30-31) - action to perform
|
* - p1 = (bit 30-31) - action to perform
|
||||||
|
@ -1531,7 +1531,7 @@ static bool CheckAircraftOrderDistance(const Aircraft *v_new, const Vehicle *v_o
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdCloneOrder(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleID veh_src = GB(p2, 0, 20);
|
VehicleID veh_src = GB(p2, 0, 20);
|
||||||
VehicleID veh_dst = GB(p1, 0, 20);
|
VehicleID veh_dst = GB(p1, 0, 20);
|
||||||
|
@ -1669,8 +1669,8 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add/remove refit orders from an order
|
* Add/remove refit orders from an order
|
||||||
* @param tile Not used
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile Not used
|
||||||
* @param p1 VehicleIndex of the vehicle having the order
|
* @param p1 VehicleIndex of the vehicle having the order
|
||||||
* @param p2 bitmask
|
* @param p2 bitmask
|
||||||
* - bit 0-7 CargoID
|
* - bit 0-7 CargoID
|
||||||
|
@ -1678,7 +1678,7 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdOrderRefit(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdOrderRefit(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleID veh = GB(p1, 0, 20);
|
VehicleID veh = GB(p1, 0, 20);
|
||||||
VehicleOrderID order_number = GB(p2, 16, 8);
|
VehicleOrderID order_number = GB(p2, 16, 8);
|
||||||
|
|
|
@ -426,8 +426,8 @@ static inline bool ValParamTrackOrientation(Track track)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a single piece of rail
|
* Build a single piece of rail
|
||||||
* @param tile tile to build on
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile tile to build on
|
||||||
* @param p1 railtype of being built piece (normal, mono, maglev)
|
* @param p1 railtype of being built piece (normal, mono, maglev)
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - (bit 0- 2) - track-orientation, valid values: 0-5 (@see Track)
|
* - (bit 0- 2) - track-orientation, valid values: 0-5 (@see Track)
|
||||||
|
@ -435,7 +435,7 @@ static inline bool ValParamTrackOrientation(Track track)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildSingleRail(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
RailType railtype = Extract<RailType, 0, 6>(p1);
|
RailType railtype = Extract<RailType, 0, 6>(p1);
|
||||||
Track track = Extract<Track, 0, 3>(p2);
|
Track track = Extract<Track, 0, 3>(p2);
|
||||||
|
@ -616,14 +616,14 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a single piece of track
|
* Remove a single piece of track
|
||||||
* @param tile tile to remove track from
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile tile to remove track from
|
||||||
* @param p1 unused
|
* @param p1 unused
|
||||||
* @param p2 rail orientation
|
* @param p2 rail orientation
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRemoveSingleRail(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Track track = Extract<Track, 0, 3>(p2);
|
Track track = Extract<Track, 0, 3>(p2);
|
||||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||||
|
@ -873,8 +873,8 @@ static CommandCost ValidateAutoDrag(Trackdir *trackdir, TileIndex start, TileInd
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build or remove a stretch of railroad tracks.
|
* Build or remove a stretch of railroad tracks.
|
||||||
* @param tile start tile of drag
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile start tile of drag
|
||||||
* @param p1 end tile of drag
|
* @param p1 end tile of drag
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = (bit 0-5) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev), only used for building
|
* - p2 = (bit 0-5) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev), only used for building
|
||||||
|
@ -885,7 +885,7 @@ static CommandCost ValidateAutoDrag(Trackdir *trackdir, TileIndex start, TileInd
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
static CommandCost CmdRailTrackHelper(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
static CommandCost CmdRailTrackHelper(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
CommandCost total_cost(EXPENSES_CONSTRUCTION);
|
CommandCost total_cost(EXPENSES_CONSTRUCTION);
|
||||||
Track track = Extract<Track, 6, 3>(p2);
|
Track track = Extract<Track, 6, 3>(p2);
|
||||||
|
@ -935,8 +935,8 @@ static CommandCost CmdRailTrackHelper(TileIndex tile, DoCommandFlag flags, uint3
|
||||||
/**
|
/**
|
||||||
* Build rail on a stretch of track.
|
* Build rail on a stretch of track.
|
||||||
* Stub for the unified rail builder/remover
|
* Stub for the unified rail builder/remover
|
||||||
* @param tile start tile of drag
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile start tile of drag
|
||||||
* @param p1 end tile of drag
|
* @param p1 end tile of drag
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = (bit 0-5) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev)
|
* - p2 = (bit 0-5) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev)
|
||||||
|
@ -946,16 +946,16 @@ static CommandCost CmdRailTrackHelper(TileIndex tile, DoCommandFlag flags, uint3
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
* @see CmdRailTrackHelper
|
* @see CmdRailTrackHelper
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildRailroadTrack(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
return CmdRailTrackHelper(tile, flags, p1, ClrBit(p2, 9), text);
|
return CmdRailTrackHelper(flags, tile, p1, ClrBit(p2, 9), text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build rail on a stretch of track.
|
* Build rail on a stretch of track.
|
||||||
* Stub for the unified rail builder/remover
|
* Stub for the unified rail builder/remover
|
||||||
* @param tile start tile of drag
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile start tile of drag
|
||||||
* @param p1 end tile of drag
|
* @param p1 end tile of drag
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = (bit 0-5) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev), only used for building
|
* - p2 = (bit 0-5) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev), only used for building
|
||||||
|
@ -965,15 +965,15 @@ CommandCost CmdBuildRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
* @see CmdRailTrackHelper
|
* @see CmdRailTrackHelper
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRemoveRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRemoveRailroadTrack(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
return CmdRailTrackHelper(tile, flags, p1, SetBit(p2, 9), text);
|
return CmdRailTrackHelper(flags, tile, p1, SetBit(p2, 9), text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a train depot
|
* Build a train depot
|
||||||
* @param tile position of the train depot
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile position of the train depot
|
||||||
* @param p1 rail type
|
* @param p1 rail type
|
||||||
* @param p2 bit 0..1 entrance direction (DiagDirection)
|
* @param p2 bit 0..1 entrance direction (DiagDirection)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
|
@ -982,7 +982,7 @@ CommandCost CmdRemoveRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p
|
||||||
* @todo When checking for the tile slope,
|
* @todo When checking for the tile slope,
|
||||||
* distinguish between "Flat land required" and "land sloped in wrong direction"
|
* distinguish between "Flat land required" and "land sloped in wrong direction"
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildTrainDepot(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
/* check railtype and valid direction for depot (0 through 3), 4 in total */
|
/* check railtype and valid direction for depot (0 through 3), 4 in total */
|
||||||
RailType railtype = Extract<RailType, 0, 6>(p1);
|
RailType railtype = Extract<RailType, 0, 6>(p1);
|
||||||
|
@ -1039,8 +1039,8 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||||
* Build signals, alternate between double/single, signal/semaphore,
|
* Build signals, alternate between double/single, signal/semaphore,
|
||||||
* pre/exit/combo-signals, and what-else not. If the rail piece does not
|
* pre/exit/combo-signals, and what-else not. If the rail piece does not
|
||||||
* have any signals, bit 4 (cycle signal-type) is ignored
|
* have any signals, bit 4 (cycle signal-type) is ignored
|
||||||
* @param tile tile where to build the signals
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile tile where to build the signals
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0-2) - track-orientation, valid values: 0-5 (Track enum)
|
* - p1 = (bit 0-2) - track-orientation, valid values: 0-5 (Track enum)
|
||||||
* - p1 = (bit 3) - 1 = override signal/semaphore, or pre/exit/combo signal or (for bit 7) toggle variant (CTRL-toggle)
|
* - p1 = (bit 3) - 1 = override signal/semaphore, or pre/exit/combo signal or (for bit 7) toggle variant (CTRL-toggle)
|
||||||
|
@ -1056,7 +1056,7 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
* @todo p2 should be replaced by two bits for "along" and "against" the track.
|
* @todo p2 should be replaced by two bits for "along" and "against" the track.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildSingleSignal(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Track track = Extract<Track, 0, 3>(p1);
|
Track track = Extract<Track, 0, 3>(p1);
|
||||||
bool ctrl_pressed = HasBit(p1, 3); // was the CTRL button pressed
|
bool ctrl_pressed = HasBit(p1, 3); // was the CTRL button pressed
|
||||||
|
@ -1256,8 +1256,8 @@ static bool AdvanceSignalAutoFill(TileIndex &tile, Trackdir &trackdir, bool remo
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build many signals by dragging; AutoSignals
|
* Build many signals by dragging; AutoSignals
|
||||||
* @param tile start tile of drag
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile start tile of drag
|
||||||
* @param p1 end tile of drag
|
* @param p1 end tile of drag
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = (bit 0- 2) - track-orientation, valid values: 0-5 (Track enum)
|
* - p2 = (bit 0- 2) - track-orientation, valid values: 0-5 (Track enum)
|
||||||
|
@ -1271,7 +1271,7 @@ static bool AdvanceSignalAutoFill(TileIndex &tile, Trackdir &trackdir, bool remo
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
static CommandCost CmdSignalTrackHelper(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
CommandCost total_cost(EXPENSES_CONSTRUCTION);
|
CommandCost total_cost(EXPENSES_CONSTRUCTION);
|
||||||
TileIndex start_tile = tile;
|
TileIndex start_tile = tile;
|
||||||
|
@ -1467,8 +1467,8 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uin
|
||||||
/**
|
/**
|
||||||
* Build signals on a stretch of track.
|
* Build signals on a stretch of track.
|
||||||
* Stub for the unified signal builder/remover
|
* Stub for the unified signal builder/remover
|
||||||
* @param tile start tile of drag
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile start tile of drag
|
||||||
* @param p1 end tile of drag
|
* @param p1 end tile of drag
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = (bit 0- 2) - track-orientation, valid values: 0-5 (Track enum)
|
* - p2 = (bit 0- 2) - track-orientation, valid values: 0-5 (Track enum)
|
||||||
|
@ -1482,15 +1482,15 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uin
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
* @see CmdSignalTrackHelper
|
* @see CmdSignalTrackHelper
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildSignalTrack(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
return CmdSignalTrackHelper(tile, flags, p1, p2, text);
|
return CmdSignalTrackHelper(flags, tile, p1, p2, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove signals
|
* Remove signals
|
||||||
* @param tile coordinates where signal is being deleted from
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile coordinates where signal is being deleted from
|
||||||
* @param p1 various bitstuffed elements, only track information is used
|
* @param p1 various bitstuffed elements, only track information is used
|
||||||
* - (bit 0- 2) - track-orientation, valid values: 0-5 (Track enum)
|
* - (bit 0- 2) - track-orientation, valid values: 0-5 (Track enum)
|
||||||
* - (bit 3) - override signal/semaphore, or pre/exit/combo signal (CTRL-toggle)
|
* - (bit 3) - override signal/semaphore, or pre/exit/combo signal (CTRL-toggle)
|
||||||
|
@ -1499,7 +1499,7 @@ CommandCost CmdBuildSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRemoveSingleSignal(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Track track = Extract<Track, 0, 3>(p1);
|
Track track = Extract<Track, 0, 3>(p1);
|
||||||
|
|
||||||
|
@ -1559,8 +1559,8 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||||
/**
|
/**
|
||||||
* Remove signals on a stretch of track.
|
* Remove signals on a stretch of track.
|
||||||
* Stub for the unified signal builder/remover
|
* Stub for the unified signal builder/remover
|
||||||
* @param tile start tile of drag
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile start tile of drag
|
||||||
* @param p1 end tile of drag
|
* @param p1 end tile of drag
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = (bit 0- 2) - track-orientation, valid values: 0-5 (Track enum)
|
* - p2 = (bit 0- 2) - track-orientation, valid values: 0-5 (Track enum)
|
||||||
|
@ -1574,9 +1574,9 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
* @see CmdSignalTrackHelper
|
* @see CmdSignalTrackHelper
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRemoveSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRemoveSignalTrack(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
return CmdSignalTrackHelper(tile, flags, p1, SetBit(p2, 5), text); // bit 5 is remove bit
|
return CmdSignalTrackHelper(flags, tile, p1, SetBit(p2, 5), text); // bit 5 is remove bit
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update power of train under which is the railtype being converted */
|
/** Update power of train under which is the railtype being converted */
|
||||||
|
@ -1593,8 +1593,8 @@ static Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data)
|
||||||
/**
|
/**
|
||||||
* Convert one rail type to the other. You can convert normal rail to
|
* Convert one rail type to the other. You can convert normal rail to
|
||||||
* monorail/maglev easily or vice-versa.
|
* monorail/maglev easily or vice-versa.
|
||||||
* @param tile end tile of rail conversion drag
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile end tile of rail conversion drag
|
||||||
* @param p1 start tile of drag
|
* @param p1 start tile of drag
|
||||||
* @param p2 various bitstuffed elements:
|
* @param p2 various bitstuffed elements:
|
||||||
* - p2 = (bit 0- 5) new railtype to convert to.
|
* - p2 = (bit 0- 5) new railtype to convert to.
|
||||||
|
@ -1602,7 +1602,7 @@ static Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdConvertRail(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
RailType totype = Extract<RailType, 0, 6>(p2);
|
RailType totype = Extract<RailType, 0, 6>(p2);
|
||||||
TileIndex area_start = p1;
|
TileIndex area_start = p1;
|
||||||
|
|
|
@ -602,8 +602,8 @@ static CommandCost CheckRoadSlope(Slope tileh, RoadBits *pieces, RoadBits existi
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a piece of road.
|
* Build a piece of road.
|
||||||
* @param tile tile where to build road
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile tile where to build road
|
||||||
* @param p1 bit 0..3 road pieces to build (RoadBits)
|
* @param p1 bit 0..3 road pieces to build (RoadBits)
|
||||||
* bit 4..9 road type
|
* bit 4..9 road type
|
||||||
* bit 11..12 disallowed directions to toggle
|
* bit 11..12 disallowed directions to toggle
|
||||||
|
@ -611,7 +611,7 @@ static CommandCost CheckRoadSlope(Slope tileh, RoadBits *pieces, RoadBits existi
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildRoad(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
CompanyID company = _current_company;
|
CompanyID company = _current_company;
|
||||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||||
|
@ -967,8 +967,8 @@ static bool CanConnectToRoad(TileIndex tile, RoadType rt, DiagDirection dir)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a long piece of road.
|
* Build a long piece of road.
|
||||||
* @param start_tile start tile of drag (the building cost will appear over this tile)
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param start_tile start tile of drag (the building cost will appear over this tile)
|
||||||
* @param p1 end tile of drag
|
* @param p1 end tile of drag
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = (bit 0) - start tile starts in the 2nd half of tile (p2 & 1). Only used if bit 6 is set or if we are building a single tile
|
* - p2 = (bit 0) - start tile starts in the 2nd half of tile (p2 & 1). Only used if bit 6 is set or if we are building a single tile
|
||||||
|
@ -982,7 +982,7 @@ static bool CanConnectToRoad(TileIndex tile, RoadType rt, DiagDirection dir)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildLongRoad(DoCommandFlag flags, TileIndex start_tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
DisallowedRoadDirections drd = DRD_NORTHBOUND;
|
DisallowedRoadDirections drd = DRD_NORTHBOUND;
|
||||||
|
|
||||||
|
@ -1076,8 +1076,8 @@ CommandCost CmdBuildLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a long piece of road.
|
* Remove a long piece of road.
|
||||||
* @param start_tile start tile of drag
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param start_tile start tile of drag
|
||||||
* @param p1 end tile of drag
|
* @param p1 end tile of drag
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = (bit 0) - start tile starts in the 2nd half of tile (p2 & 1)
|
* - p2 = (bit 0) - start tile starts in the 2nd half of tile (p2 & 1)
|
||||||
|
@ -1087,7 +1087,7 @@ CommandCost CmdBuildLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRemoveLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRemoveLongRoad(DoCommandFlag flags, TileIndex start_tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||||
|
|
||||||
|
@ -1164,7 +1164,7 @@ CommandCost CmdRemoveLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32
|
||||||
* @todo When checking for the tile slope,
|
* @todo When checking for the tile slope,
|
||||||
* distinguish between "Flat land required" and "land sloped in wrong direction"
|
* distinguish between "Flat land required" and "land sloped in wrong direction"
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildRoadDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildRoadDepot(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
DiagDirection dir = Extract<DiagDirection, 0, 2>(p1);
|
DiagDirection dir = Extract<DiagDirection, 0, 2>(p1);
|
||||||
|
|
||||||
|
@ -2343,15 +2343,15 @@ static void ConvertRoadTypeOwner(TileIndex tile, uint num_pieces, Owner owner, R
|
||||||
* Convert one road subtype to another.
|
* Convert one road subtype to another.
|
||||||
* Not meant to convert from road to tram.
|
* Not meant to convert from road to tram.
|
||||||
*
|
*
|
||||||
* @param tile end tile of road conversion drag
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile end tile of road conversion drag
|
||||||
* @param p1 start tile of drag
|
* @param p1 start tile of drag
|
||||||
* @param p2 various bitstuffed elements:
|
* @param p2 various bitstuffed elements:
|
||||||
* - p2 = (bit 0..5) new roadtype to convert to.
|
* - p2 = (bit 0..5) new roadtype to convert to.
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdConvertRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdConvertRoad(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
RoadType to_type = Extract<RoadType, 0, 6>(p2);
|
RoadType to_type = Extract<RoadType, 0, 6>(p2);
|
||||||
|
|
||||||
|
|
|
@ -250,14 +250,14 @@ void RoadVehUpdateCache(RoadVehicle *v, bool same_length)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a road vehicle.
|
* Build a road vehicle.
|
||||||
* @param tile tile of the depot where road vehicle is built.
|
|
||||||
* @param flags type of operation.
|
* @param flags type of operation.
|
||||||
|
* @param tile tile of the depot where road vehicle is built.
|
||||||
* @param e the engine to build.
|
* @param e the engine to build.
|
||||||
* @param data unused.
|
* @param data unused.
|
||||||
* @param[out] ret the vehicle that has been built.
|
* @param[out] ret the vehicle that has been built.
|
||||||
* @return the cost of this operation or an error.
|
* @return the cost of this operation or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildRoadVehicle(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **ret)
|
CommandCost CmdBuildRoadVehicle(DoCommandFlag flags, TileIndex tile, const Engine *e, uint16 data, Vehicle **ret)
|
||||||
{
|
{
|
||||||
/* Check that the vehicle can drive on the road in question */
|
/* Check that the vehicle can drive on the road in question */
|
||||||
RoadType rt = e->u.road.roadtype;
|
RoadType rt = e->u.road.roadtype;
|
||||||
|
@ -360,14 +360,14 @@ bool RoadVehicle::FindClosestDepot(TileIndex *location, DestinationID *destinati
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn a roadvehicle around.
|
* Turn a roadvehicle around.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 vehicle ID to turn
|
* @param p1 vehicle ID to turn
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdTurnRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdTurnRoadVeh(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
RoadVehicle *v = RoadVehicle::GetIfValid(p1);
|
RoadVehicle *v = RoadVehicle::GetIfValid(p1);
|
||||||
if (v == nullptr) return CMD_ERROR;
|
if (v == nullptr) return CMD_ERROR;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "engine_type.h"
|
#include "engine_type.h"
|
||||||
#include "vehicle_type.h"
|
#include "vehicle_type.h"
|
||||||
|
|
||||||
CommandCost CmdBuildRoadVehicle(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **v);
|
CommandCost CmdBuildRoadVehicle(DoCommandFlag flags, TileIndex tile, const Engine *e, uint16 data, Vehicle **v);
|
||||||
|
|
||||||
CommandProc CmdTurnRoadVeh;
|
CommandProc CmdTurnRoadVeh;
|
||||||
|
|
||||||
|
|
|
@ -1486,8 +1486,8 @@ const SettingDesc *GetSettingFromName(const std::string_view name)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Network-safe changing of settings (server-only).
|
* Network-safe changing of settings (server-only).
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 unused
|
* @param p1 unused
|
||||||
* @param p2 the new value for the setting
|
* @param p2 the new value for the setting
|
||||||
* The new value is properly clamped to its minimum/maximum when setting
|
* The new value is properly clamped to its minimum/maximum when setting
|
||||||
|
@ -1495,7 +1495,7 @@ const SettingDesc *GetSettingFromName(const std::string_view name)
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
* @see _settings
|
* @see _settings
|
||||||
*/
|
*/
|
||||||
CommandCost CmdChangeSetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdChangeSetting(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (text.empty()) return CMD_ERROR;
|
if (text.empty()) return CMD_ERROR;
|
||||||
const SettingDesc *sd = GetSettingFromName(text);
|
const SettingDesc *sd = GetSettingFromName(text);
|
||||||
|
@ -1515,15 +1515,15 @@ CommandCost CmdChangeSetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change one of the per-company settings.
|
* Change one of the per-company settings.
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 unused
|
* @param p1 unused
|
||||||
* @param p2 the new value for the setting
|
* @param p2 the new value for the setting
|
||||||
* The new value is properly clamped to its minimum/maximum when setting
|
* The new value is properly clamped to its minimum/maximum when setting
|
||||||
* @param text the name of the company setting to change
|
* @param text the name of the company setting to change
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdChangeCompanySetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdChangeCompanySetting(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (text.empty()) return CMD_ERROR;
|
if (text.empty()) return CMD_ERROR;
|
||||||
const SettingDesc *sd = GetCompanySettingFromName(text.c_str());
|
const SettingDesc *sd = GetCompanySettingFromName(text.c_str());
|
||||||
|
|
|
@ -838,14 +838,14 @@ void Ship::SetDestTile(TileIndex tile)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a ship.
|
* Build a ship.
|
||||||
* @param tile tile of the depot where ship is built.
|
|
||||||
* @param flags type of operation.
|
* @param flags type of operation.
|
||||||
|
* @param tile tile of the depot where ship is built.
|
||||||
* @param e the engine to build.
|
* @param e the engine to build.
|
||||||
* @param data unused.
|
* @param data unused.
|
||||||
* @param[out] ret the vehicle that has been built.
|
* @param[out] ret the vehicle that has been built.
|
||||||
* @return the cost of this operation or an error.
|
* @return the cost of this operation or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **ret)
|
CommandCost CmdBuildShip(DoCommandFlag flags, TileIndex tile, const Engine *e, uint16 data, Vehicle **ret)
|
||||||
{
|
{
|
||||||
tile = GetShipDepotNorthTile(tile);
|
tile = GetShipDepotNorthTile(tile);
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
|
|
|
@ -14,6 +14,6 @@
|
||||||
#include "engine_type.h"
|
#include "engine_type.h"
|
||||||
#include "vehicle_type.h"
|
#include "vehicle_type.h"
|
||||||
|
|
||||||
CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **v);
|
CommandCost CmdBuildShip(DoCommandFlag flags, TileIndex tile, const Engine *e, uint16 data, Vehicle **v);
|
||||||
|
|
||||||
#endif /* SHIP_CMD_H */
|
#endif /* SHIP_CMD_H */
|
||||||
|
|
|
@ -37,7 +37,7 @@ SignID _new_sign_id;
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdPlaceSign(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
/* Try to locate a new sign */
|
/* Try to locate a new sign */
|
||||||
if (!Sign::CanAllocateItem()) return_cmd_error(STR_ERROR_TOO_MANY_SIGNS);
|
if (!Sign::CanAllocateItem()) return_cmd_error(STR_ERROR_TOO_MANY_SIGNS);
|
||||||
|
@ -76,7 +76,7 @@ CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
* @param text the new name or an empty string when resetting to the default
|
* @param text the new name or an empty string when resetting to the default
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRenameSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRenameSign(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Sign *si = Sign::GetIfValid(p1);
|
Sign *si = Sign::GetIfValid(p1);
|
||||||
if (si == nullptr) return CMD_ERROR;
|
if (si == nullptr) return CMD_ERROR;
|
||||||
|
|
|
@ -1237,8 +1237,8 @@ static void RestoreTrainReservation(Train *v)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build rail station
|
* Build rail station
|
||||||
* @param tile_org northern most position of station dragging/placement
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile_org northern most position of station dragging/placement
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0- 5) - railtype
|
* - p1 = (bit 0- 5) - railtype
|
||||||
* - p1 = (bit 6) - orientation (Axis)
|
* - p1 = (bit 6) - orientation (Axis)
|
||||||
|
@ -1252,7 +1252,7 @@ static void RestoreTrainReservation(Train *v)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildRailStation(DoCommandFlag flags, TileIndex tile_org, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
/* Unpack parameters */
|
/* Unpack parameters */
|
||||||
RailType rt = Extract<RailType, 0, 6>(p1);
|
RailType rt = Extract<RailType, 0, 6>(p1);
|
||||||
|
@ -1653,15 +1653,15 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, std::vector<T *> &affected_st
|
||||||
/**
|
/**
|
||||||
* Remove a single tile from a rail station.
|
* Remove a single tile from a rail station.
|
||||||
* This allows for custom-built station with holes and weird layouts
|
* This allows for custom-built station with holes and weird layouts
|
||||||
* @param start tile of station piece to remove
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param start tile of station piece to remove
|
||||||
* @param p1 start_tile
|
* @param p1 start_tile
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = bit 0 - if set keep the rail
|
* - p2 = bit 0 - if set keep the rail
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRemoveFromRailStation(TileIndex start, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRemoveFromRailStation(DoCommandFlag flags, TileIndex start, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
TileIndex end = p1 == 0 ? start : p1;
|
TileIndex end = p1 == 0 ? start : p1;
|
||||||
if (start >= MapSize() || end >= MapSize()) return CMD_ERROR;
|
if (start >= MapSize() || end >= MapSize()) return CMD_ERROR;
|
||||||
|
@ -1687,15 +1687,15 @@ CommandCost CmdRemoveFromRailStation(TileIndex start, DoCommandFlag flags, uint3
|
||||||
/**
|
/**
|
||||||
* Remove a single tile from a waypoint.
|
* Remove a single tile from a waypoint.
|
||||||
* This allows for custom-built waypoint with holes and weird layouts
|
* This allows for custom-built waypoint with holes and weird layouts
|
||||||
* @param start tile of waypoint piece to remove
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param start tile of waypoint piece to remove
|
||||||
* @param p1 start_tile
|
* @param p1 start_tile
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = bit 0 - if set keep the rail
|
* - p2 = bit 0 - if set keep the rail
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRemoveFromRailWaypoint(TileIndex start, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRemoveFromRailWaypoint(DoCommandFlag flags, TileIndex start, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
TileIndex end = p1 == 0 ? start : p1;
|
TileIndex end = p1 == 0 ? start : p1;
|
||||||
if (start >= MapSize() || end >= MapSize()) return CMD_ERROR;
|
if (start >= MapSize() || end >= MapSize()) return CMD_ERROR;
|
||||||
|
@ -1820,8 +1820,8 @@ static CommandCost FindJoiningRoadStop(StationID existing_stop, StationID statio
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a bus or truck stop.
|
* Build a bus or truck stop.
|
||||||
* @param tile Northernmost tile of the stop.
|
|
||||||
* @param flags Operation to perform.
|
* @param flags Operation to perform.
|
||||||
|
* @param tile Northernmost tile of the stop.
|
||||||
* @param p1 bit 0..7: Width of the road stop.
|
* @param p1 bit 0..7: Width of the road stop.
|
||||||
* bit 8..15: Length of the road stop.
|
* bit 8..15: Length of the road stop.
|
||||||
* @param p2 bit 0: 0 For bus stops, 1 for truck stops.
|
* @param p2 bit 0: 0 For bus stops, 1 for truck stops.
|
||||||
|
@ -1834,7 +1834,7 @@ static CommandCost FindJoiningRoadStop(StationID existing_stop, StationID statio
|
||||||
* @param text Unused.
|
* @param text Unused.
|
||||||
* @return The cost of this operation or an error.
|
* @return The cost of this operation or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildRoadStop(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
bool type = HasBit(p2, 0);
|
bool type = HasBit(p2, 0);
|
||||||
bool is_drive_through = HasBit(p2, 1);
|
bool is_drive_through = HasBit(p2, 1);
|
||||||
|
@ -2075,8 +2075,8 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove bus or truck stops.
|
* Remove bus or truck stops.
|
||||||
* @param tile Northernmost tile of the removal area.
|
|
||||||
* @param flags Operation to perform.
|
* @param flags Operation to perform.
|
||||||
|
* @param tile Northernmost tile of the removal area.
|
||||||
* @param p1 bit 0..7: Width of the removal area.
|
* @param p1 bit 0..7: Width of the removal area.
|
||||||
* bit 8..15: Height of the removal area.
|
* bit 8..15: Height of the removal area.
|
||||||
* @param p2 bit 0: 0 For bus stops, 1 for truck stops.
|
* @param p2 bit 0: 0 For bus stops, 1 for truck stops.
|
||||||
|
@ -2084,7 +2084,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
|
||||||
* @param text Unused.
|
* @param text Unused.
|
||||||
* @return The cost of this operation or an error.
|
* @return The cost of this operation or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRemoveRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRemoveRoadStop(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
uint8 width = (uint8)GB(p1, 0, 8);
|
uint8 width = (uint8)GB(p1, 0, 8);
|
||||||
uint8 height = (uint8)GB(p1, 8, 8);
|
uint8 height = (uint8)GB(p1, 8, 8);
|
||||||
|
@ -2232,8 +2232,8 @@ void UpdateAirportsNoise()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Place an Airport.
|
* Place an Airport.
|
||||||
* @param tile tile where airport will be built
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile tile where airport will be built
|
||||||
* @param p1
|
* @param p1
|
||||||
* - p1 = (bit 0- 7) - airport type, @see airport.h
|
* - p1 = (bit 0- 7) - airport type, @see airport.h
|
||||||
* - p1 = (bit 8-15) - airport layout
|
* - p1 = (bit 8-15) - airport layout
|
||||||
|
@ -2243,7 +2243,7 @@ void UpdateAirportsNoise()
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildAirport(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
StationID station_to_join = GB(p2, 16, 16);
|
StationID station_to_join = GB(p2, 16, 16);
|
||||||
bool reuse = (station_to_join != NEW_STATION);
|
bool reuse = (station_to_join != NEW_STATION);
|
||||||
|
@ -2453,14 +2453,14 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open/close an airport to incoming aircraft.
|
* Open/close an airport to incoming aircraft.
|
||||||
* @param tile Unused.
|
|
||||||
* @param flags Operation to perform.
|
* @param flags Operation to perform.
|
||||||
|
* @param tile Unused.
|
||||||
* @param p1 Station ID of the airport.
|
* @param p1 Station ID of the airport.
|
||||||
* @param p2 Unused.
|
* @param p2 Unused.
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdOpenCloseAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdOpenCloseAirport(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (!Station::IsValidID(p1)) return CMD_ERROR;
|
if (!Station::IsValidID(p1)) return CMD_ERROR;
|
||||||
Station *st = Station::Get(p1);
|
Station *st = Station::Get(p1);
|
||||||
|
@ -2508,14 +2508,14 @@ static const byte _dock_h_chk[4] = { 1, 2, 1, 2 };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a dock/haven.
|
* Build a dock/haven.
|
||||||
* @param tile tile where dock will be built
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile tile where dock will be built
|
||||||
* @param p1 (bit 0) - allow docks directly adjacent to other docks.
|
* @param p1 (bit 0) - allow docks directly adjacent to other docks.
|
||||||
* @param p2 bit 16-31: station ID to join (NEW_STATION if build new one)
|
* @param p2 bit 16-31: station ID to join (NEW_STATION if build new one)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildDock(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
StationID station_to_join = GB(p2, 16, 16);
|
StationID station_to_join = GB(p2, 16, 16);
|
||||||
bool reuse = (station_to_join != NEW_STATION);
|
bool reuse = (station_to_join != NEW_STATION);
|
||||||
|
@ -3927,14 +3927,14 @@ static bool IsUniqueStationName(const std::string &name)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename a station
|
* Rename a station
|
||||||
* @param tile unused
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile unused
|
||||||
* @param p1 station ID that is to be renamed
|
* @param p1 station ID that is to be renamed
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text the new name or an empty string when resetting to the default
|
* @param text the new name or an empty string when resetting to the default
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRenameStation(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRenameStation(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Station *st = Station::GetIfValid(p1);
|
Station *st = Station::GetIfValid(p1);
|
||||||
if (st == nullptr) return CMD_ERROR;
|
if (st == nullptr) return CMD_ERROR;
|
||||||
|
|
|
@ -197,15 +197,15 @@ bool StoryPageButtonData::ValidateVehicleType() const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new story page.
|
* Create a new story page.
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0 - 7) - Company for which this story page belongs to.
|
* - p1 = (bit 0 - 7) - Company for which this story page belongs to.
|
||||||
* @param p2 unused.
|
* @param p2 unused.
|
||||||
* @param text Title of the story page. Null is allowed in which case a generic page title is provided by OpenTTD.
|
* @param text Title of the story page. Null is allowed in which case a generic page title is provided by OpenTTD.
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdCreateStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdCreateStoryPage(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (!StoryPage::CanAllocateItem()) return CMD_ERROR;
|
if (!StoryPage::CanAllocateItem()) return CMD_ERROR;
|
||||||
|
|
||||||
|
@ -242,8 +242,8 @@ CommandCost CmdCreateStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new story page element.
|
* Create a new story page element.
|
||||||
* @param tile Tile location if it is a location page element, otherwise unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile Tile location if it is a location page element, otherwise unused.
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0 - 15) - The page which the element belongs to.
|
* - p1 = (bit 0 - 15) - The page which the element belongs to.
|
||||||
* (bit 16 - 23) - Page element type
|
* (bit 16 - 23) - Page element type
|
||||||
|
@ -251,7 +251,7 @@ CommandCost CmdCreateStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||||
* @param text Text content in case it is a text or location page element
|
* @param text Text content in case it is a text or location page element
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdCreateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdCreateStoryPageElement(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (!StoryPageElement::CanAllocateItem()) return CMD_ERROR;
|
if (!StoryPageElement::CanAllocateItem()) return CMD_ERROR;
|
||||||
|
|
||||||
|
@ -292,8 +292,8 @@ CommandCost CmdCreateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a new story page element.
|
* Update a new story page element.
|
||||||
* @param tile Tile location if it is a location page element, otherwise unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile Tile location if it is a location page element, otherwise unused.
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0 - 15) - The page element to update.
|
* - p1 = (bit 0 - 15) - The page element to update.
|
||||||
* (bit 16 - 31) - unused
|
* (bit 16 - 31) - unused
|
||||||
|
@ -301,7 +301,7 @@ CommandCost CmdCreateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint3
|
||||||
* @param text Text content in case it is a text or location page element
|
* @param text Text content in case it is a text or location page element
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdUpdateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdUpdateStoryPageElement(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
StoryPageElementID page_element_id = (StoryPageElementID)GB(p1, 0, 16);
|
StoryPageElementID page_element_id = (StoryPageElementID)GB(p1, 0, 16);
|
||||||
|
|
||||||
|
@ -324,14 +324,14 @@ CommandCost CmdUpdateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update title of a story page.
|
* Update title of a story page.
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 = (bit 0 - 15) - StoryPageID to update.
|
* @param p1 = (bit 0 - 15) - StoryPageID to update.
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text title text of the story page.
|
* @param text title text of the story page.
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetStoryPageTitle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSetStoryPageTitle(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
StoryPageID page_id = (StoryPageID)GB(p1, 0, 16);
|
StoryPageID page_id = (StoryPageID)GB(p1, 0, 16);
|
||||||
|
@ -354,14 +354,14 @@ CommandCost CmdSetStoryPageTitle(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update date of a story page.
|
* Update date of a story page.
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 = (bit 0 - 15) - StoryPageID to update.
|
* @param p1 = (bit 0 - 15) - StoryPageID to update.
|
||||||
* @param p2 = (bit 0 - 31) - date
|
* @param p2 = (bit 0 - 31) - date
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetStoryPageDate(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSetStoryPageDate(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
StoryPageID page_id = (StoryPageID)GB(p1, 0, 16);
|
StoryPageID page_id = (StoryPageID)GB(p1, 0, 16);
|
||||||
|
@ -381,14 +381,14 @@ CommandCost CmdSetStoryPageDate(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
/**
|
/**
|
||||||
* Display a story page for all clients that are allowed to
|
* Display a story page for all clients that are allowed to
|
||||||
* view the story page.
|
* view the story page.
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 = (bit 0 - 15) - StoryPageID to show.
|
* @param p1 = (bit 0 - 15) - StoryPageID to show.
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdShowStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdShowStoryPage(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
StoryPageID page_id = (StoryPageID)GB(p1, 0, 16);
|
StoryPageID page_id = (StoryPageID)GB(p1, 0, 16);
|
||||||
|
@ -403,14 +403,14 @@ CommandCost CmdShowStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Remove a story page and associated story page elements.
|
* Remove a story page and associated story page elements.
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 = (bit 0 - 15) - StoryPageID to remove.
|
* @param p1 = (bit 0 - 15) - StoryPageID to remove.
|
||||||
* @param p2 unused.
|
* @param p2 unused.
|
||||||
* @param text unused.
|
* @param text unused.
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRemoveStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRemoveStoryPage(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
StoryPageID page_id = (StoryPageID)p1;
|
StoryPageID page_id = (StoryPageID)p1;
|
||||||
|
@ -436,14 +436,14 @@ CommandCost CmdRemoveStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a story page element
|
* Remove a story page element
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 = (bit 0 - 15) - StoryPageElementID to remove.
|
* @param p1 = (bit 0 - 15) - StoryPageElementID to remove.
|
||||||
* @param p2 unused.
|
* @param p2 unused.
|
||||||
* @param text unused.
|
* @param text unused.
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRemoveStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRemoveStoryPageElement(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
StoryPageElementID page_element_id = (StoryPageElementID)p1;
|
StoryPageElementID page_element_id = (StoryPageElementID)p1;
|
||||||
|
@ -463,14 +463,14 @@ CommandCost CmdRemoveStoryPageElement(TileIndex tile, DoCommandFlag flags, uint3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clicked/used a button on a story page.
|
* Clicked/used a button on a story page.
|
||||||
* @param tile Tile selected, for tile selection buttons, otherwise unused.
|
|
||||||
* @param flags Type of operation.
|
* @param flags Type of operation.
|
||||||
|
* @param tile Tile selected, for tile selection buttons, otherwise unused.
|
||||||
* @param p1 Bit 0..15 = story page element id of button.
|
* @param p1 Bit 0..15 = story page element id of button.
|
||||||
* @param p2 ID of selected item for buttons that select an item (e.g. vehicle), otherwise unused.
|
* @param p2 ID of selected item for buttons that select an item (e.g. vehicle), otherwise unused.
|
||||||
* @param text Unused.
|
* @param text Unused.
|
||||||
* @return The cost of the operation, or an error.
|
* @return The cost of the operation, or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdStoryPageButton(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdStoryPageButton(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
StoryPageElementID page_element_id = (StoryPageElementID)GB(p1, 0, 16);
|
StoryPageElementID page_element_id = (StoryPageElementID)GB(p1, 0, 16);
|
||||||
|
|
||||||
|
|
|
@ -231,8 +231,8 @@ void CreateSubsidy(CargoID cid, SourceType src_type, SourceID src, SourceType ds
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new subsidy.
|
* Create a new subsidy.
|
||||||
* @param tile unused.
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused.
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0 - 7) - SourceType of source.
|
* - p1 = (bit 0 - 7) - SourceType of source.
|
||||||
* - p1 = (bit 8 - 23) - SourceID of source.
|
* - p1 = (bit 8 - 23) - SourceID of source.
|
||||||
|
@ -243,7 +243,7 @@ void CreateSubsidy(CargoID cid, SourceType src_type, SourceID src, SourceType ds
|
||||||
* @param text unused.
|
* @param text unused.
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdCreateSubsidy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdCreateSubsidy(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (!Subsidy::CanAllocateItem()) return CMD_ERROR;
|
if (!Subsidy::CanAllocateItem()) return CMD_ERROR;
|
||||||
|
|
||||||
|
|
|
@ -179,14 +179,14 @@ static CommandCost TerraformTileHeight(TerraformerState *ts, TileIndex tile, int
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terraform land
|
* Terraform land
|
||||||
* @param tile tile to terraform
|
|
||||||
* @param flags for this command type
|
* @param flags for this command type
|
||||||
|
* @param tile tile to terraform
|
||||||
* @param p1 corners to terraform (SLOPE_xxx)
|
* @param p1 corners to terraform (SLOPE_xxx)
|
||||||
* @param p2 direction; eg up (non-zero) or down (zero)
|
* @param p2 direction; eg up (non-zero) or down (zero)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdTerraformLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdTerraformLand(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
_terraform_err_tile = INVALID_TILE;
|
_terraform_err_tile = INVALID_TILE;
|
||||||
|
|
||||||
|
@ -334,8 +334,8 @@ CommandCost CmdTerraformLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Levels a selected (rectangle) area of land
|
* Levels a selected (rectangle) area of land
|
||||||
* @param tile end tile of area-drag
|
|
||||||
* @param flags for this command type
|
* @param flags for this command type
|
||||||
|
* @param tile end tile of area-drag
|
||||||
* @param p1 start tile of area drag
|
* @param p1 start tile of area drag
|
||||||
* @param p2 various bitstuffed data.
|
* @param p2 various bitstuffed data.
|
||||||
* bit 0: Whether to use the Orthogonal (0) or Diagonal (1) iterator.
|
* bit 0: Whether to use the Orthogonal (0) or Diagonal (1) iterator.
|
||||||
|
@ -343,7 +343,7 @@ CommandCost CmdTerraformLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdLevelLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdLevelLand(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (p1 >= MapSize()) return CMD_ERROR;
|
if (p1 >= MapSize()) return CMD_ERROR;
|
||||||
|
|
||||||
|
|
|
@ -86,8 +86,8 @@ static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 val,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change timetable data of an order.
|
* Change timetable data of an order.
|
||||||
* @param tile Not used.
|
|
||||||
* @param flags Operation to perform.
|
* @param flags Operation to perform.
|
||||||
|
* @param tile Not used.
|
||||||
* @param p1 Various bitstuffed elements
|
* @param p1 Various bitstuffed elements
|
||||||
* - p1 = (bit 0-19) - Vehicle with the orders to change.
|
* - p1 = (bit 0-19) - Vehicle with the orders to change.
|
||||||
* - p1 = (bit 20-27) - Order index to modify.
|
* - p1 = (bit 20-27) - Order index to modify.
|
||||||
|
@ -98,7 +98,7 @@ static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 val,
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdChangeTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdChangeTimetable(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleID veh = GB(p1, 0, 20);
|
VehicleID veh = GB(p1, 0, 20);
|
||||||
|
|
||||||
|
@ -184,15 +184,15 @@ CommandCost CmdChangeTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the lateness counter to make the vehicle on time.
|
* Clear the lateness counter to make the vehicle on time.
|
||||||
* @param tile Not used.
|
|
||||||
* @param flags Operation to perform.
|
* @param flags Operation to perform.
|
||||||
|
* @param tile Not used.
|
||||||
* @param p1 Various bitstuffed elements
|
* @param p1 Various bitstuffed elements
|
||||||
* - p1 = (bit 0-19) - Vehicle with the orders to change.
|
* - p1 = (bit 0-19) - Vehicle with the orders to change.
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetVehicleOnTime(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSetVehicleOnTime(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleID veh = GB(p1, 0, 20);
|
VehicleID veh = GB(p1, 0, 20);
|
||||||
|
|
||||||
|
@ -250,8 +250,8 @@ static bool VehicleTimetableSorter(Vehicle * const &a, Vehicle * const &b)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the start date of the timetable.
|
* Set the start date of the timetable.
|
||||||
* @param tile Not used.
|
|
||||||
* @param flags Operation to perform.
|
* @param flags Operation to perform.
|
||||||
|
* @param tile Not used.
|
||||||
* @param p2 Various bitstuffed elements
|
* @param p2 Various bitstuffed elements
|
||||||
* - p2 = (bit 0-19) - Vehicle ID.
|
* - p2 = (bit 0-19) - Vehicle ID.
|
||||||
* - p2 = (bit 20) - Set to 1 to set timetable start for all vehicles sharing this order
|
* - p2 = (bit 20) - Set to 1 to set timetable start for all vehicles sharing this order
|
||||||
|
@ -259,7 +259,7 @@ static bool VehicleTimetableSorter(Vehicle * const &a, Vehicle * const &b)
|
||||||
* @param text Not used.
|
* @param text Not used.
|
||||||
* @return The error or cost of the operation.
|
* @return The error or cost of the operation.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSetTimetableStart(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSetTimetableStart(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
bool timetable_all = HasBit(p1, 20);
|
bool timetable_all = HasBit(p1, 20);
|
||||||
Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 20));
|
Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 20));
|
||||||
|
@ -315,8 +315,8 @@ CommandCost CmdSetTimetableStart(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
* Start or stop filling the timetable automatically from the time the vehicle
|
* Start or stop filling the timetable automatically from the time the vehicle
|
||||||
* actually takes to complete it. When starting to autofill the current times
|
* actually takes to complete it. When starting to autofill the current times
|
||||||
* are cleared and the timetable will start again from scratch.
|
* are cleared and the timetable will start again from scratch.
|
||||||
* @param tile Not used.
|
|
||||||
* @param flags Operation to perform.
|
* @param flags Operation to perform.
|
||||||
|
* @param tile Not used.
|
||||||
* @param p1 Vehicle index.
|
* @param p1 Vehicle index.
|
||||||
* @param p2 Various bitstuffed elements
|
* @param p2 Various bitstuffed elements
|
||||||
* - p2 = (bit 0) - Set to 1 to enable, 0 to disable autofill.
|
* - p2 = (bit 0) - Set to 1 to enable, 0 to disable autofill.
|
||||||
|
@ -324,7 +324,7 @@ CommandCost CmdSetTimetableStart(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdAutofillTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdAutofillTimetable(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleID veh = GB(p1, 0, 20);
|
VehicleID veh = GB(p1, 0, 20);
|
||||||
|
|
||||||
|
|
|
@ -1923,8 +1923,8 @@ static bool IsUniqueTownName(const std::string &name)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new town.
|
* Create a new town.
|
||||||
* @param tile coordinates where town is built
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile coordinates where town is built
|
||||||
* @param p1 0..1 size of the town (@see TownSize)
|
* @param p1 0..1 size of the town (@see TownSize)
|
||||||
* 2 true iff it should be a city
|
* 2 true iff it should be a city
|
||||||
* 3..5 town road layout (@see TownLayout)
|
* 3..5 town road layout (@see TownLayout)
|
||||||
|
@ -1933,7 +1933,7 @@ static bool IsUniqueTownName(const std::string &name)
|
||||||
* @param text Custom name for the town. If empty, the town name parts will be used.
|
* @param text Custom name for the town. If empty, the town name parts will be used.
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdFoundTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdFoundTown(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
TownSize size = Extract<TownSize, 0, 2>(p1);
|
TownSize size = Extract<TownSize, 0, 2>(p1);
|
||||||
bool city = HasBit(p1, 2);
|
bool city = HasBit(p1, 2);
|
||||||
|
@ -2735,14 +2735,14 @@ void ClearTownHouse(Town *t, TileIndex tile)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename a town (server-only).
|
* Rename a town (server-only).
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 town ID to rename
|
* @param p1 town ID to rename
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text the new name or an empty string when resetting to the default
|
* @param text the new name or an empty string when resetting to the default
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRenameTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRenameTown(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Town *t = Town::GetIfValid(p1);
|
Town *t = Town::GetIfValid(p1);
|
||||||
if (t == nullptr) return CMD_ERROR;
|
if (t == nullptr) return CMD_ERROR;
|
||||||
|
@ -2786,8 +2786,8 @@ const CargoSpec *FindFirstCargoWithTownEffect(TownEffect effect)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the cargo goal of a town.
|
* Change the cargo goal of a town.
|
||||||
* @param tile Unused.
|
|
||||||
* @param flags Type of operation.
|
* @param flags Type of operation.
|
||||||
|
* @param tile Unused.
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0 - 15) - Town ID to cargo game of.
|
* - p1 = (bit 0 - 15) - Town ID to cargo game of.
|
||||||
* - p1 = (bit 16 - 23) - TownEffect to change the game of.
|
* - p1 = (bit 16 - 23) - TownEffect to change the game of.
|
||||||
|
@ -2795,7 +2795,7 @@ const CargoSpec *FindFirstCargoWithTownEffect(TownEffect effect)
|
||||||
* @param text Unused.
|
* @param text Unused.
|
||||||
* @return Empty cost or an error.
|
* @return Empty cost or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdTownCargoGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdTownCargoGoal(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
|
|
||||||
|
@ -2821,14 +2821,14 @@ CommandCost CmdTownCargoGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a custom text in the Town window.
|
* Set a custom text in the Town window.
|
||||||
* @param tile Unused.
|
|
||||||
* @param flags Type of operation.
|
* @param flags Type of operation.
|
||||||
|
* @param tile Unused.
|
||||||
* @param p1 Town ID to change the text of.
|
* @param p1 Town ID to change the text of.
|
||||||
* @param p2 Unused.
|
* @param p2 Unused.
|
||||||
* @param text The new text (empty to remove the text).
|
* @param text The new text (empty to remove the text).
|
||||||
* @return Empty cost or an error.
|
* @return Empty cost or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdTownSetText(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdTownSetText(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
Town *t = Town::GetIfValid(p1);
|
Town *t = Town::GetIfValid(p1);
|
||||||
|
@ -2845,14 +2845,14 @@ CommandCost CmdTownSetText(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the growth rate of the town.
|
* Change the growth rate of the town.
|
||||||
* @param tile Unused.
|
|
||||||
* @param flags Type of operation.
|
* @param flags Type of operation.
|
||||||
|
* @param tile Unused.
|
||||||
* @param p1 Town ID to cargo game of.
|
* @param p1 Town ID to cargo game of.
|
||||||
* @param p2 Amount of days between growth, or TOWN_GROWTH_RATE_NONE, or 0 to reset custom growth rate.
|
* @param p2 Amount of days between growth, or TOWN_GROWTH_RATE_NONE, or 0 to reset custom growth rate.
|
||||||
* @param text Unused.
|
* @param text Unused.
|
||||||
* @return Empty cost or an error.
|
* @return Empty cost or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdTownGrowthRate(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdTownGrowthRate(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
if (GB(p2, 16, 16) != 0) return CMD_ERROR;
|
if (GB(p2, 16, 16) != 0) return CMD_ERROR;
|
||||||
|
@ -2885,14 +2885,14 @@ CommandCost CmdTownGrowthRate(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the rating of a company in a town
|
* Change the rating of a company in a town
|
||||||
* @param tile Unused.
|
|
||||||
* @param flags Type of operation.
|
* @param flags Type of operation.
|
||||||
|
* @param tile Unused.
|
||||||
* @param p1 Bit 0..15 = Town ID to change, bit 16..23 = Company ID to change.
|
* @param p1 Bit 0..15 = Town ID to change, bit 16..23 = Company ID to change.
|
||||||
* @param p2 Bit 0..15 = New rating of company (signed int16).
|
* @param p2 Bit 0..15 = New rating of company (signed int16).
|
||||||
* @param text Unused.
|
* @param text Unused.
|
||||||
* @return Empty cost or an error.
|
* @return Empty cost or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdTownRating(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdTownRating(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
|
|
||||||
|
@ -2914,14 +2914,14 @@ CommandCost CmdTownRating(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expand a town (scenario editor only).
|
* Expand a town (scenario editor only).
|
||||||
* @param tile Unused.
|
|
||||||
* @param flags Type of operation.
|
* @param flags Type of operation.
|
||||||
|
* @param tile Unused.
|
||||||
* @param p1 Town ID to expand.
|
* @param p1 Town ID to expand.
|
||||||
* @param p2 Amount to grow, or 0 to grow a random size up to the current amount of houses.
|
* @param p2 Amount to grow, or 0 to grow a random size up to the current amount of houses.
|
||||||
* @param text Unused.
|
* @param text Unused.
|
||||||
* @return Empty cost or an error.
|
* @return Empty cost or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdExpandTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdExpandTown(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_game_mode != GM_EDITOR && _current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_game_mode != GM_EDITOR && _current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
Town *t = Town::GetIfValid(p1);
|
Town *t = Town::GetIfValid(p1);
|
||||||
|
@ -2954,14 +2954,14 @@ CommandCost CmdExpandTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a town (scenario editor or worldgen only).
|
* Delete a town (scenario editor or worldgen only).
|
||||||
* @param tile Unused.
|
|
||||||
* @param flags Type of operation.
|
* @param flags Type of operation.
|
||||||
|
* @param tile Unused.
|
||||||
* @param p1 Town ID to delete.
|
* @param p1 Town ID to delete.
|
||||||
* @param p2 Unused.
|
* @param p2 Unused.
|
||||||
* @param text Unused.
|
* @param text Unused.
|
||||||
* @return Empty cost or an error.
|
* @return Empty cost or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdDeleteTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdDeleteTown(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_game_mode != GM_EDITOR && !_generating_world) return CMD_ERROR;
|
if (_game_mode != GM_EDITOR && !_generating_world) return CMD_ERROR;
|
||||||
Town *t = Town::GetIfValid(p1);
|
Town *t = Town::GetIfValid(p1);
|
||||||
|
@ -3340,14 +3340,14 @@ uint GetMaskOfTownActions(int *nump, CompanyID cid, const Town *t)
|
||||||
* Do a town action.
|
* Do a town action.
|
||||||
* This performs an action such as advertising, building a statue, funding buildings,
|
* This performs an action such as advertising, building a statue, funding buildings,
|
||||||
* but also bribing the town-council
|
* but also bribing the town-council
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 town to do the action at
|
* @param p1 town to do the action at
|
||||||
* @param p2 action to perform, @see _town_action_proc for the list of available actions
|
* @param p2 action to perform, @see _town_action_proc for the list of available actions
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdDoTownAction(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdDoTownAction(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Town *t = Town::GetIfValid(p1);
|
Town *t = Town::GetIfValid(p1);
|
||||||
if (t == nullptr || p2 >= lengthof(_town_action_proc)) return CMD_ERROR;
|
if (t == nullptr || p2 >= lengthof(_town_action_proc)) return CMD_ERROR;
|
||||||
|
|
|
@ -584,13 +584,13 @@ void GetTrainSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a railroad wagon.
|
* Build a railroad wagon.
|
||||||
* @param tile tile of the depot where rail-vehicle is built.
|
|
||||||
* @param flags type of operation.
|
* @param flags type of operation.
|
||||||
|
* @param tile tile of the depot where rail-vehicle is built.
|
||||||
* @param e the engine to build.
|
* @param e the engine to build.
|
||||||
* @param[out] ret the vehicle that has been built.
|
* @param[out] ret the vehicle that has been built.
|
||||||
* @return the cost of this operation or an error.
|
* @return the cost of this operation or an error.
|
||||||
*/
|
*/
|
||||||
static CommandCost CmdBuildRailWagon(TileIndex tile, DoCommandFlag flags, const Engine *e, Vehicle **ret)
|
static CommandCost CmdBuildRailWagon(DoCommandFlag flags, TileIndex tile, const Engine *e, Vehicle **ret)
|
||||||
{
|
{
|
||||||
const RailVehicleInfo *rvi = &e->u.rail;
|
const RailVehicleInfo *rvi = &e->u.rail;
|
||||||
|
|
||||||
|
@ -714,18 +714,18 @@ static void AddRearEngineToMultiheadedTrain(Train *v)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a railroad vehicle.
|
* Build a railroad vehicle.
|
||||||
* @param tile tile of the depot where rail-vehicle is built.
|
|
||||||
* @param flags type of operation.
|
* @param flags type of operation.
|
||||||
|
* @param tile tile of the depot where rail-vehicle is built.
|
||||||
* @param e the engine to build.
|
* @param e the engine to build.
|
||||||
* @param data bit 0 prevents any free cars from being added to the train.
|
* @param data bit 0 prevents any free cars from being added to the train.
|
||||||
* @param[out] ret the vehicle that has been built.
|
* @param[out] ret the vehicle that has been built.
|
||||||
* @return the cost of this operation or an error.
|
* @return the cost of this operation or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **ret)
|
CommandCost CmdBuildRailVehicle(DoCommandFlag flags, TileIndex tile, const Engine *e, uint16 data, Vehicle **ret)
|
||||||
{
|
{
|
||||||
const RailVehicleInfo *rvi = &e->u.rail;
|
const RailVehicleInfo *rvi = &e->u.rail;
|
||||||
|
|
||||||
if (rvi->railveh_type == RAILVEH_WAGON) return CmdBuildRailWagon(tile, flags, e, ret);
|
if (rvi->railveh_type == RAILVEH_WAGON) return CmdBuildRailWagon(flags, tile, e, ret);
|
||||||
|
|
||||||
/* Check if depot and new engine uses the same kind of tracks *
|
/* Check if depot and new engine uses the same kind of tracks *
|
||||||
* We need to see if the engine got power on the tile to avoid electric engines in non-electric depots */
|
* We need to see if the engine got power on the tile to avoid electric engines in non-electric depots */
|
||||||
|
@ -1159,9 +1159,9 @@ static void NormaliseTrainHead(Train *head)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move a rail vehicle around inside the depot.
|
* Move a rail vehicle around inside the depot.
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
* Note: DC_AUTOREPLACE is set when autoreplace tries to undo its modifications or moves vehicles to temporary locations inside the depot.
|
* Note: DC_AUTOREPLACE is set when autoreplace tries to undo its modifications or moves vehicles to temporary locations inside the depot.
|
||||||
|
* @param tile unused
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 (bit 0 - 19) source vehicle index
|
* - p1 (bit 0 - 19) source vehicle index
|
||||||
* - p1 (bit 20) move all vehicles following the source vehicle
|
* - p1 (bit 20) move all vehicles following the source vehicle
|
||||||
|
@ -1169,7 +1169,7 @@ static void NormaliseTrainHead(Train *head)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdMoveRailVehicle(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleID s = GB(p1, 0, 20);
|
VehicleID s = GB(p1, 0, 20);
|
||||||
VehicleID d = GB(p2, 0, 20);
|
VehicleID d = GB(p2, 0, 20);
|
||||||
|
@ -1916,7 +1916,7 @@ void ReverseTrainDirection(Train *v)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdReverseTrainDirection(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdReverseTrainDirection(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Train *v = Train::GetIfValid(p1);
|
Train *v = Train::GetIfValid(p1);
|
||||||
if (v == nullptr) return CMD_ERROR;
|
if (v == nullptr) return CMD_ERROR;
|
||||||
|
@ -1982,14 +1982,14 @@ CommandCost CmdReverseTrainDirection(TileIndex tile, DoCommandFlag flags, uint32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force a train through a red signal
|
* Force a train through a red signal
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 train to ignore the red signal
|
* @param p1 train to ignore the red signal
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdForceTrainProceed(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdForceTrainProceed(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Train *t = Train::GetIfValid(p1);
|
Train *t = Train::GetIfValid(p1);
|
||||||
if (t == nullptr) return CMD_ERROR;
|
if (t == nullptr) return CMD_ERROR;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "engine_type.h"
|
#include "engine_type.h"
|
||||||
#include "vehicle_type.h"
|
#include "vehicle_type.h"
|
||||||
|
|
||||||
CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **v);
|
CommandCost CmdBuildRailVehicle(DoCommandFlag flags, TileIndex tile, const Engine *e, uint16 data, Vehicle **v);
|
||||||
CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *v, uint16 data, uint32 user);
|
CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *v, uint16 data, uint32 user);
|
||||||
|
|
||||||
CommandProc CmdMoveRailVehicle;
|
CommandProc CmdMoveRailVehicle;
|
||||||
|
|
|
@ -379,14 +379,14 @@ void GenerateTrees()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plant a tree.
|
* Plant a tree.
|
||||||
* @param tile end tile of area-drag
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile end tile of area-drag
|
||||||
* @param p1 tree type, TREE_INVALID means random.
|
* @param p1 tree type, TREE_INVALID means random.
|
||||||
* @param p2 start tile of area-drag of tree plantation
|
* @param p2 start tile of area-drag of tree plantation
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdPlantTree(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
StringID msg = INVALID_STRING_ID;
|
StringID msg = INVALID_STRING_ID;
|
||||||
CommandCost cost(EXPENSES_OTHER);
|
CommandCost cost(EXPENSES_OTHER);
|
||||||
|
|
|
@ -248,8 +248,8 @@ static Money TunnelBridgeClearCost(TileIndex tile, Price base_price)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a Bridge
|
* Build a Bridge
|
||||||
* @param end_tile end tile
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param end_tile end tile
|
||||||
* @param p1 packed start tile coords (~ dx)
|
* @param p1 packed start tile coords (~ dx)
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = (bit 0- 7) - bridge type (hi bh)
|
* - p2 = (bit 0- 7) - bridge type (hi bh)
|
||||||
|
@ -258,7 +258,7 @@ static Money TunnelBridgeClearCost(TileIndex tile, Price base_price)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildBridge(DoCommandFlag flags, TileIndex end_tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
CompanyID company = _current_company;
|
CompanyID company = _current_company;
|
||||||
|
|
||||||
|
@ -623,15 +623,15 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build Tunnel.
|
* Build Tunnel.
|
||||||
* @param start_tile start tile of tunnel
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param start_tile start tile of tunnel
|
||||||
* @param p1 bit 0-5 railtype or roadtype
|
* @param p1 bit 0-5 railtype or roadtype
|
||||||
* bit 8-9 transport type
|
* bit 8-9 transport type
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildTunnel(DoCommandFlag flags, TileIndex start_tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
CompanyID company = _current_company;
|
CompanyID company = _current_company;
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,8 @@ const StringID _send_to_depot_msg_table[] = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a vehicle.
|
* Build a vehicle.
|
||||||
* @param tile tile of depot where the vehicle is built
|
|
||||||
* @param flags for command
|
* @param flags for command
|
||||||
|
* @param tile tile of depot where the vehicle is built
|
||||||
* @param p1 various bitstuffed data
|
* @param p1 various bitstuffed data
|
||||||
* bits 0-15: vehicle type being built.
|
* bits 0-15: vehicle type being built.
|
||||||
* bits 16-23: vehicle type specific bits passed on to the vehicle build functions.
|
* bits 16-23: vehicle type specific bits passed on to the vehicle build functions.
|
||||||
|
@ -84,7 +84,7 @@ const StringID _send_to_depot_msg_table[] = {
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildVehicle(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
/* Elementary check for valid location. */
|
/* Elementary check for valid location. */
|
||||||
if (!IsDepotTile(tile) || !IsTileOwner(tile, _current_company)) return CMD_ERROR;
|
if (!IsDepotTile(tile) || !IsTileOwner(tile, _current_company)) return CMD_ERROR;
|
||||||
|
@ -137,10 +137,10 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||||
|
|
||||||
Vehicle *v = nullptr;
|
Vehicle *v = nullptr;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case VEH_TRAIN: value.AddCost(CmdBuildRailVehicle(tile, subflags, e, GB(p1, 16, 8), &v)); break;
|
case VEH_TRAIN: value.AddCost(CmdBuildRailVehicle(subflags, tile, e, GB(p1, 16, 8), &v)); break;
|
||||||
case VEH_ROAD: value.AddCost(CmdBuildRoadVehicle(tile, subflags, e, GB(p1, 16, 8), &v)); break;
|
case VEH_ROAD: value.AddCost(CmdBuildRoadVehicle(subflags, tile, e, GB(p1, 16, 8), &v)); break;
|
||||||
case VEH_SHIP: value.AddCost(CmdBuildShip (tile, subflags, e, GB(p1, 16, 8), &v)); break;
|
case VEH_SHIP: value.AddCost(CmdBuildShip (subflags, tile, e, GB(p1, 16, 8), &v)); break;
|
||||||
case VEH_AIRCRAFT: value.AddCost(CmdBuildAircraft (tile, subflags, e, GB(p1, 16, 8), &v)); break;
|
case VEH_AIRCRAFT: value.AddCost(CmdBuildAircraft (subflags, tile, e, GB(p1, 16, 8), &v)); break;
|
||||||
default: NOT_REACHED(); // Safe due to IsDepotTile()
|
default: NOT_REACHED(); // Safe due to IsDepotTile()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||||
|
|
||||||
if (refitting) {
|
if (refitting) {
|
||||||
/* Refit only one vehicle. If we purchased an engine, it may have gained free wagons. */
|
/* Refit only one vehicle. If we purchased an engine, it may have gained free wagons. */
|
||||||
value.AddCost(CmdRefitVehicle(tile, flags, v->index, cargo | (1 << 16), {}));
|
value.AddCost(CmdRefitVehicle(flags, tile, v->index, cargo | (1 << 16), {}));
|
||||||
} else {
|
} else {
|
||||||
/* Fill in non-refitted capacities */
|
/* Fill in non-refitted capacities */
|
||||||
_returned_refit_capacity = e->GetDisplayDefaultCapacity(&_returned_mail_refit_capacity);
|
_returned_refit_capacity = e->GetDisplayDefaultCapacity(&_returned_mail_refit_capacity);
|
||||||
|
@ -202,7 +202,7 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||||
* @param text unused.
|
* @param text unused.
|
||||||
* @return the cost of this operation or an error.
|
* @return the cost of this operation or an error.
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSellVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSellVehicle(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 20));
|
Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 20));
|
||||||
if (v == nullptr) return CMD_ERROR;
|
if (v == nullptr) return CMD_ERROR;
|
||||||
|
@ -451,8 +451,8 @@ static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8 num_vehicles,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refits a vehicle to the specified cargo type.
|
* Refits a vehicle to the specified cargo type.
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 vehicle ID to refit
|
* @param p1 vehicle ID to refit
|
||||||
* @param p2 various bitstuffed elements
|
* @param p2 various bitstuffed elements
|
||||||
* - p2 = (bit 0-7) - New cargo type to refit to.
|
* - p2 = (bit 0-7) - New cargo type to refit to.
|
||||||
|
@ -464,7 +464,7 @@ static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8 num_vehicles,
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRefitVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRefitVehicle(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||||
if (v == nullptr) return CMD_ERROR;
|
if (v == nullptr) return CMD_ERROR;
|
||||||
|
@ -545,14 +545,14 @@ CommandCost CmdRefitVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start/Stop a vehicle
|
* Start/Stop a vehicle
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 vehicle to start/stop, don't forget to change CcStartStopVehicle if you modify this!
|
* @param p1 vehicle to start/stop, don't forget to change CcStartStopVehicle if you modify this!
|
||||||
* @param p2 bit 0: Shall the start/stop newgrf callback be evaluated (only valid with DC_AUTOREPLACE for network safety)
|
* @param p2 bit 0: Shall the start/stop newgrf callback be evaluated (only valid with DC_AUTOREPLACE for network safety)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdStartStopVehicle(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
/* Disable the effect of p2 bit 0, when DC_AUTOREPLACE is not set */
|
/* Disable the effect of p2 bit 0, when DC_AUTOREPLACE is not set */
|
||||||
if ((flags & DC_AUTOREPLACE) == 0) SetBit(p2, 0);
|
if ((flags & DC_AUTOREPLACE) == 0) SetBit(p2, 0);
|
||||||
|
@ -627,8 +627,8 @@ CommandCost CmdStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts or stops a lot of vehicles
|
* Starts or stops a lot of vehicles
|
||||||
* @param tile Tile of the depot where the vehicles are started/stopped (only used for depots)
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile Tile of the depot where the vehicles are started/stopped (only used for depots)
|
||||||
* @param p1 bitmask
|
* @param p1 bitmask
|
||||||
* - bit 0 set = start vehicles, unset = stop vehicles
|
* - bit 0 set = start vehicles, unset = stop vehicles
|
||||||
* - bit 1 if set, then it's a vehicle list window, not a depot and Tile is ignored in this case
|
* - bit 1 if set, then it's a vehicle list window, not a depot and Tile is ignored in this case
|
||||||
|
@ -636,7 +636,7 @@ CommandCost CmdStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdMassStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdMassStartStopVehicle(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleList list;
|
VehicleList list;
|
||||||
bool do_start = HasBit(p1, 0);
|
bool do_start = HasBit(p1, 0);
|
||||||
|
@ -669,14 +669,14 @@ CommandCost CmdMassStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sells all vehicles in a depot
|
* Sells all vehicles in a depot
|
||||||
* @param tile Tile of the depot where the depot is
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile Tile of the depot where the depot is
|
||||||
* @param p1 Vehicle type
|
* @param p1 Vehicle type
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdDepotSellAllVehicles(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdDepotSellAllVehicles(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleList list;
|
VehicleList list;
|
||||||
|
|
||||||
|
@ -705,14 +705,14 @@ CommandCost CmdDepotSellAllVehicles(TileIndex tile, DoCommandFlag flags, uint32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autoreplace all vehicles in the depot
|
* Autoreplace all vehicles in the depot
|
||||||
* @param tile Tile of the depot where the vehicles are
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile Tile of the depot where the vehicles are
|
||||||
* @param p1 Type of vehicle
|
* @param p1 Type of vehicle
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdDepotMassAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdDepotMassAutoReplace(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
VehicleList list;
|
VehicleList list;
|
||||||
CommandCost cost = CommandCost(EXPENSES_NEW_VEHICLES);
|
CommandCost cost = CommandCost(EXPENSES_NEW_VEHICLES);
|
||||||
|
@ -809,14 +809,14 @@ static void CloneVehicleName(const Vehicle *src, Vehicle *dst)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone a vehicle. If it is a train, it will clone all the cars too
|
* Clone a vehicle. If it is a train, it will clone all the cars too
|
||||||
* @param tile tile of the depot where the cloned vehicle is build
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile tile of the depot where the cloned vehicle is build
|
||||||
* @param p1 the original vehicle's index
|
* @param p1 the original vehicle's index
|
||||||
* @param p2 1 = shared orders, else copied orders
|
* @param p2 1 = shared orders, else copied orders
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdCloneVehicle(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
CommandCost total_cost(EXPENSES_NEW_VEHICLES);
|
CommandCost total_cost(EXPENSES_NEW_VEHICLES);
|
||||||
|
|
||||||
|
@ -1029,8 +1029,8 @@ static CommandCost SendAllVehiclesToDepot(DoCommandFlag flags, bool service, con
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a vehicle to the depot.
|
* Send a vehicle to the depot.
|
||||||
* @param tile unused
|
|
||||||
* @param flags for command type
|
* @param flags for command type
|
||||||
|
* @param tile unused
|
||||||
* @param p1 bitmask
|
* @param p1 bitmask
|
||||||
* - p1 0-20: bitvehicle ID to send to the depot
|
* - p1 0-20: bitvehicle ID to send to the depot
|
||||||
* - p1 bits 25-8 - DEPOT_ flags (see vehicle_type.h)
|
* - p1 bits 25-8 - DEPOT_ flags (see vehicle_type.h)
|
||||||
|
@ -1038,7 +1038,7 @@ static CommandCost SendAllVehiclesToDepot(DoCommandFlag flags, bool service, con
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdSendVehicleToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdSendVehicleToDepot(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (p1 & DEPOT_MASS_SEND) {
|
if (p1 & DEPOT_MASS_SEND) {
|
||||||
/* Mass goto depot requested */
|
/* Mass goto depot requested */
|
||||||
|
@ -1056,14 +1056,14 @@ CommandCost CmdSendVehicleToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Give a custom name to your vehicle
|
* Give a custom name to your vehicle
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 vehicle ID to name
|
* @param p1 vehicle ID to name
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text the new name or an empty string when resetting to the default
|
* @param text the new name or an empty string when resetting to the default
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdRenameVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdRenameVehicle(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||||
if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||||
|
@ -1094,8 +1094,8 @@ CommandCost CmdRenameVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the service interval of a vehicle
|
* Change the service interval of a vehicle
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 vehicle ID that is being service-interval-changed
|
* @param p1 vehicle ID that is being service-interval-changed
|
||||||
* @param p2 bitmask
|
* @param p2 bitmask
|
||||||
* - p2 = (bit 0-15) - new service interval
|
* - p2 = (bit 0-15) - new service interval
|
||||||
|
@ -1104,7 +1104,7 @@ CommandCost CmdRenameVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdChangeServiceInt(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdChangeServiceInt(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||||
if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||||
|
|
|
@ -3466,14 +3466,14 @@ void InitializeSpriteSorter()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scroll players main viewport.
|
* Scroll players main viewport.
|
||||||
* @param tile tile to center viewport on
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile tile to center viewport on
|
||||||
* @param p1 ViewportScrollTarget of scroll target
|
* @param p1 ViewportScrollTarget of scroll target
|
||||||
* @param p2 company or client id depending on the target
|
* @param p2 company or client id depending on the target
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdScrollViewport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdScrollViewport(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||||
ViewportScrollTarget target = (ViewportScrollTarget)p1;
|
ViewportScrollTarget target = (ViewportScrollTarget)p1;
|
||||||
|
|
|
@ -92,14 +92,14 @@ static void MarkCanalsAndRiversAroundDirty(TileIndex tile)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a ship depot.
|
* Build a ship depot.
|
||||||
* @param tile tile where ship depot is built
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile tile where ship depot is built
|
||||||
* @param p1 bit 0 depot orientation (Axis)
|
* @param p1 bit 0 depot orientation (Axis)
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildShipDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildShipDepot(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Axis axis = Extract<Axis, 0, 1>(p1);
|
Axis axis = Extract<Axis, 0, 1>(p1);
|
||||||
|
|
||||||
|
@ -411,14 +411,14 @@ static CommandCost RemoveLock(TileIndex tile, DoCommandFlag flags)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a lock.
|
* Builds a lock.
|
||||||
* @param tile tile where to place the lock
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile tile where to place the lock
|
||||||
* @param p1 unused
|
* @param p1 unused
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildLock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildLock(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
|
DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
|
||||||
if (dir == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
|
if (dir == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
|
||||||
|
@ -435,8 +435,8 @@ bool RiverModifyDesertZone(TileIndex tile, void *)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a piece of canal.
|
* Build a piece of canal.
|
||||||
* @param tile end tile of stretch-dragging
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile end tile of stretch-dragging
|
||||||
* @param p1 start tile of stretch-dragging
|
* @param p1 start tile of stretch-dragging
|
||||||
* @param p2 various bitstuffed data
|
* @param p2 various bitstuffed data
|
||||||
* bits 0-1: waterclass to build. sea and river can only be built in scenario editor
|
* bits 0-1: waterclass to build. sea and river can only be built in scenario editor
|
||||||
|
@ -444,7 +444,7 @@ bool RiverModifyDesertZone(TileIndex tile, void *)
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @return the cost of this operation or an error
|
||||||
*/
|
*/
|
||||||
CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
CommandCost CmdBuildCanal(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
WaterClass wc = Extract<WaterClass, 0, 2>(p2);
|
WaterClass wc = Extract<WaterClass, 0, 2>(p2);
|
||||||
if (p1 >= MapSize() || wc == WATER_CLASS_INVALID) return CMD_ERROR;
|
if (p1 >= MapSize() || wc == WATER_CLASS_INVALID) return CMD_ERROR;
|
||||||
|
|
|
@ -161,8 +161,8 @@ extern CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta,
|
||||||
/**
|
/**
|
||||||
* Convert existing rail to waypoint. Eg build a waypoint station over
|
* Convert existing rail to waypoint. Eg build a waypoint station over
|
||||||
* piece of rail
|
* piece of rail
|
||||||
* @param start_tile northern most tile where waypoint will be built
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param start_tile northern most tile where waypoint will be built
|
||||||
* @param p1 various bitstuffed elements
|
* @param p1 various bitstuffed elements
|
||||||
* - p1 = (bit 0- 5) - railtype (not used)
|
* - p1 = (bit 0- 5) - railtype (not used)
|
||||||
* - p1 = (bit 6) - orientation (Axis)
|
* - p1 = (bit 6) - orientation (Axis)
|
||||||
|
@ -175,7 +175,7 @@ extern CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta,
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @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, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
/* Unpack parameters */
|
/* Unpack parameters */
|
||||||
Axis axis = Extract<Axis, 6, 1>(p1);
|
Axis axis = Extract<Axis, 6, 1>(p1);
|
||||||
|
@ -296,14 +296,14 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a buoy.
|
* Build a buoy.
|
||||||
* @param tile tile where to place the buoy
|
|
||||||
* @param flags operation to perform
|
* @param flags operation to perform
|
||||||
|
* @param tile tile where to place the buoy
|
||||||
* @param p1 unused
|
* @param p1 unused
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text unused
|
* @param text unused
|
||||||
* @return the cost of this operation or an error
|
* @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, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
if (tile == 0 || !HasTileWaterGround(tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
|
if (tile == 0 || !HasTileWaterGround(tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
|
||||||
if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
||||||
|
@ -407,14 +407,14 @@ static bool IsUniqueWaypointName(const std::string &name)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename a waypoint.
|
* Rename a waypoint.
|
||||||
* @param tile unused
|
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
|
* @param tile unused
|
||||||
* @param p1 id of waypoint
|
* @param p1 id of waypoint
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
* @param text the new name or an empty string when resetting to the default
|
* @param text the new name or an empty string when resetting to the default
|
||||||
* @return the cost of this operation or an error
|
* @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, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||||
{
|
{
|
||||||
Waypoint *wp = Waypoint::GetIfValid(p1);
|
Waypoint *wp = Waypoint::GetIfValid(p1);
|
||||||
if (wp == nullptr) return CMD_ERROR;
|
if (wp == nullptr) return CMD_ERROR;
|
||||||
|
|
Loading…
Reference in New Issue