Changeset - r26095:00c14d52e378
[Not reviewed]
src/aircraft_cmd.cpp
Show inline comments
 
@@ -259,14 +259,14 @@ void GetAircraftSpriteSize(EngineID engi
 

	
 
/**
 
 * Build an aircraft.
 
 * @param flags    type of operation.
 
 * @param tile     tile of the depot where aircraft is built.
 
 * @param flags    type of operation.
 
 * @param e        the engine to build.
 
 * @param data     unused.
 
 * @param[out] ret the vehicle that has been built.
 
 * @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 Station *st = Station::GetByTile(tile);
src/aircraft_cmd.h
Show inline comments
 
@@ -14,6 +14,6 @@
 
#include "engine_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 */
src/autoreplace_cmd.cpp
Show inline comments
 
@@ -708,14 +708,14 @@ static CommandCost ReplaceChain(Vehicle 
 
/**
 
 * Autoreplaces a vehicle
 
 * Trains are replaced as a whole chain, free wagons in depot are replaced on their own
 
 * @param flags type of operation
 
 * @param tile not used
 
 * @param flags type of operation
 
 * @param p1 Index of vehicle
 
 * @param p2 not used
 
 * @param text unused
 
 * @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);
 
	if (v == nullptr) return CMD_ERROR;
 
@@ -797,8 +797,8 @@ CommandCost CmdAutoreplaceVehicle(TileIn
 

	
 
/**
 
 * Change engine renewal parameters
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 packed data
 
 *   - bit      0 = replace when engine gets old?
 
 *   - bits 16-31 = engine group
 
@@ -808,7 +808,7 @@ CommandCost CmdAutoreplaceVehicle(TileIn
 
 * @param text unused
 
 * @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);
 
	if (c == nullptr) return CMD_ERROR;
src/command.cpp
Show inline comments
 
@@ -204,7 +204,7 @@ CommandCost DoCommand(DoCommandFlag flag
 
	if (_docommand_recursive == 1 || !(flags & DC_EXEC) ) {
 
		if (_docommand_recursive == 1) _cleared_object_areas.clear();
 
		SetTownRatingTestMode(true);
 
		res = proc(tile, flags & ~DC_EXEC, p1, p2, text);
 
		res = proc(flags & ~DC_EXEC, tile, p1, p2, text);
 
		SetTownRatingTestMode(false);
 
		if (res.Failed()) {
 
			goto error;
 
@@ -226,7 +226,7 @@ CommandCost DoCommand(DoCommandFlag flag
 
	/* Execute the command here. All cost-relevant functions set the expenses type
 
	 * themselves to the cost object at some point */
 
	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()) {
 
error:
 
		_docommand_recursive--;
 
@@ -465,7 +465,7 @@ CommandCost DoCommandPInternal(Commands 
 
	_cleared_object_areas.clear();
 
	SetTownRatingTestMode(true);
 
	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);
 
	SetTownRatingTestMode(false);
 

	
 
@@ -508,7 +508,7 @@ CommandCost DoCommandPInternal(Commands 
 
	 * use the construction one */
 
	_cleared_object_areas.clear();
 
	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);
 

	
 
	if (cmd == CMD_COMPANY_CTRL) {
src/command_type.h
Show inline comments
 
@@ -421,7 +421,7 @@ enum CommandPauseLevel {
 
 * @param text Additional text
 
 * @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. */
src/company_cmd.cpp
Show inline comments
 
@@ -795,8 +795,8 @@ void CompanyAdminRemove(CompanyID compan
 

	
 
/**
 
 * Control the companies: add, delete, etc.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 various functionality
 
 * - bits 0..15: CompanyCtrlAction
 
 * - bits 16..23: CompanyID
 
@@ -805,7 +805,7 @@ void CompanyAdminRemove(CompanyID compan
 
 * @param text unused
 
 * @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);
 
	CompanyID company_id = (CompanyID)GB(p1, 16, 8);
 
@@ -922,14 +922,14 @@ CommandCost CmdCompanyCtrl(TileIndex til
 

	
 
/**
 
 * Change the company manager's face.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 unused
 
 * @param p2 face bitmasked
 
 * @param text unused
 
 * @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;
 

	
 
@@ -944,8 +944,8 @@ CommandCost CmdSetCompanyManagerFace(Til
 

	
 
/**
 
 * Change the company's company-colour
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 bitstuffed:
 
 * p1 bits 0-7 scheme to set
 
 * p1 bit 8 set first/second colour
 
@@ -953,7 +953,7 @@ CommandCost CmdSetCompanyManagerFace(Til
 
 * @param text unused
 
 * @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);
 
	LiveryScheme scheme = Extract<LiveryScheme, 0, 8>(p1);
 
@@ -1057,14 +1057,14 @@ static bool IsUniqueCompanyName(const st
 

	
 
/**
 
 * Change the name of the company.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 unused
 
 * @param p2 unused
 
 * @param text the new name or an empty string when resetting to the default
 
 * @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();
 

	
 
@@ -1103,14 +1103,14 @@ static bool IsUniquePresidentName(const 
 

	
 
/**
 
 * Change the name of the president.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 unused
 
 * @param p2 unused
 
 * @param text the new name or an empty string when resetting to the default
 
 * @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();
 

	
 
@@ -1188,14 +1188,14 @@ uint32 CompanyInfrastructure::GetTramTot
 
 * 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
 
 * given the fact that you have more money than loan).
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 the amount of money to transfer; max 20.000.000
 
 * @param p2 the company to transfer the money to
 
 * @param text unused
 
 * @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;
 

	
src/depot_cmd.cpp
Show inline comments
 
@@ -38,14 +38,14 @@ static bool IsUniqueDepotName(const std:
 

	
 
/**
 
 * Rename a depot.
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 id of depot
 
 * @param p2 unused
 
 * @param text the new name or an empty string when resetting to the default
 
 * @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);
 
	if (d == nullptr) return CMD_ERROR;
src/economy.cpp
Show inline comments
 
@@ -2010,14 +2010,14 @@ extern int GetAmountOwnedBy(const Compan
 

	
 
/**
 
 * Acquire shares in an opposing company.
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 company to buy the shares from
 
 * @param p2 unused
 
 * @param text unused
 
 * @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);
 
	CompanyID target_company = (CompanyID)p1;
 
@@ -2062,14 +2062,14 @@ CommandCost CmdBuyShareInCompany(TileInd
 

	
 
/**
 
 * Sell shares in an opposing company.
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 company to sell the shares from
 
 * @param p2 unused
 
 * @param text unused
 
 * @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;
 
	Company *c = Company::GetIfValid(target_company);
 
@@ -2103,14 +2103,14 @@ CommandCost CmdSellShareInCompany(TileIn
 
 * When a competing company is gone bankrupt you get the chance to purchase
 
 * that company.
 
 * @todo currently this only works for AI companies
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 company to buy up
 
 * @param p2 unused
 
 * @param text unused
 
 * @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;
 
	Company *c = Company::GetIfValid(target_company);
src/engine.cpp
Show inline comments
 
@@ -875,14 +875,14 @@ void ClearEnginesHiddenFlagOfCompany(Com
 

	
 
/**
 
 * Set the visibility of an engine.
 
 * @param flags Operation to perform.
 
 * @param tile Unused.
 
 * @param flags Operation to perform.
 
 * @param p1 Unused.
 
 * @param p2 Bit 31: 0=visible, 1=hidden, other bits for the #EngineID.
 
 * @param text Unused.
 
 * @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));
 
	if (e == nullptr || _current_company >= MAX_COMPANIES) return CMD_ERROR;
 
@@ -899,14 +899,14 @@ CommandCost CmdSetVehicleVisibility(Tile
 
/**
 
 * 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
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 engine-prototype offered
 
 * @param p2 unused
 
 * @param text unused
 
 * @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);
 
	if (e == nullptr || !(e->flags & ENGINE_EXCLUSIVE_PREVIEW) || e->preview_company != _current_company) return CMD_ERROR;
 
@@ -918,8 +918,8 @@ CommandCost CmdWantEnginePreview(TileInd
 

	
 
/**
 
 * Allow or forbid a specific company to use an engine
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 engine id
 
 * @param p2 various bitstuffed elements
 
 * - p2 = (bit  0 - 7) - Company to allow/forbid the use of an engine.
 
@@ -927,7 +927,7 @@ CommandCost CmdWantEnginePreview(TileInd
 
 * @param text unused
 
 * @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;
 
	EngineID engine_id = (EngineID)p1;
 
@@ -1072,14 +1072,14 @@ static bool IsUniqueEngineName(const std
 

	
 
/**
 
 * Rename an engine.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 engine ID to rename
 
 * @param p2 unused
 
 * @param text the new name or an empty string when resetting to the default
 
 * @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);
 
	if (e == nullptr) return CMD_ERROR;
src/goal.cpp
Show inline comments
 
@@ -35,8 +35,8 @@ INSTANTIATE_POOL_METHODS(Goal)
 

	
 
/**
 
 * Create a new goal.
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0 -  7) - GoalType of destination.
 
 * - p1 = (bit  8 - 15) - Company for which this goal is.
 
@@ -44,7 +44,7 @@ INSTANTIATE_POOL_METHODS(Goal)
 
 * @param text Text of the goal.
 
 * @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;
 

	
 
@@ -110,14 +110,14 @@ CommandCost CmdCreateGoal(TileIndex tile
 

	
 
/**
 
 * Remove a goal.
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 GoalID to remove.
 
 * @param p2 unused.
 
 * @param text unused.
 
 * @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 (!Goal::IsValidID(p1)) return CMD_ERROR;
 
@@ -140,14 +140,14 @@ CommandCost CmdRemoveGoal(TileIndex tile
 

	
 
/**
 
 * Update goal text of a goal.
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 GoalID to update.
 
 * @param p2 unused
 
 * @param text Text of the goal.
 
 * @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 (!Goal::IsValidID(p1)) return CMD_ERROR;
 
@@ -170,14 +170,14 @@ CommandCost CmdSetGoalText(TileIndex til
 

	
 
/**
 
 * Update progress text of a goal.
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 GoalID to update.
 
 * @param p2 unused
 
 * @param text Progress text of the goal.
 
 * @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 (!Goal::IsValidID(p1)) return CMD_ERROR;
 
@@ -203,14 +203,14 @@ CommandCost CmdSetGoalProgress(TileIndex
 

	
 
/**
 
 * Update completed state of a goal.
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 GoalID to update.
 
 * @param p2 completed state. If goal is completed, set to 1, otherwise 0.
 
 * @param text unused
 
 * @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 (!Goal::IsValidID(p1)) return CMD_ERROR;
 
@@ -231,8 +231,8 @@ CommandCost CmdSetGoalCompleted(TileInde
 

	
 
/**
 
 * Ask a goal related question
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0 - 15) - Unique ID to use for this question.
 
 * - p1 = (bit 16 - 31) - Company or client for which this question is.
 
@@ -243,7 +243,7 @@ CommandCost CmdSetGoalCompleted(TileInde
 
 * @param text Text of the question.
 
 * @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);
 
	CompanyID company = (CompanyID)GB(p1, 16, 8);
 
@@ -283,14 +283,14 @@ CommandCost CmdGoalQuestion(TileIndex ti
 

	
 
/**
 
 * Reply to a goal question.
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 Unique ID to use for this question.
 
 * @param p2 Button the company pressed
 
 * @param text Text of the question.
 
 * @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 (p2 >= GOAL_QUESTION_BUTTON_COUNT) return CMD_ERROR;
src/group_cmd.cpp
Show inline comments
 
@@ -294,14 +294,14 @@ Group::Group(Owner owner)
 

	
 
/**
 
 * Create a new vehicle group.
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1   vehicle type
 
 * @param p2   parent groupid
 
 * @param text unused
 
 * @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);
 
	if (!IsCompanyBuildableVehicleType(vt)) return CMD_ERROR;
 
@@ -343,15 +343,15 @@ CommandCost CmdCreateGroup(TileIndex til
 

	
 
/**
 
 * Add all vehicles in the given group to the default group and then deletes the group.
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1   index of array group
 
 *      - p1 bit 0-15 : GroupID
 
 * @param p2   unused
 
 * @param text unused
 
 * @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);
 
	if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
 
@@ -395,8 +395,8 @@ CommandCost CmdDeleteGroup(TileIndex til
 

	
 
/**
 
 * Alter a group
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1   index of array group
 
 *   - p1 bit 0-15 : GroupID
 
 *   - p1 bit 16: 0 - Rename grouop
 
@@ -405,7 +405,7 @@ CommandCost CmdDeleteGroup(TileIndex til
 
 * @param text the new name or an empty string when resetting to the default
 
 * @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));
 
	if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
 
@@ -499,8 +499,8 @@ static void AddVehicleToGroup(Vehicle *v
 

	
 
/**
 
 * Add a vehicle to a group
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1   index of array group
 
 *   - p1 bit 0-15 : GroupID
 
 * @param p2   vehicle to add to a group
 
@@ -509,7 +509,7 @@ static void AddVehicleToGroup(Vehicle *v
 
 * @param text unused
 
 * @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));
 
	GroupID new_g = p1;
 
@@ -525,7 +525,7 @@ CommandCost CmdAddVehicleGroup(TileIndex
 

	
 
	if (new_g == 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;
 

	
 
		new_g = _new_group_id;
 
@@ -558,15 +558,15 @@ CommandCost CmdAddVehicleGroup(TileIndex
 

	
 
/**
 
 * Add all shared vehicles of all vehicles from a group
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1   index of group array
 
 *  - p1 bit 0-15 : GroupID
 
 * @param p2   type of vehicles
 
 * @param text unused
 
 * @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);
 
	GroupID id_g = p1;
 
@@ -595,15 +595,15 @@ CommandCost CmdAddSharedVehicleGroup(Til
 

	
 
/**
 
 * Remove all vehicles from a group
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1   index of group array
 
 * - p1 bit 0-15 : GroupID
 
 * @param p2   unused
 
 * @param text unused
 
 * @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;
 
	Group *g = Group::GetIfValid(old_g);
 
@@ -629,15 +629,15 @@ CommandCost CmdRemoveAllVehiclesGroup(Ti
 

	
 
/**
 
 * Set the livery for a vehicle group.
 
 * @param flags     Command flags.
 
 * @param tile      Unused.
 
 * @param flags     Command flags.
 
 * @param p1
 
 * - p1 bit  0-15   Group ID.
 
 * @param p2
 
 * - p2 bit  8      Set secondary instead of primary 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);
 
	bool primary = !HasBit(p2, 8);
 
@@ -687,8 +687,8 @@ static void SetGroupFlag(Group *g, Group
 

	
 
/**
 
 * (Un)set group flag from a group
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1   index of group array
 
 * - p1 bit 0-15  : GroupID
 
 * - p1 bit 16-18 : Flag to set, by value not bit.
 
@@ -698,7 +698,7 @@ static void SetGroupFlag(Group *g, Group
 
 * @param text unused
 
 * @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));
 
	if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
src/industry_cmd.cpp
Show inline comments
 
@@ -1973,8 +1973,8 @@ static CommandCost CreateNewIndustryHelp
 

	
 
/**
 
 * Build/Fund an industry
 
 * @param flags of operations to conduct
 
 * @param tile tile where industry is built
 
 * @param flags of operations to conduct
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0 -  7) - industry type see build_industry.h and see industry.h
 
 * - p1 = (bit  8 - 15) - first layout to try
 
@@ -1983,7 +1983,7 @@ static CommandCost CreateNewIndustryHelp
 
 * @param text unused
 
 * @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);
 
	if (it >= NUM_INDUSTRYTYPES) return CMD_ERROR;
 
@@ -2062,8 +2062,8 @@ CommandCost CmdBuildIndustry(TileIndex t
 

	
 
/**
 
 * Change industry properties
 
 * @param flags Type of operation.
 
 * @param tile Unused.
 
 * @param flags Type of operation.
 
 * @param p1 IndustryID
 
 * @param p2 various bitstuffed elements
 
 * - p2 = (bit 0 - 7) - IndustryAction to perform
 
@@ -2075,7 +2075,7 @@ CommandCost CmdBuildIndustry(TileIndex t
 
 * @param text - Additional industry text (only used with set text action)
 
 * @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;
 

	
src/landscape.cpp
Show inline comments
 
@@ -684,14 +684,14 @@ void ClearSnowLine()
 

	
 
/**
 
 * Clear a piece of landscape
 
 * @param flags of operation to conduct
 
 * @param tile tile to clear
 
 * @param flags of operation to conduct
 
 * @param p1 unused
 
 * @param p2 unused
 
 * @param text unused
 
 * @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);
 
	bool do_clear = false;
 
@@ -733,15 +733,15 @@ CommandCost CmdLandscapeClear(TileIndex 
 

	
 
/**
 
 * Clear a big piece of landscape
 
 * @param flags of operation to conduct
 
 * @param tile end tile of area dragging
 
 * @param flags of operation to conduct
 
 * @param p1 start tile of area dragging
 
 * @param p2 various bitstuffed data.
 
 *  bit      0: Whether to use the Orthogonal (0) or Diagonal (1) iterator.
 
 * @param text unused
 
 * @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;
 

	
src/misc_cmd.cpp
Show inline comments
 
@@ -33,8 +33,8 @@ static_assert((LOAN_INTERVAL & 3) == 0);
 

	
 
/**
 
 * Increase the loan of your company.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @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)
 
 *           (bit 0-1)  - when 0: loans LOAN_INTERVAL
 
@@ -43,7 +43,7 @@ static_assert((LOAN_INTERVAL & 3) == 0);
 
 * @param text unused
 
 * @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);
 

	
 
@@ -81,8 +81,8 @@ CommandCost CmdIncreaseLoan(TileIndex ti
 

	
 
/**
 
 * Decrease the loan of your company.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @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)
 
 *           (bit 0-1)  - when 0: pays back LOAN_INTERVAL
 
@@ -91,7 +91,7 @@ CommandCost CmdIncreaseLoan(TileIndex ti
 
 * @param text unused
 
 * @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);
 

	
 
@@ -144,14 +144,14 @@ static void AskUnsafeUnpauseCallback(Win
 
 * 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
 
 * more control over the game when saving/loading, etc.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 the pause mode to change
 
 * @param p2 1 pauses, 0 unpauses this mode
 
 * @param text unused
 
 * @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) {
 
		case PM_PAUSED_SAVELOAD:
 
@@ -196,29 +196,29 @@ CommandCost CmdPause(TileIndex tile, DoC
 

	
 
/**
 
 * Change the financial flow of your company.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 the amount of money to receive (if positive), or spend (if negative)
 
 * @param p2 unused
 
 * @param text unused
 
 * @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);
 
}
 

	
 
/**
 
 * Change the bank bank balance of a company by inserting or removing money without affecting the loan.
 
 * @param flags operation to perform
 
 * @param tile tile to show text effect on (if not 0)
 
 * @param flags operation to perform
 
 * @param p1 the amount of money to receive (if positive), or spend (if negative)
 
 * @param p2 (bit 0-7)  - the company ID.
 
 *           (bit 8-15) - the expenses type which should register the cost/income @see ExpensesType.
 
 * @param text unused
 
 * @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;
 
	CompanyID company = (CompanyID) GB(p2, 0, 8);
src/news_gui.cpp
Show inline comments
 
@@ -836,8 +836,8 @@ void AddNewsItem(StringID string, NewsTy
 

	
 
/**
 
 * Create a new custom news item.
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0 -  7) - NewsType of the message.
 
 * - p1 = (bit  8 - 15) - NewsReferenceType of first reference.
 
@@ -846,7 +846,7 @@ void AddNewsItem(StringID string, NewsTy
 
 * @param text The text of the news message.
 
 * @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;
 

	
src/object_cmd.cpp
Show inline comments
 
@@ -196,14 +196,14 @@ static CommandCost ClearTile_Object(Tile
 

	
 
/**
 
 * Build an object object
 
 * @param flags type of operation
 
 * @param tile tile where the object will be located
 
 * @param flags type of operation
 
 * @param p1 the object type to build
 
 * @param p2 the view for the object
 
 * @param text unused
 
 * @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);
 

	
 
@@ -776,7 +776,7 @@ void GenerateObjects()
 

	
 
				default:
 
					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;
 
			}
 
		}
src/order_backup.cpp
Show inline comments
 
@@ -141,14 +141,14 @@ void OrderBackup::DoRestore(Vehicle *v)
 

	
 
/**
 
 * Clear an OrderBackup
 
 * @param flags For command.
 
 * @param tile  Tile related to the to-be-cleared OrderBackup.
 
 * @param flags For command.
 
 * @param p1    Unused.
 
 * @param p2    User that had the OrderBackup.
 
 * @param text  Unused.
 
 * @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. */
 
	if (flags & DC_EXEC) OrderBackup::ResetOfUser(tile == 0 ? INVALID_TILE : tile, p2);
src/order_cmd.cpp
Show inline comments
 
@@ -727,8 +727,8 @@ uint GetOrderDistance(const Order *prev,
 

	
 
/**
 
 * Add an order to the orderlist of a vehicle.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0 - 19) - ID of the vehicle
 
 * - p1 = (bit 24 - 31) - the selected order (if any). If the last order is given,
 
@@ -738,7 +738,7 @@ uint GetOrderDistance(const Order *prev,
 
 * @param text unused
 
 * @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);
 
	VehicleOrderID sel_ord = GB(p1, 20, 8);
 
@@ -1006,14 +1006,14 @@ static CommandCost DecloneOrder(Vehicle 
 

	
 
/**
 
 * Delete an order from the orderlist of a vehicle.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 the ID of the vehicle
 
 * @param p2 the order to delete (max 255)
 
 * @param text unused
 
 * @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);
 
	VehicleOrderID sel_ord = GB(p2, 0, 8);
 
@@ -1111,14 +1111,14 @@ void DeleteOrder(Vehicle *v, VehicleOrde
 

	
 
/**
 
 * Goto order of order-list.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 The ID of the vehicle which order is skipped
 
 * @param p2 the selected order to which we want to skip
 
 * @param text unused
 
 * @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);
 
	VehicleOrderID sel_ord = GB(p2, 0, 8);
 
@@ -1148,8 +1148,8 @@ CommandCost CmdSkipToOrder(TileIndex til
 

	
 
/**
 
 * Move an order inside the orderlist
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 the ID of the vehicle
 
 * @param p2 order to move and target
 
 *           bit 0-15  : the order to move
 
@@ -1159,7 +1159,7 @@ CommandCost CmdSkipToOrder(TileIndex til
 
 * @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
 
 */
 
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);
 
	VehicleOrderID moving_order = GB(p2,  0, 16);
 
@@ -1249,8 +1249,8 @@ CommandCost CmdMoveOrder(TileIndex tile,
 

	
 
/**
 
 * Modify an order in the orderlist of a vehicle.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0 - 19) - ID of the vehicle
 
 * - p1 = (bit 24 - 31) - the selected order (if any). If the last order is given,
 
@@ -1262,7 +1262,7 @@ CommandCost CmdMoveOrder(TileIndex tile,
 
 * @param text unused
 
 * @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);
 
	VehicleID veh          = GB(p1,  0, 20);
 
@@ -1522,8 +1522,8 @@ static bool CheckAircraftOrderDistance(c
 

	
 
/**
 
 * Clone/share/copy an order-list of another vehicle.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0-19) - destination vehicle to clone orders to
 
 * - p1 = (bit 30-31) - action to perform
 
@@ -1531,7 +1531,7 @@ static bool CheckAircraftOrderDistance(c
 
 * @param text unused
 
 * @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_dst = GB(p1, 0, 20);
 
@@ -1669,8 +1669,8 @@ CommandCost CmdCloneOrder(TileIndex tile
 

	
 
/**
 
 * Add/remove refit orders from an order
 
 * @param flags operation to perform
 
 * @param tile Not used
 
 * @param flags operation to perform
 
 * @param p1 VehicleIndex of the vehicle having the order
 
 * @param p2 bitmask
 
 *   - bit 0-7 CargoID
 
@@ -1678,7 +1678,7 @@ CommandCost CmdCloneOrder(TileIndex tile
 
 * @param text unused
 
 * @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);
 
	VehicleOrderID order_number  = GB(p2, 16, 8);
src/rail_cmd.cpp
Show inline comments
 
@@ -426,8 +426,8 @@ static inline bool ValParamTrackOrientat
 

	
 
/**
 
 * Build a single piece of rail
 
 * @param flags operation to perform
 
 * @param tile tile  to build on
 
 * @param flags operation to perform
 
 * @param p1 railtype of being built piece (normal, mono, maglev)
 
 * @param p2 various bitstuffed elements
 
 *           - (bit  0- 2) - track-orientation, valid values: 0-5 (@see Track)
 
@@ -435,7 +435,7 @@ static inline bool ValParamTrackOrientat
 
 * @param text unused
 
 * @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);
 
	Track track = Extract<Track, 0, 3>(p2);
 
@@ -616,14 +616,14 @@ CommandCost CmdBuildSingleRail(TileIndex
 

	
 
/**
 
 * Remove a single piece of track
 
 * @param flags operation to perform
 
 * @param tile tile to remove track from
 
 * @param flags operation to perform
 
 * @param p1 unused
 
 * @param p2 rail orientation
 
 * @param text unused
 
 * @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);
 
	CommandCost cost(EXPENSES_CONSTRUCTION);
 
@@ -873,8 +873,8 @@ static CommandCost ValidateAutoDrag(Trac
 

	
 
/**
 
 * Build or remove a stretch of railroad tracks.
 
 * @param flags operation to perform
 
 * @param tile start tile of drag
 
 * @param flags operation to perform
 
 * @param p1 end tile of drag
 
 * @param p2 various bitstuffed elements
 
 * - 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(Trac
 
 * @param text unused
 
 * @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);
 
	Track track = Extract<Track, 6, 3>(p2);
 
@@ -935,8 +935,8 @@ static CommandCost CmdRailTrackHelper(Ti
 
/**
 
 * Build rail on a stretch of track.
 
 * Stub for the unified rail builder/remover
 
 * @param flags operation to perform
 
 * @param tile start tile of drag
 
 * @param flags operation to perform
 
 * @param p1 end tile of drag
 
 * @param p2 various bitstuffed elements
 
 * - p2 = (bit 0-5) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev)
 
@@ -946,16 +946,16 @@ static CommandCost CmdRailTrackHelper(Ti
 
 * @return the cost of this operation or an error
 
 * @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.
 
 * Stub for the unified rail builder/remover
 
 * @param flags operation to perform
 
 * @param tile start tile of drag
 
 * @param flags operation to perform
 
 * @param p1 end tile of drag
 
 * @param p2 various bitstuffed elements
 
 * - p2 = (bit 0-5) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev), only used for building
 
@@ -965,15 +965,15 @@ CommandCost CmdBuildRailroadTrack(TileIn
 
 * @return the cost of this operation or an error
 
 * @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
 
 * @param flags operation to perform
 
 * @param tile position of the train depot
 
 * @param flags operation to perform
 
 * @param p1 rail type
 
 * @param p2 bit 0..1 entrance direction (DiagDirection)
 
 * @param text unused
 
@@ -982,7 +982,7 @@ CommandCost CmdRemoveRailroadTrack(TileI
 
 * @todo When checking for the tile slope,
 
 * 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 */
 
	RailType railtype = Extract<RailType, 0, 6>(p1);
 
@@ -1039,8 +1039,8 @@ CommandCost CmdBuildTrainDepot(TileIndex
 
 * Build signals, alternate between double/single, signal/semaphore,
 
 * pre/exit/combo-signals, and what-else not. If the rail piece does not
 
 * have any signals, bit 4 (cycle signal-type) is ignored
 
 * @param flags operation to perform
 
 * @param tile tile where to build the signals
 
 * @param flags operation to perform
 
 * @param p1 various bitstuffed elements
 
 * - 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)
 
@@ -1056,7 +1056,7 @@ CommandCost CmdBuildTrainDepot(TileIndex
 
 * @return the cost of this operation or an error
 
 * @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);
 
	bool ctrl_pressed = HasBit(p1, 3); // was the CTRL button pressed
 
@@ -1256,8 +1256,8 @@ static bool AdvanceSignalAutoFill(TileIn
 

	
 
/**
 
 * Build many signals by dragging; AutoSignals
 
 * @param flags operation to perform
 
 * @param tile start tile of drag
 
 * @param flags operation to perform
 
 * @param p1  end tile of drag
 
 * @param p2 various bitstuffed elements
 
 * - p2 = (bit  0- 2) - track-orientation, valid values: 0-5 (Track enum)
 
@@ -1271,7 +1271,7 @@ static bool AdvanceSignalAutoFill(TileIn
 
 * @param text unused
 
 * @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);
 
	TileIndex start_tile = tile;
 
@@ -1467,8 +1467,8 @@ static CommandCost CmdSignalTrackHelper(
 
/**
 
 * Build signals on a stretch of track.
 
 * Stub for the unified signal builder/remover
 
 * @param flags operation to perform
 
 * @param tile start tile of drag
 
 * @param flags operation to perform
 
 * @param p1  end tile of drag
 
 * @param p2 various bitstuffed elements
 
 * - p2 = (bit  0- 2) - track-orientation, valid values: 0-5 (Track enum)
 
@@ -1482,15 +1482,15 @@ static CommandCost CmdSignalTrackHelper(
 
 * @return the cost of this operation or an error
 
 * @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
 
 * @param flags operation to perform
 
 * @param tile coordinates where signal is being deleted from
 
 * @param flags operation to perform
 
 * @param p1 various bitstuffed elements, only track information is used
 
 *           - (bit  0- 2) - track-orientation, valid values: 0-5 (Track enum)
 
 *           - (bit  3)    - override signal/semaphore, or pre/exit/combo signal (CTRL-toggle)
 
@@ -1499,7 +1499,7 @@ CommandCost CmdBuildSignalTrack(TileInde
 
 * @param text unused
 
 * @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);
 

	
 
@@ -1559,8 +1559,8 @@ CommandCost CmdRemoveSingleSignal(TileIn
 
/**
 
 * Remove signals on a stretch of track.
 
 * Stub for the unified signal builder/remover
 
 * @param flags operation to perform
 
 * @param tile start tile of drag
 
 * @param flags operation to perform
 
 * @param p1  end tile of drag
 
 * @param p2 various bitstuffed elements
 
 * - p2 = (bit  0- 2) - track-orientation, valid values: 0-5 (Track enum)
 
@@ -1574,9 +1574,9 @@ CommandCost CmdRemoveSingleSignal(TileIn
 
 * @return the cost of this operation or an error
 
 * @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 */
 
@@ -1593,8 +1593,8 @@ static Vehicle *UpdateTrainPowerProc(Veh
 
/**
 
 * Convert one rail type to the other. You can convert normal rail to
 
 * monorail/maglev easily or vice-versa.
 
 * @param flags operation to perform
 
 * @param tile end tile of rail conversion drag
 
 * @param flags operation to perform
 
 * @param p1 start tile of drag
 
 * @param p2 various bitstuffed elements:
 
 * - p2 = (bit  0- 5) new railtype to convert to.
 
@@ -1602,7 +1602,7 @@ static Vehicle *UpdateTrainPowerProc(Veh
 
 * @param text unused
 
 * @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);
 
	TileIndex area_start = p1;
src/road_cmd.cpp
Show inline comments
 
@@ -602,8 +602,8 @@ static CommandCost CheckRoadSlope(Slope 
 

	
 
/**
 
 * Build a piece of road.
 
 * @param flags operation to perform
 
 * @param tile tile where to build road
 
 * @param flags operation to perform
 
 * @param p1 bit 0..3 road pieces to build (RoadBits)
 
 *           bit 4..9 road type
 
 *           bit 11..12 disallowed directions to toggle
 
@@ -611,7 +611,7 @@ static CommandCost CheckRoadSlope(Slope 
 
 * @param text unused
 
 * @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;
 
	CommandCost cost(EXPENSES_CONSTRUCTION);
 
@@ -967,8 +967,8 @@ static bool CanConnectToRoad(TileIndex t
 

	
 
/**
 
 * Build a long piece of road.
 
 * @param flags operation to perform
 
 * @param start_tile start tile of drag (the building cost will appear over this tile)
 
 * @param flags operation to perform
 
 * @param p1 end tile of drag
 
 * @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
 
@@ -982,7 +982,7 @@ static bool CanConnectToRoad(TileIndex t
 
 * @param text unused
 
 * @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;
 

	
 
@@ -1076,8 +1076,8 @@ CommandCost CmdBuildLongRoad(TileIndex s
 

	
 
/**
 
 * Remove a long piece of road.
 
 * @param flags operation to perform
 
 * @param start_tile start tile of drag
 
 * @param flags operation to perform
 
 * @param p1 end tile of drag
 
 * @param p2 various bitstuffed elements
 
 * - p2 = (bit 0) - start tile starts in the 2nd half of tile (p2 & 1)
 
@@ -1087,7 +1087,7 @@ CommandCost CmdBuildLongRoad(TileIndex s
 
 * @param text unused
 
 * @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);
 

	
 
@@ -1164,7 +1164,7 @@ CommandCost CmdRemoveLongRoad(TileIndex 
 
 * @todo When checking for the tile slope,
 
 * 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);
 

	
 
@@ -2343,15 +2343,15 @@ static void ConvertRoadTypeOwner(TileInd
 
 * Convert one road subtype to another.
 
 * Not meant to convert from road to tram.
 
 *
 
 * @param flags operation to perform
 
 * @param tile end tile of road conversion drag
 
 * @param flags operation to perform
 
 * @param p1 start tile of drag
 
 * @param p2 various bitstuffed elements:
 
 * - p2 = (bit  0..5) new roadtype to convert to.
 
 * @param text unused
 
 * @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);
 

	
src/roadveh_cmd.cpp
Show inline comments
 
@@ -250,14 +250,14 @@ void RoadVehUpdateCache(RoadVehicle *v, 
 

	
 
/**
 
 * Build a road vehicle.
 
 * @param flags    type of operation.
 
 * @param tile     tile of the depot where road vehicle is built.
 
 * @param flags    type of operation.
 
 * @param e        the engine to build.
 
 * @param data     unused.
 
 * @param[out] ret the vehicle that has been built.
 
 * @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 */
 
	RoadType rt = e->u.road.roadtype;
 
@@ -360,14 +360,14 @@ bool RoadVehicle::FindClosestDepot(TileI
 

	
 
/**
 
 * Turn a roadvehicle around.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 vehicle ID to turn
 
 * @param p2 unused
 
 * @param text unused
 
 * @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);
 
	if (v == nullptr) return CMD_ERROR;
src/roadveh_cmd.h
Show inline comments
 
@@ -14,7 +14,7 @@
 
#include "engine_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;
 

	
src/settings.cpp
Show inline comments
 
@@ -1486,8 +1486,8 @@ const SettingDesc *GetSettingFromName(co
 

	
 
/**
 
 * Network-safe changing of settings (server-only).
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 unused
 
 * @param p2 the new value for the setting
 
 * The new value is properly clamped to its minimum/maximum when setting
 
@@ -1495,7 +1495,7 @@ const SettingDesc *GetSettingFromName(co
 
 * @return the cost of this operation or an error
 
 * @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;
 
	const SettingDesc *sd = GetSettingFromName(text);
 
@@ -1515,15 +1515,15 @@ CommandCost CmdChangeSetting(TileIndex t
 

	
 
/**
 
 * Change one of the per-company settings.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 unused
 
 * @param p2 the new value for the setting
 
 * The new value is properly clamped to its minimum/maximum when setting
 
 * @param text the name of the company setting to change
 
 * @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;
 
	const SettingDesc *sd = GetCompanySettingFromName(text.c_str());
src/ship_cmd.cpp
Show inline comments
 
@@ -838,14 +838,14 @@ void Ship::SetDestTile(TileIndex tile)
 

	
 
/**
 
 * Build a ship.
 
 * @param flags    type of operation.
 
 * @param tile     tile of the depot where ship is built.
 
 * @param flags    type of operation.
 
 * @param e        the engine to build.
 
 * @param data     unused.
 
 * @param[out] ret the vehicle that has been built.
 
 * @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);
 
	if (flags & DC_EXEC) {
src/ship_cmd.h
Show inline comments
 
@@ -14,6 +14,6 @@
 
#include "engine_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 */
src/signs_cmd.cpp
Show inline comments
 
@@ -37,7 +37,7 @@ SignID _new_sign_id;
 
 * @param text unused
 
 * @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 */
 
	if (!Sign::CanAllocateItem()) return_cmd_error(STR_ERROR_TOO_MANY_SIGNS);
 
@@ -76,7 +76,7 @@ CommandCost CmdPlaceSign(TileIndex tile,
 
 * @param text the new name or an empty string when resetting to the default
 
 * @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);
 
	if (si == nullptr) return CMD_ERROR;
src/station_cmd.cpp
Show inline comments
 
@@ -1237,8 +1237,8 @@ static void RestoreTrainReservation(Trai
 

	
 
/**
 
 * Build rail station
 
 * @param flags operation to perform
 
 * @param tile_org northern most position of station dragging/placement
 
 * @param flags operation to perform
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0- 5) - railtype
 
 * - p1 = (bit  6)    - orientation (Axis)
 
@@ -1252,7 +1252,7 @@ static void RestoreTrainReservation(Trai
 
 * @param text unused
 
 * @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 */
 
	RailType rt    = Extract<RailType, 0, 6>(p1);
 
@@ -1653,15 +1653,15 @@ CommandCost RemoveFromRailBaseStation(Ti
 
/**
 
 * Remove a single tile from a rail station.
 
 * This allows for custom-built station with holes and weird layouts
 
 * @param flags operation to perform
 
 * @param start tile of station piece to remove
 
 * @param flags operation to perform
 
 * @param p1 start_tile
 
 * @param p2 various bitstuffed elements
 
 * - p2 = bit 0 - if set keep the rail
 
 * @param text unused
 
 * @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;
 
	if (start >= MapSize() || end >= MapSize()) return CMD_ERROR;
 
@@ -1687,15 +1687,15 @@ CommandCost CmdRemoveFromRailStation(Til
 
/**
 
 * Remove a single tile from a waypoint.
 
 * This allows for custom-built waypoint with holes and weird layouts
 
 * @param flags operation to perform
 
 * @param start tile of waypoint piece to remove
 
 * @param flags operation to perform
 
 * @param p1 start_tile
 
 * @param p2 various bitstuffed elements
 
 * - p2 = bit 0 - if set keep the rail
 
 * @param text unused
 
 * @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;
 
	if (start >= MapSize() || end >= MapSize()) return CMD_ERROR;
 
@@ -1820,8 +1820,8 @@ static CommandCost FindJoiningRoadStop(S
 

	
 
/**
 
 * Build a bus or truck stop.
 
 * @param flags Operation to perform.
 
 * @param tile Northernmost tile of the stop.
 
 * @param flags Operation to perform.
 
 * @param p1 bit 0..7: Width of the road stop.
 
 *           bit 8..15: Length of the road stop.
 
 * @param p2 bit 0: 0 For bus stops, 1 for truck stops.
 
@@ -1834,7 +1834,7 @@ static CommandCost FindJoiningRoadStop(S
 
 * @param text Unused.
 
 * @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 is_drive_through = HasBit(p2, 1);
 
@@ -2075,8 +2075,8 @@ static CommandCost RemoveRoadStop(TileIn
 

	
 
/**
 
 * Remove bus or truck stops.
 
 * @param flags Operation to perform.
 
 * @param tile Northernmost tile of the removal area.
 
 * @param flags Operation to perform.
 
 * @param p1 bit 0..7: Width of the removal area.
 
 *           bit 8..15: Height of the removal area.
 
 * @param p2 bit 0: 0 For bus stops, 1 for truck stops.
 
@@ -2084,7 +2084,7 @@ static CommandCost RemoveRoadStop(TileIn
 
 * @param text Unused.
 
 * @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 height = (uint8)GB(p1, 8, 8);
 
@@ -2232,8 +2232,8 @@ void UpdateAirportsNoise()
 

	
 
/**
 
 * Place an Airport.
 
 * @param flags operation to perform
 
 * @param tile tile where airport will be built
 
 * @param flags operation to perform
 
 * @param p1
 
 * - p1 = (bit  0- 7) - airport type, @see airport.h
 
 * - p1 = (bit  8-15) - airport layout
 
@@ -2243,7 +2243,7 @@ void UpdateAirportsNoise()
 
 * @param text unused
 
 * @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);
 
	bool reuse = (station_to_join != NEW_STATION);
 
@@ -2453,14 +2453,14 @@ static CommandCost RemoveAirport(TileInd
 

	
 
/**
 
 * Open/close an airport to incoming aircraft.
 
 * @param flags Operation to perform.
 
 * @param tile Unused.
 
 * @param flags Operation to perform.
 
 * @param p1 Station ID of the airport.
 
 * @param p2 Unused.
 
 * @param text unused
 
 * @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;
 
	Station *st = Station::Get(p1);
 
@@ -2508,14 +2508,14 @@ static const byte _dock_h_chk[4] = { 1, 
 

	
 
/**
 
 * Build a dock/haven.
 
 * @param flags operation to perform
 
 * @param tile tile where dock will be built
 
 * @param flags operation to perform
 
 * @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 text unused
 
 * @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);
 
	bool reuse = (station_to_join != NEW_STATION);
 
@@ -3927,14 +3927,14 @@ static bool IsUniqueStationName(const st
 

	
 
/**
 
 * Rename a station
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 station ID that is to be renamed
 
 * @param p2 unused
 
 * @param text the new name or an empty string when resetting to the default
 
 * @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);
 
	if (st == nullptr) return CMD_ERROR;
src/story.cpp
Show inline comments
 
@@ -197,15 +197,15 @@ bool StoryPageButtonData::ValidateVehicl
 

	
 
/**
 
 * Create a new story page.
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0 -  7) - Company for which this story page belongs to.
 
 * @param p2 unused.
 
 * @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
 
 */
 
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;
 

	
 
@@ -242,8 +242,8 @@ CommandCost CmdCreateStoryPage(TileIndex
 

	
 
/**
 
 * Create a new story page element.
 
 * @param flags type of operation
 
 * @param tile Tile location if it is a location page element, otherwise unused.
 
 * @param flags type of operation
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0 -  15) - The page which the element belongs to.
 
 *        (bit  16 -  23) - Page element type
 
@@ -251,7 +251,7 @@ CommandCost CmdCreateStoryPage(TileIndex
 
 * @param text Text content in case it is a text or location page element
 
 * @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;
 

	
 
@@ -292,8 +292,8 @@ CommandCost CmdCreateStoryPageElement(Ti
 

	
 
/**
 
 * Update a new story page element.
 
 * @param flags type of operation
 
 * @param tile Tile location if it is a location page element, otherwise unused.
 
 * @param flags type of operation
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0 -  15) - The page element to update.
 
 *        (bit  16 -  31) - unused
 
@@ -301,7 +301,7 @@ CommandCost CmdCreateStoryPageElement(Ti
 
 * @param text Text content in case it is a text or location page element
 
 * @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);
 

	
 
@@ -324,14 +324,14 @@ CommandCost CmdUpdateStoryPageElement(Ti
 

	
 
/**
 
 * Update title of a story page.
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 = (bit 0 - 15) - StoryPageID to update.
 
 * @param p2 unused
 
 * @param text title text of the story page.
 
 * @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;
 
	StoryPageID page_id = (StoryPageID)GB(p1, 0, 16);
 
@@ -354,14 +354,14 @@ CommandCost CmdSetStoryPageTitle(TileInd
 

	
 
/**
 
 * Update date of a story page.
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 = (bit 0 - 15) - StoryPageID to update.
 
 * @param p2 = (bit 0 - 31) - date
 
 * @param text unused
 
 * @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;
 
	StoryPageID page_id = (StoryPageID)GB(p1, 0, 16);
 
@@ -381,14 +381,14 @@ CommandCost CmdSetStoryPageDate(TileInde
 
/**
 
 * Display a story page for all clients that are allowed to
 
 * view the story page.
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 = (bit 0 - 15) - StoryPageID to show.
 
 * @param p2 unused
 
 * @param text unused
 
 * @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;
 
	StoryPageID page_id = (StoryPageID)GB(p1, 0, 16);
 
@@ -403,14 +403,14 @@ CommandCost CmdShowStoryPage(TileIndex t
 
}
 
/**
 
 * Remove a story page and associated story page elements.
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 = (bit 0 - 15) - StoryPageID to remove.
 
 * @param p2 unused.
 
 * @param text unused.
 
 * @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;
 
	StoryPageID page_id = (StoryPageID)p1;
 
@@ -436,14 +436,14 @@ CommandCost CmdRemoveStoryPage(TileIndex
 

	
 
/**
 
 * Remove a story page element
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 = (bit 0 - 15) - StoryPageElementID to remove.
 
 * @param p2 unused.
 
 * @param text unused.
 
 * @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;
 
	StoryPageElementID page_element_id = (StoryPageElementID)p1;
 
@@ -463,14 +463,14 @@ CommandCost CmdRemoveStoryPageElement(Ti
 

	
 
/**
 
 * Clicked/used a button on a story page.
 
 * @param flags  Type of operation.
 
 * @param tile   Tile selected, for tile selection buttons, otherwise unused.
 
 * @param flags  Type of operation.
 
 * @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 text   Unused.
 
 * @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);
 

	
src/subsidy.cpp
Show inline comments
 
@@ -231,8 +231,8 @@ void CreateSubsidy(CargoID cid, SourceTy
 

	
 
/**
 
 * Create a new subsidy.
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param flags type of operation
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0 -  7) - SourceType of source.
 
 * - p1 = (bit  8 - 23) - SourceID of source.
 
@@ -243,7 +243,7 @@ void CreateSubsidy(CargoID cid, SourceTy
 
 * @param text unused.
 
 * @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;
 

	
src/terraform_cmd.cpp
Show inline comments
 
@@ -179,14 +179,14 @@ static CommandCost TerraformTileHeight(T
 

	
 
/**
 
 * Terraform land
 
 * @param flags for this command type
 
 * @param tile tile to terraform
 
 * @param flags for this command type
 
 * @param p1 corners to terraform (SLOPE_xxx)
 
 * @param p2 direction; eg up (non-zero) or down (zero)
 
 * @param text unused
 
 * @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;
 

	
 
@@ -334,8 +334,8 @@ CommandCost CmdTerraformLand(TileIndex t
 

	
 
/**
 
 * Levels a selected (rectangle) area of land
 
 * @param flags for this command type
 
 * @param tile end tile of area-drag
 
 * @param flags for this command type
 
 * @param p1 start tile of area drag
 
 * @param p2 various bitstuffed data.
 
 *  bit      0: Whether to use the Orthogonal (0) or Diagonal (1) iterator.
 
@@ -343,7 +343,7 @@ CommandCost CmdTerraformLand(TileIndex t
 
 * @param text unused
 
 * @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;
 

	
src/timetable_cmd.cpp
Show inline comments
 
@@ -86,8 +86,8 @@ static void ChangeTimetable(Vehicle *v, 
 

	
 
/**
 
 * Change timetable data of an order.
 
 * @param flags Operation to perform.
 
 * @param tile Not used.
 
 * @param flags Operation to perform.
 
 * @param p1 Various bitstuffed elements
 
 * - p1 = (bit  0-19) - Vehicle with the orders to change.
 
 * - p1 = (bit 20-27) - Order index to modify.
 
@@ -98,7 +98,7 @@ static void ChangeTimetable(Vehicle *v, 
 
 * @param text unused
 
 * @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);
 

	
 
@@ -184,15 +184,15 @@ CommandCost CmdChangeTimetable(TileIndex
 

	
 
/**
 
 * Clear the lateness counter to make the vehicle on time.
 
 * @param flags Operation to perform.
 
 * @param tile Not used.
 
 * @param flags Operation to perform.
 
 * @param p1 Various bitstuffed elements
 
 * - p1 = (bit  0-19) - Vehicle with the orders to change.
 
 * @param p2 unused
 
 * @param text unused
 
 * @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);
 

	
 
@@ -250,8 +250,8 @@ static bool VehicleTimetableSorter(Vehic
 

	
 
/**
 
 * Set the start date of the timetable.
 
 * @param flags Operation to perform.
 
 * @param tile Not used.
 
 * @param flags Operation to perform.
 
 * @param p2 Various bitstuffed elements
 
 * - p2 = (bit 0-19) - Vehicle ID.
 
 * - p2 = (bit 20)   - Set to 1 to set timetable start for all vehicles sharing this order
 
@@ -259,7 +259,7 @@ static bool VehicleTimetableSorter(Vehic
 
 * @param text Not used.
 
 * @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);
 
	Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 20));
 
@@ -315,8 +315,8 @@ CommandCost CmdSetTimetableStart(TileInd
 
 * Start or stop filling the timetable automatically from the time the vehicle
 
 * actually takes to complete it. When starting to autofill the current times
 
 * are cleared and the timetable will start again from scratch.
 
 * @param flags Operation to perform.
 
 * @param tile Not used.
 
 * @param flags Operation to perform.
 
 * @param p1 Vehicle index.
 
 * @param p2 Various bitstuffed elements
 
 * - p2 = (bit 0) - Set to 1 to enable, 0 to disable autofill.
 
@@ -324,7 +324,7 @@ CommandCost CmdSetTimetableStart(TileInd
 
 * @param text unused
 
 * @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);
 

	
src/town_cmd.cpp
Show inline comments
 
@@ -1923,8 +1923,8 @@ static bool IsUniqueTownName(const std::
 

	
 
/**
 
 * Create a new town.
 
 * @param flags type of operation
 
 * @param tile coordinates where town is built
 
 * @param flags type of operation
 
 * @param p1  0..1 size of the town (@see TownSize)
 
 *               2 true iff it should be a city
 
 *            3..5 town road layout (@see TownLayout)
 
@@ -1933,7 +1933,7 @@ static bool IsUniqueTownName(const std::
 
 * @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
 
 */
 
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);
 
	bool city = HasBit(p1, 2);
 
@@ -2735,14 +2735,14 @@ void ClearTownHouse(Town *t, TileIndex t
 

	
 
/**
 
 * Rename a town (server-only).
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 town ID to rename
 
 * @param p2 unused
 
 * @param text the new name or an empty string when resetting to the default
 
 * @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);
 
	if (t == nullptr) return CMD_ERROR;
 
@@ -2786,8 +2786,8 @@ const CargoSpec *FindFirstCargoWithTownE
 

	
 
/**
 
 * Change the cargo goal of a town.
 
 * @param flags Type of operation.
 
 * @param tile Unused.
 
 * @param flags Type of operation.
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0 - 15) - Town ID to cargo game of.
 
 * - p1 = (bit 16 - 23) - TownEffect to change the game of.
 
@@ -2795,7 +2795,7 @@ const CargoSpec *FindFirstCargoWithTownE
 
 * @param text Unused.
 
 * @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;
 

	
 
@@ -2821,14 +2821,14 @@ CommandCost CmdTownCargoGoal(TileIndex t
 

	
 
/**
 
 * Set a custom text in the Town window.
 
 * @param flags Type of operation.
 
 * @param tile Unused.
 
 * @param flags Type of operation.
 
 * @param p1 Town ID to change the text of.
 
 * @param p2 Unused.
 
 * @param text The new text (empty to remove the text).
 
 * @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;
 
	Town *t = Town::GetIfValid(p1);
 
@@ -2845,14 +2845,14 @@ CommandCost CmdTownSetText(TileIndex til
 

	
 
/**
 
 * Change the growth rate of the town.
 
 * @param flags Type of operation.
 
 * @param tile Unused.
 
 * @param flags Type of operation.
 
 * @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 text Unused.
 
 * @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 (GB(p2, 16, 16) != 0) return CMD_ERROR;
 
@@ -2885,14 +2885,14 @@ CommandCost CmdTownGrowthRate(TileIndex 
 

	
 
/**
 
 * Change the rating of a company in a town
 
 * @param flags Type of operation.
 
 * @param tile Unused.
 
 * @param flags Type of operation.
 
 * @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 text Unused.
 
 * @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;
 

	
 
@@ -2914,14 +2914,14 @@ CommandCost CmdTownRating(TileIndex tile
 

	
 
/**
 
 * Expand a town (scenario editor only).
 
 * @param flags Type of operation.
 
 * @param tile Unused.
 
 * @param flags Type of operation.
 
 * @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 text Unused.
 
 * @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;
 
	Town *t = Town::GetIfValid(p1);
 
@@ -2954,14 +2954,14 @@ CommandCost CmdExpandTown(TileIndex tile
 

	
 
/**
 
 * Delete a town (scenario editor or worldgen only).
 
 * @param flags Type of operation.
 
 * @param tile Unused.
 
 * @param flags Type of operation.
 
 * @param p1 Town ID to delete.
 
 * @param p2 Unused.
 
 * @param text Unused.
 
 * @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;
 
	Town *t = Town::GetIfValid(p1);
 
@@ -3340,14 +3340,14 @@ uint GetMaskOfTownActions(int *nump, Com
 
 * Do a town action.
 
 * This performs an action such as advertising, building a statue, funding buildings,
 
 * but also bribing the town-council
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 town to do the action at
 
 * @param p2 action to perform, @see _town_action_proc for the list of available actions
 
 * @param text unused
 
 * @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);
 
	if (t == nullptr || p2 >= lengthof(_town_action_proc)) return CMD_ERROR;
src/train_cmd.cpp
Show inline comments
 
@@ -584,13 +584,13 @@ void GetTrainSpriteSize(EngineID engine,
 

	
 
/**
 
 * Build a railroad wagon.
 
 * @param flags    type of operation.
 
 * @param tile     tile of the depot where rail-vehicle is built.
 
 * @param flags    type of operation.
 
 * @param e        the engine to build.
 
 * @param[out] ret the vehicle that has been built.
 
 * @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;
 

	
 
@@ -714,18 +714,18 @@ static void AddRearEngineToMultiheadedTr
 

	
 
/**
 
 * Build a railroad vehicle.
 
 * @param flags    type of operation.
 
 * @param tile     tile of the depot where rail-vehicle is built.
 
 * @param flags    type of operation.
 
 * @param e        the engine to build.
 
 * @param data     bit 0 prevents any free cars from being added to the train.
 
 * @param[out] ret the vehicle that has been built.
 
 * @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;
 

	
 
	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 *
 
	 * 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 *he
 

	
 
/**
 
 * Move a rail vehicle around inside the depot.
 
 * @param tile unused
 
 * @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.
 
 * @param tile unused
 
 * @param p1 various bitstuffed elements
 
 * - p1 (bit  0 - 19) source vehicle index
 
 * - p1 (bit      20) move all vehicles following the source vehicle
 
@@ -1169,7 +1169,7 @@ static void NormaliseTrainHead(Train *he
 
 * @param text unused
 
 * @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 d = GB(p2, 0, 20);
 
@@ -1916,7 +1916,7 @@ void ReverseTrainDirection(Train *v)
 
 * @param text unused
 
 * @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);
 
	if (v == nullptr) return CMD_ERROR;
 
@@ -1982,14 +1982,14 @@ CommandCost CmdReverseTrainDirection(Til
 

	
 
/**
 
 * Force a train through a red signal
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 train to ignore the red signal
 
 * @param p2 unused
 
 * @param text unused
 
 * @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);
 
	if (t == nullptr) return CMD_ERROR;
src/train_cmd.h
Show inline comments
 
@@ -14,7 +14,7 @@
 
#include "engine_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);
 

	
 
CommandProc CmdMoveRailVehicle;
src/tree_cmd.cpp
Show inline comments
 
@@ -379,14 +379,14 @@ void GenerateTrees()
 

	
 
/**
 
 * Plant a tree.
 
 * @param flags type of operation
 
 * @param tile end tile of area-drag
 
 * @param flags type of operation
 
 * @param p1 tree type, TREE_INVALID means random.
 
 * @param p2 start tile of area-drag of tree plantation
 
 * @param text unused
 
 * @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;
 
	CommandCost cost(EXPENSES_OTHER);
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -248,8 +248,8 @@ static Money TunnelBridgeClearCost(TileI
 

	
 
/**
 
 * Build a Bridge
 
 * @param flags type of operation
 
 * @param end_tile end tile
 
 * @param flags type of operation
 
 * @param p1 packed start tile coords (~ dx)
 
 * @param p2 various bitstuffed elements
 
 * - p2 = (bit  0- 7) - bridge type (hi bh)
 
@@ -258,7 +258,7 @@ static Money TunnelBridgeClearCost(TileI
 
 * @param text unused
 
 * @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;
 

	
 
@@ -623,15 +623,15 @@ CommandCost CmdBuildBridge(TileIndex end
 

	
 
/**
 
 * Build Tunnel.
 
 * @param flags type of operation
 
 * @param start_tile start tile of tunnel
 
 * @param flags type of operation
 
 * @param p1 bit 0-5 railtype or roadtype
 
 *           bit 8-9 transport type
 
 * @param p2 unused
 
 * @param text unused
 
 * @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;
 

	
src/vehicle_cmd.cpp
Show inline comments
 
@@ -74,8 +74,8 @@ const StringID _send_to_depot_msg_table[
 

	
 
/**
 
 * Build a vehicle.
 
 * @param flags for command
 
 * @param tile tile of depot where the vehicle is built
 
 * @param flags for command
 
 * @param p1 various bitstuffed data
 
 *  bits  0-15: vehicle type being built.
 
 *  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
 
 * @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. */
 
	if (!IsDepotTile(tile) || !IsTileOwner(tile, _current_company)) return CMD_ERROR;
 
@@ -137,10 +137,10 @@ CommandCost CmdBuildVehicle(TileIndex ti
 

	
 
	Vehicle *v = nullptr;
 
	switch (type) {
 
		case VEH_TRAIN:    value.AddCost(CmdBuildRailVehicle(tile, subflags, e, GB(p1, 16, 8), &v)); break;
 
		case VEH_ROAD:     value.AddCost(CmdBuildRoadVehicle(tile, subflags, e, GB(p1, 16, 8), &v)); break;
 
		case VEH_SHIP:     value.AddCost(CmdBuildShip       (tile, subflags, e, GB(p1, 16, 8), &v)); break;
 
		case VEH_AIRCRAFT: value.AddCost(CmdBuildAircraft   (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(subflags, tile, 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   (subflags, tile, e, GB(p1, 16, 8), &v)); break;
 
		default: NOT_REACHED(); // Safe due to IsDepotTile()
 
	}
 

	
 
@@ -152,7 +152,7 @@ CommandCost CmdBuildVehicle(TileIndex ti
 

	
 
		if (refitting) {
 
			/* 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 {
 
			/* Fill in non-refitted capacities */
 
			_returned_refit_capacity = e->GetDisplayDefaultCapacity(&_returned_mail_refit_capacity);
 
@@ -202,7 +202,7 @@ CommandCost CmdBuildVehicle(TileIndex ti
 
 * @param text unused.
 
 * @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));
 
	if (v == nullptr) return CMD_ERROR;
 
@@ -451,8 +451,8 @@ static CommandCost RefitVehicle(Vehicle 
 

	
 
/**
 
 * Refits a vehicle to the specified cargo type.
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 vehicle ID to refit
 
 * @param p2 various bitstuffed elements
 
 * - p2 = (bit 0-7)   - New cargo type to refit to.
 
@@ -464,7 +464,7 @@ static CommandCost RefitVehicle(Vehicle 
 
 * @param text unused
 
 * @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);
 
	if (v == nullptr) return CMD_ERROR;
 
@@ -545,14 +545,14 @@ CommandCost CmdRefitVehicle(TileIndex ti
 

	
 
/**
 
 * Start/Stop a vehicle
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @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 text unused
 
 * @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 */
 
	if ((flags & DC_AUTOREPLACE) == 0) SetBit(p2, 0);
 
@@ -627,8 +627,8 @@ CommandCost CmdStartStopVehicle(TileInde
 

	
 
/**
 
 * Starts or stops a lot of vehicles
 
 * @param flags type of operation
 
 * @param tile Tile of the depot where the vehicles are started/stopped (only used for depots)
 
 * @param flags type of operation
 
 * @param p1 bitmask
 
 *   - 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
 
@@ -636,7 +636,7 @@ CommandCost CmdStartStopVehicle(TileInde
 
 * @param text unused
 
 * @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;
 
	bool do_start = HasBit(p1, 0);
 
@@ -669,14 +669,14 @@ CommandCost CmdMassStartStopVehicle(Tile
 

	
 
/**
 
 * Sells all vehicles in a depot
 
 * @param flags type of operation
 
 * @param tile Tile of the depot where the depot is
 
 * @param flags type of operation
 
 * @param p1 Vehicle type
 
 * @param p2 unused
 
 * @param text unused
 
 * @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;
 

	
 
@@ -705,14 +705,14 @@ CommandCost CmdDepotSellAllVehicles(Tile
 

	
 
/**
 
 * Autoreplace all vehicles in the depot
 
 * @param flags type of operation
 
 * @param tile Tile of the depot where the vehicles are
 
 * @param flags type of operation
 
 * @param p1 Type of vehicle
 
 * @param p2 unused
 
 * @param text unused
 
 * @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;
 
	CommandCost cost = CommandCost(EXPENSES_NEW_VEHICLES);
 
@@ -809,14 +809,14 @@ static void CloneVehicleName(const Vehic
 

	
 
/**
 
 * Clone a vehicle. If it is a train, it will clone all the cars too
 
 * @param flags type of operation
 
 * @param tile tile of the depot where the cloned vehicle is build
 
 * @param flags type of operation
 
 * @param p1 the original vehicle's index
 
 * @param p2 1 = shared orders, else copied orders
 
 * @param text unused
 
 * @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);
 

	
 
@@ -1029,8 +1029,8 @@ static CommandCost SendAllVehiclesToDepo
 

	
 
/**
 
 * Send a vehicle to the depot.
 
 * @param flags for command type
 
 * @param tile unused
 
 * @param flags for command type
 
 * @param p1 bitmask
 
 * - p1 0-20: bitvehicle ID to send to the depot
 
 * - p1 bits 25-8  - DEPOT_ flags (see vehicle_type.h)
 
@@ -1038,7 +1038,7 @@ static CommandCost SendAllVehiclesToDepo
 
 * @param text unused
 
 * @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) {
 
		/* Mass goto depot requested */
 
@@ -1056,14 +1056,14 @@ CommandCost CmdSendVehicleToDepot(TileIn
 

	
 
/**
 
 * Give a custom name to your vehicle
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 vehicle ID to name
 
 * @param p2 unused
 
 * @param text the new name or an empty string when resetting to the default
 
 * @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);
 
	if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
 
@@ -1094,8 +1094,8 @@ CommandCost CmdRenameVehicle(TileIndex t
 

	
 
/**
 
 * Change the service interval of a vehicle
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 vehicle ID that is being service-interval-changed
 
 * @param p2 bitmask
 
 * - p2 = (bit  0-15) - new service interval
 
@@ -1104,7 +1104,7 @@ CommandCost CmdRenameVehicle(TileIndex t
 
 * @param text unused
 
 * @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);
 
	if (v == nullptr || !v->IsPrimaryVehicle()) return CMD_ERROR;
src/viewport.cpp
Show inline comments
 
@@ -3466,14 +3466,14 @@ void InitializeSpriteSorter()
 

	
 
/**
 
 * Scroll players main viewport.
 
 * @param flags type of operation
 
 * @param tile tile to center viewport on
 
 * @param flags type of operation
 
 * @param p1 ViewportScrollTarget of scroll target
 
 * @param p2 company or client id depending on the target
 
 * @param text unused
 
 * @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;
 
	ViewportScrollTarget target = (ViewportScrollTarget)p1;
src/water_cmd.cpp
Show inline comments
 
@@ -92,14 +92,14 @@ static void MarkCanalsAndRiversAroundDir
 

	
 
/**
 
 * Build a ship depot.
 
 * @param flags type of operation
 
 * @param tile tile where ship depot is built
 
 * @param flags type of operation
 
 * @param p1 bit 0 depot orientation (Axis)
 
 * @param p2 unused
 
 * @param text unused
 
 * @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);
 

	
 
@@ -411,14 +411,14 @@ static CommandCost RemoveLock(TileIndex 
 

	
 
/**
 
 * Builds a lock.
 
 * @param flags type of operation
 
 * @param tile tile where to place the lock
 
 * @param flags type of operation
 
 * @param p1 unused
 
 * @param p2 unused
 
 * @param text unused
 
 * @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));
 
	if (dir == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
 
@@ -435,8 +435,8 @@ bool RiverModifyDesertZone(TileIndex til
 

	
 
/**
 
 * Build a piece of canal.
 
 * @param flags type of operation
 
 * @param tile end tile of stretch-dragging
 
 * @param flags type of operation
 
 * @param p1 start tile of stretch-dragging
 
 * @param p2 various bitstuffed data
 
 *  bits  0-1: waterclass to build. sea and river can only be built in scenario editor
 
@@ -444,7 +444,7 @@ bool RiverModifyDesertZone(TileIndex til
 
 * @param text unused
 
 * @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);
 
	if (p1 >= MapSize() || wc == WATER_CLASS_INVALID) return CMD_ERROR;
src/waypoint_cmd.cpp
Show inline comments
 
@@ -161,8 +161,8 @@ extern CommandCost CanExpandRailStation(
 
/**
 
 * Convert existing rail to waypoint. Eg build a waypoint station over
 
 * piece of rail
 
 * @param flags type of operation
 
 * @param start_tile northern most tile where waypoint will be built
 
 * @param flags type of operation
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0- 5) - railtype (not used)
 
 * - p1 = (bit  6)    - orientation (Axis)
 
@@ -175,7 +175,7 @@ extern CommandCost CanExpandRailStation(
 
 * @param text unused
 
 * @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 */
 
	Axis axis      = Extract<Axis, 6, 1>(p1);
 
@@ -296,14 +296,14 @@ CommandCost CmdBuildRailWaypoint(TileInd
 

	
 
/**
 
 * Build a buoy.
 
 * @param flags operation to perform
 
 * @param tile tile where to place the buoy
 
 * @param flags operation to perform
 
 * @param p1 unused
 
 * @param p2 unused
 
 * @param text unused
 
 * @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 (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
 
@@ -407,14 +407,14 @@ static bool IsUniqueWaypointName(const s
 

	
 
/**
 
 * Rename a waypoint.
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param flags type of operation
 
 * @param p1 id of waypoint
 
 * @param p2 unused
 
 * @param text the new name or an empty string when resetting to the default
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdRenameWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdRenameWaypoint(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	Waypoint *wp = Waypoint::GetIfValid(p1);
 
	if (wp == nullptr) return CMD_ERROR;
0 comments (0 inline, 0 general)