Changeset - r26097:38be59df2287
[Not reviewed]
master
0 18 0
Michael Lutz - 3 years ago 2021-10-10 15:20:27
michi@icosahedron.de
Codechange: Align parameter order of command callbacks to command handlers.
18 files changed with 57 insertions and 41 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_instance.cpp
Show inline comments
 
@@ -93,12 +93,13 @@ ScriptInfo *AIInstance::FindLibrary(cons
 
/**
 
 * DoCommand callback function for all commands executed by AIs.
 
 * @param result The result of the command.
 
 * @param cmd cmd as given to DoCommandPInternal.
 
 * @param tile The tile on which the command was executed.
 
 * @param p1 p1 as given to DoCommandPInternal.
 
 * @param p2 p2 as given to DoCommandPInternal.
 
 * @param cmd cmd as given to DoCommandPInternal.
 
 * @param text text as given to DoCommandPInternal.
 
 */
 
void CcAI(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcAI(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	/*
 
	 * The company might not exist anymore. Check for this.
src/airport_gui.cpp
Show inline comments
 
@@ -41,7 +41,7 @@ static void ShowBuildAirportPicker(Windo
 

	
 
SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout);
 

	
 
void CcBuildAirport(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcBuildAirport(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 

	
src/bridge_gui.cpp
Show inline comments
 
@@ -50,15 +50,16 @@ typedef GUIList<BuildBridgeData> GUIBrid
 
 * Callback executed after a build Bridge CMD has been called
 
 *
 
 * @param result Whether the build succeeded
 
 * @param cmd unused
 
 * @param end_tile End tile of the bridge.
 
 * @param p1 packed start tile coords (~ dx)
 
 * @param p2 various bitstuffed elements
 
 * - p2 = (bit  0- 7) - bridge type (hi bh)
 
 * - p2 = (bit  8-13) - rail type or road types.
 
 * - p2 = (bit 15-16) - transport type.
 
 * @param cmd unused
 
 * @param text unused
 
 */
 
void CcBuildBridge(const CommandCost &result, TileIndex end_tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcBuildBridge(const CommandCost &result, Commands cmd, TileIndex end_tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 
	if (_settings_client.sound.confirm) SndPlayTileFx(SND_27_CONSTRUCTION_BRIDGE, end_tile);
src/command.cpp
Show inline comments
 
@@ -318,7 +318,7 @@ static bool DoCommandP(Commands cmd, Str
 
	}
 

	
 
	if (!estimate_only && !only_sending && callback != nullptr) {
 
		callback(res, tile, p1, p2, cmd);
 
		callback(res, cmd, tile, p1, p2, text);
 
	}
 

	
 
	return res.Succeeded();
src/command_type.h
Show inline comments
 
@@ -443,12 +443,14 @@ template <Commands Tcmd> struct CommandT
 
 * command succeeded or failed.
 
 *
 
 * @param result The result of the executed command
 
 * @param cmd The command that was executed
 
 * @param tile The tile of the command action
 
 * @param p1 Additional data of the command
 
 * @param p1 Additional data of the command
 
 * @param text Text of the command
 
 * @see CommandProc
 
 */
 
typedef void CommandCallback(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd);
 
typedef void CommandCallback(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text);
 

	
 
/**
 
 * Structure for buffering the build command when selecting a station to join.
src/depot_gui.cpp
Show inline comments
 
@@ -112,12 +112,13 @@ extern void DepotSortList(VehicleList *l
 
/**
 
 * This is the Callback method after the cloning attempt of a vehicle
 
 * @param result the result of the cloning command
 
 * @param cmd unused
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 unused
 
 * @param cmd unused
 
 * @param text unused
 
 */
 
void CcCloneVehicle(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcCloneVehicle(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 

	
src/dock_gui.cpp
Show inline comments
 
@@ -40,7 +40,7 @@ static void ShowBuildDocksDepotPicker(Wi
 

	
 
static Axis _ship_depot_direction;
 

	
 
void CcBuildDocks(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcBuildDocks(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 

	
 
@@ -48,7 +48,7 @@ void CcBuildDocks(const CommandCost &res
 
	if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
}
 

	
 
void CcPlaySound_CONSTRUCTION_WATER(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcPlaySound_CONSTRUCTION_WATER(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_CONSTRUCTION_WATER, tile);
 
}
src/game/game_instance.cpp
Show inline comments
 
@@ -82,12 +82,13 @@ void GameInstance::Died()
 
/**
 
 * DoCommand callback function for all commands executed by Game Scripts.
 
 * @param result The result of the command.
 
 * @param cmd cmd as given to DoCommandPInternal.
 
 * @param tile The tile on which the command was executed.
 
 * @param p1 p1 as given to DoCommandPInternal.
 
 * @param p2 p2 as given to DoCommandPInternal.
 
 * @param cmd cmd as given to DoCommandPInternal.
 
 * @param text text as given to DoCommandPInternal.
 
 */
 
void CcGame(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcGame(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (Game::GetGameInstance()->DoCommandCallback(result, tile, p1, p2, cmd)) {
 
		Game::GetGameInstance()->Continue();
src/group_gui.cpp
Show inline comments
 
@@ -1141,13 +1141,14 @@ static inline VehicleGroupWindow *FindVe
 
/**
 
 * Opens a 'Rename group' window for newly created group.
 
 * @param result Did command succeed?
 
 * @param cmd Unused.
 
 * @param tile Unused.
 
 * @param p1 Vehicle type.
 
 * @param p2 Unused.
 
 * @param cmd Unused.
 
 * @param text Unused.
 
 * @see CmdCreateGroup
 
 */
 
void CcCreateGroup(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcCreateGroup(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 
	assert(p1 <= VEH_AIRCRAFT);
 
@@ -1159,17 +1160,18 @@ void CcCreateGroup(const CommandCost &re
 
/**
 
 * Open rename window after adding a vehicle to a new group via drag and drop.
 
 * @param result Did command succeed?
 
 * @param cmd Unused.
 
 * @param tile Unused.
 
 * @param p1 Unused.
 
 * @param p2 Bit 0-19: Vehicle ID.
 
 * @param cmd Unused.
 
 * @param text Unused.
 
 */
 
void CcAddVehicleNewGroup(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcAddVehicleNewGroup(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 
	assert(Vehicle::IsValidID(GB(p2, 0, 20)));
 

	
 
	CcCreateGroup(result, 0, Vehicle::Get(GB(p2, 0, 20))->type, 0, cmd);
 
	CcCreateGroup(result, cmd, 0, Vehicle::Get(GB(p2, 0, 20))->type, 0, text);
 
}
 

	
 
/**
src/industry_gui.cpp
Show inline comments
 
@@ -219,12 +219,13 @@ void SortIndustryTypes()
 
/**
 
 * Command callback. In case of failure to build an industry, show an error message.
 
 * @param result Result of the command.
 
 * @param cmd    Unused.
 
 * @param tile   Tile where the industry is placed.
 
 * @param p1     Additional data of the #CMD_BUILD_INDUSTRY command.
 
 * @param p2     Additional data of the #CMD_BUILD_INDUSTRY command.
 
 * @param cmd    Unused.
 
 * @param text   Unused.
 
 */
 
void CcBuildIndustry(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcBuildIndustry(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Succeeded()) return;
 

	
src/main_gui.cpp
Show inline comments
 
@@ -76,7 +76,7 @@ bool HandlePlacePushButton(Window *w, in
 
}
 

	
 

	
 
void CcPlaySound_EXPLOSION(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcPlaySound_EXPLOSION(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_12_EXPLOSION, tile);
 
}
src/rail_gui.cpp
Show inline comments
 
@@ -85,7 +85,7 @@ static bool IsStationAvailable(const Sta
 
	return Convert8bitBooleanCallback(statspec->grf_prop.grffile, CBID_STATION_AVAILABILITY, cb_res);
 
}
 

	
 
void CcPlaySound_CONSTRUCTION_RAIL(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcPlaySound_CONSTRUCTION_RAIL(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_20_CONSTRUCTION_RAIL, tile);
 
}
 
@@ -128,7 +128,7 @@ static const DiagDirection _place_depot_
 
	DIAGDIR_NW, DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_NE,
 
};
 

	
 
void CcRailDepot(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcRailDepot(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 

	
 
@@ -169,7 +169,7 @@ static void PlaceRail_Waypoint(TileIndex
 
	}
 
}
 

	
 
void CcStation(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcStation(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 

	
 
@@ -276,7 +276,7 @@ static void PlaceRail_Bridge(TileIndex t
 
}
 

	
 
/** Command callback for building a tunnel */
 
void CcBuildRailTunnel(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcBuildRailTunnel(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Succeeded()) {
 
		if (_settings_client.sound.confirm) SndPlayTileFx(SND_20_CONSTRUCTION_RAIL, tile);
src/road_gui.cpp
Show inline comments
 
@@ -66,7 +66,7 @@ static RoadType _cur_roadtype;
 
static DiagDirection _road_depot_orientation;
 
static DiagDirection _road_station_picker_orientation;
 

	
 
void CcPlaySound_CONSTRUCTION_OTHER(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcPlaySound_CONSTRUCTION_OTHER(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
 
}
 
@@ -90,13 +90,14 @@ static void PlaceRoad_Bridge(TileIndex t
 
 * Callback executed after a build road tunnel command has been called.
 
 *
 
 * @param result Whether the build succeeded.
 
 * @param cmd unused
 
 * @param start_tile Starting tile of the tunnel.
 
 * @param p1 bit 0-3 railtype or roadtypes
 
 *           bit 8-9 transport type
 
 * @param p2 unused
 
 * @param cmd unused
 
 * @param text unused
 
 */
 
void CcBuildRoadTunnel(const CommandCost &result, TileIndex start_tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcBuildRoadTunnel(const CommandCost &result, Commands cmd, TileIndex start_tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Succeeded()) {
 
		if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, start_tile);
 
@@ -129,7 +130,7 @@ void ConnectRoadToStructure(TileIndex ti
 
	}
 
}
 

	
 
void CcRoadDepot(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcRoadDepot(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 

	
 
@@ -142,6 +143,7 @@ void CcRoadDepot(const CommandCost &resu
 
/**
 
 * Command callback for building road stops.
 
 * @param result Result of the build road stop command.
 
 * @param cmd Unused.
 
 * @param tile Start tile.
 
 * @param p1 bit 0..7: Width of the road stop.
 
 *           bit 8..15: Length of the road stop.
 
@@ -152,10 +154,10 @@ void CcRoadDepot(const CommandCost &resu
 
 *           bit 3: #Axis of the road for drive-through stops.
 
 *           bit 5..9: The roadtype.
 
 *           bit 16..31: Station ID to join (NEW_STATION if build new one).
 
 * @param cmd Unused.
 
 * @param text Unused.
 
 * @see CmdBuildRoadStop
 
 */
 
void CcRoadStop(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcRoadStop(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 

	
src/signs_cmd.cpp
Show inline comments
 
@@ -110,12 +110,13 @@ CommandCost CmdRenameSign(DoCommandFlag 
 
/**
 
 * Callback function that is called after a sign is placed
 
 * @param result of the operation
 
 * @param cmd unused
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 unused
 
 * @param cmd unused
 
 * @param text unused
 
 */
 
void CcPlaceSign(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcPlaceSign(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 

	
src/terraform_gui.cpp
Show inline comments
 
@@ -41,7 +41,7 @@
 

	
 
#include "safeguards.h"
 

	
 
void CcTerraform(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcTerraform(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Succeeded()) {
 
		if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
src/town_gui.cpp
Show inline comments
 
@@ -1008,7 +1008,7 @@ void ShowTownDirectory()
 
	new TownDirectoryWindow(&_town_directory_desc);
 
}
 

	
 
void CcFoundTown(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcFoundTown(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 

	
 
@@ -1016,7 +1016,7 @@ void CcFoundTown(const CommandCost &resu
 
	if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
}
 

	
 
void CcFoundRandomTown(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcFoundRandomTown(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Succeeded()) ScrollMainWindowToTile(Town::Get(_new_town_id)->xy);
 
}
src/train_gui.cpp
Show inline comments
 
@@ -22,12 +22,13 @@
 
/**
 
 * Callback for building wagons.
 
 * @param result The result of the command.
 
 * @param cmd Unused.
 
 * @param tile   The tile the command was executed on.
 
 * @param p1 Additional data for the command (for the #CommandProc)
 
 * @param p2 Additional data for the command (for the #CommandProc)
 
 * @param cmd Unused.
 
 * @param text Unused.
 
 */
 
void CcBuildWagon(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcBuildWagon(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 

	
src/vehicle_gui.cpp
Show inline comments
 
@@ -2616,11 +2616,13 @@ static const StringID _vehicle_msg_trans
 
/**
 
 * This is the Callback method after attempting to start/stop a vehicle
 
 * @param result the result of the start/stop command
 
 * @param cmd unused
 
 * @param tile unused
 
 * @param p1 vehicle ID
 
 * @param p2 unused
 
 * @param text unused
 
 */
 
void CcStartStopVehicle(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcStartStopVehicle(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 

	
 
@@ -3119,12 +3121,13 @@ void StopGlobalFollowVehicle(const Vehic
 
/**
 
 * This is the Callback method after the construction attempt of a primary vehicle
 
 * @param result indicates completion (or not) of the operation
 
 * @param cmd unused
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 unused
 
 * @param cmd unused
 
 * @param text unused
 
 */
 
void CcBuildPrimaryVehicle(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
 
void CcBuildPrimaryVehicle(const CommandCost &result, Commands cmd, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
{
 
	if (result.Failed()) return;
 

	
0 comments (0 inline, 0 general)