Changeset - r26122:02442b0744ee
[Not reviewed]
src/ai/ai_instance.cpp
Show inline comments
 
@@ -113,7 +113,7 @@ void CcAI(Commands cmd, const CommandCos
 
	}
 
}
 

	
 
CommandCallback *AIInstance::GetDoCommandCallback()
 
CommandCallbackData *AIInstance::GetDoCommandCallback()
 
{
 
	return &CcAI;
 
}
src/ai/ai_instance.hpp
Show inline comments
 
@@ -29,7 +29,7 @@ public:
 
private:
 
	void RegisterAPI() override;
 
	void Died() override;
 
	CommandCallback *GetDoCommandCallback() override;
 
	CommandCallbackData *GetDoCommandCallback() override;
 
	void LoadDummyScript() override;
 
};
 

	
src/airport_gui.cpp
Show inline comments
 
@@ -43,7 +43,7 @@ static void ShowBuildAirportPicker(Windo
 

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

	
 
void CcBuildAirport(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &)
 
void CcBuildAirport(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Failed()) return;
 

	
src/bridge_gui.cpp
Show inline comments
 
@@ -53,15 +53,14 @@ typedef GUIList<BuildBridgeData> GUIBrid
 
 * @param result Whether the build succeeded
 
 * @param cmd unused
 
 * @param end_tile End tile of the bridge.
 
 * @param data Additional bitstuffed command data.
 
 * @param tile_start start tile
 
 * @param transport_type transport type.
 
 */
 
void CcBuildBridge(Commands cmd, const CommandCost &result, TileIndex end_tile, const CommandDataBuffer &data)
 
void CcBuildBridge(Commands cmd, const CommandCost &result, TileIndex end_tile, TileIndex tile_start, TransportType transport_type, BridgeType, byte)
 
{
 
	if (result.Failed()) return;
 
	if (_settings_client.sound.confirm) SndPlayTileFx(SND_27_CONSTRUCTION_BRIDGE, end_tile);
 

	
 
	auto [tile, tile_start, transport_type, bridge_type, road_rail_type] = EndianBufferReader::ToValue<CommandTraits<CMD_BUILD_BRIDGE>::Args>(data);
 

	
 
	if (transport_type == TRANSPORT_ROAD) {
 
		DiagDirection end_direction = ReverseDiagDir(GetTunnelBridgeDirection(end_tile));
 
		ConnectRoadToStructure(end_tile, end_direction);
src/command_func.h
Show inline comments
 
@@ -284,7 +284,16 @@ protected:
 
		InternalPostResult(res, tile, estimate_only, only_sending, err_message, my_cmd);
 

	
 
		if (!estimate_only && !only_sending && callback != nullptr) {
 
			callback(Tcmd, res, tile, EndianBufferWriter<CommandDataBuffer>::FromValue(args));
 
			if constexpr (std::is_same_v<Tcallback, CommandCallback>) {
 
				/* Callback that doesn't need any command arguments. */
 
				callback(Tcmd, res, tile);
 
			} else if constexpr (std::is_same_v<Tcallback, CommandCallbackData>) {
 
				/* Generic callback that takes packed arguments as a buffer. */
 
				callback(Tcmd, res, tile, EndianBufferWriter<CommandDataBuffer>::FromValue(args));
 
			} else {
 
				/* Callback with arguments. We assume that the tile is only interesting if it actually is in the command arguments. */
 
				std::apply(callback, std::tuple_cat(std::make_tuple(Tcmd, res), args));
 
			}
 
		}
 

	
 
		return res.Succeeded();
src/command_type.h
Show inline comments
 
@@ -438,9 +438,23 @@ typedef std::vector<byte> CommandDataBuf
 
 * @param cmd The command that was executed
 
 * @param result The result of the executed command
 
 * @param tile The tile of the command action
 
 * @see CommandProc
 
 */
 
typedef void CommandCallback(Commands cmd, const CommandCost &result, TileIndex tile);
 

	
 
/**
 
 * Define a callback function for the client, after the command is finished.
 
 *
 
 * Functions of this type are called after the command is finished. The parameters
 
 * are from the #CommandProc callback type. The boolean parameter indicates if the
 
 * command succeeded or failed.
 
 *
 
 * @param cmd The command that was executed
 
 * @param result The result of the executed command
 
 * @param tile The tile of the command action
 
 * @param data Additional data of the command
 
 * @see CommandProc
 
 */
 
typedef void CommandCallback(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &data);
 
typedef void CommandCallbackData(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &data);
 

	
 
#endif /* COMMAND_TYPE_H */
src/depot_gui.cpp
Show inline comments
 
@@ -114,11 +114,11 @@ extern void DepotSortList(VehicleList *l
 

	
 
/**
 
 * This is the Callback method after the cloning attempt of a vehicle
 
 * @param cmd unused
 
 * @param result the result of the cloning command
 
 * @param cmd unused
 
 * @param tile unused
 
 */
 
void CcCloneVehicle(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &)
 
void CcCloneVehicle(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Failed()) return;
 

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

	
 
static Axis _ship_depot_direction;
 

	
 
void CcBuildDocks(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &)
 
void CcBuildDocks(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Failed()) return;
 

	
 
@@ -51,7 +51,7 @@ void CcBuildDocks(Commands cmd, const Co
 
	if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
}
 

	
 
void CcPlaySound_CONSTRUCTION_WATER(Commands cmd, const CommandCost &result,TileIndex tile, const CommandDataBuffer &)
 
void CcPlaySound_CONSTRUCTION_WATER(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_CONSTRUCTION_WATER, tile);
 
}
src/game/game_instance.cpp
Show inline comments
 
@@ -93,7 +93,7 @@ void CcGame(Commands cmd, const CommandC
 
	}
 
}
 

	
 
CommandCallback *GameInstance::GetDoCommandCallback()
 
CommandCallbackData *GameInstance::GetDoCommandCallback()
 
{
 
	return &CcGame;
 
}
src/game/game_instance.hpp
Show inline comments
 
@@ -29,7 +29,7 @@ public:
 
private:
 
	void RegisterAPI() override;
 
	void Died() override;
 
	CommandCallback *GetDoCommandCallback() override;
 
	CommandCallbackData *GetDoCommandCallback() override;
 
	void LoadDummyScript() override {}
 
};
 

	
src/group_cmd.h
Show inline comments
 
@@ -41,7 +41,7 @@ DEF_CMD_TRAIT(CMD_REMOVE_ALL_VEHICLES_GR
 
DEF_CMD_TRAIT(CMD_SET_GROUP_FLAG,            CmdSetGroupFlag,           0, CMDT_ROUTE_MANAGEMENT)
 
DEF_CMD_TRAIT(CMD_SET_GROUP_LIVERY,          CmdSetGroupLivery,         0, CMDT_ROUTE_MANAGEMENT)
 

	
 
CommandCallback CcCreateGroup;
 
CommandCallback CcAddVehicleNewGroup;
 
void CcCreateGroup(Commands cmd, const CommandCost &result, VehicleType vt, GroupID parent_group);
 
void CcAddVehicleNewGroup(Commands cmd, const CommandCost &result, GroupID, VehicleID veh_id, bool);
 

	
 
#endif /* GROUP_CMD_H */
src/group_gui.cpp
Show inline comments
 
@@ -1153,17 +1153,15 @@ static void CcCreateGroup(VehicleType ve
 
 * Opens a 'Rename group' window for newly created group.
 
 * @param cmd Unused.
 
 * @param result Did command succeed?
 
 * @param tile Unused.
 
 * @param data Command data.
 
 * @param vt Vehicle type.
 
 * @param parent_group Parent group of the enw group.
 
 * @see CmdCreateGroup
 
 */
 
void CcCreateGroup(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &data)
 
void CcCreateGroup(Commands cmd, const CommandCost &result, VehicleType vt, GroupID parent_group)
 
{
 
	if (result.Failed()) return;
 

	
 
	auto [vt, parent_group] = EndianBufferReader::ToValue<CommandTraits<CMD_CREATE_GROUP>::Args>(data);
 
	assert(vt <= VEH_AIRCRAFT);
 

	
 
	CcCreateGroup(vt);
 
}
 

	
 
@@ -1171,16 +1169,13 @@ void CcCreateGroup(Commands cmd, const C
 
 * Open rename window after adding a vehicle to a new group via drag and drop.
 
 * @param cmd Unused.
 
 * @param result Did command succeed?
 
 * @param tile Unused.
 
 * @param data Command data.
 
 * @param veh_id vehicle to add to a group
 
 */
 
void CcAddVehicleNewGroup(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &data)
 
void CcAddVehicleNewGroup(Commands cmd, const CommandCost &result, GroupID, VehicleID veh_id, bool)
 
{
 
	if (result.Failed()) return;
 

	
 
	auto [group_id, veh_id, shared] = EndianBufferReader::ToValue<CommandTraits<CMD_ADD_VEHICLE_GROUP>::Args>(data);
 
	assert(Vehicle::IsValidID(veh_id));
 

	
 
	CcCreateGroup(Vehicle::Get(veh_id)->type);
 
}
 

	
src/industry_cmd.h
Show inline comments
 
@@ -23,6 +23,6 @@ CommandCost CmdIndustryCtrl(DoCommandFla
 
DEF_CMD_TRAIT(CMD_BUILD_INDUSTRY, CmdBuildIndustry, CMD_DEITY,                CMDT_LANDSCAPE_CONSTRUCTION)
 
DEF_CMD_TRAIT(CMD_INDUSTRY_CTRL,  CmdIndustryCtrl,  CMD_DEITY | CMD_STR_CTRL, CMDT_OTHER_MANAGEMENT)
 

	
 
CommandCallback CcBuildIndustry;
 
void CcBuildIndustry(Commands cmd, const CommandCost &result, TileIndex tile, IndustryType indtype, uint32, bool, uint32);
 

	
 
#endif /* INDUSTRY_CMD_H */
src/industry_gui.cpp
Show inline comments
 
@@ -222,13 +222,12 @@ void SortIndustryTypes()
 
 * @param cmd    Unused.
 
 * @param result Result of the command.
 
 * @param tile   Tile where the industry is placed.
 
 * @param data   Additional data of the #CMD_BUILD_INDUSTRY command.
 
 * @param indtype Industry type.
 
 */
 
void CcBuildIndustry(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &data)
 
void CcBuildIndustry(Commands cmd, const CommandCost &result, TileIndex tile, IndustryType indtype, uint32, bool, uint32)
 
{
 
	if (result.Succeeded()) return;
 

	
 
	auto [tile_, indtype, first_layout, fund, seed] = EndianBufferReader::ToValue<CommandTraits<CMD_BUILD_INDUSTRY>::Args>(data);
 
	if (indtype < NUM_INDUSTRYTYPES) {
 
		const IndustrySpec *indsp = GetIndustrySpec(indtype);
 
		if (indsp->enabled) {
src/main_gui.cpp
Show inline comments
 
@@ -77,7 +77,7 @@ bool HandlePlacePushButton(Window *w, in
 
}
 

	
 

	
 
void CcPlaySound_EXPLOSION(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &)
 
void CcPlaySound_EXPLOSION(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_12_EXPLOSION, tile);
 
}
src/network/network_command.cpp
Show inline comments
 
@@ -507,6 +507,13 @@ CommandDataBuffer SanitizeCmdStrings(con
 
	return EndianBufferWriter<CommandDataBuffer>::FromValue(args);
 
}
 

	
 

	
 
template <typename T> struct CallbackArgsHelper;
 
template <typename... Targs>
 
struct CallbackArgsHelper<void(* const)(Commands, const CommandCost &, Targs...)> {
 
	using Args = std::tuple<std::decay_t<Targs>...>;
 
};
 

	
 
/**
 
 * Unpack a generic command packet into its actual typed components.
 
 * @tparam Tcmd Command type to be unpacked.
 
@@ -517,5 +524,12 @@ template <Commands Tcmd, size_t Tcb>
 
void UnpackNetworkCommand(const CommandPacket* cp)
 
{
 
	auto args = EndianBufferReader::ToValue<typename CommandTraits<Tcmd>::Args>(cp->data);
 
	Command<Tcmd>::PostFromNet(cp->err_msg, std::get<Tcb>(_callback_tuple), cp->my_cmd, cp->tile, args);
 

	
 
	/* Check if the callback matches with the command arguments. If not, drop the callback. */
 
	using Tcallback = std::tuple_element_t<Tcb, decltype(_callback_tuple)>;
 
	if constexpr (std::is_same_v<Tcallback, CommandCallback * const> || std::is_same_v<Tcallback, CommandCallbackData * const> || std::is_same_v<typename CommandTraits<Tcmd>::Args, typename CallbackArgsHelper<Tcallback>::Args>) {
 
		Command<Tcmd>::PostFromNet(cp->err_msg, std::get<Tcb>(_callback_tuple), cp->my_cmd, cp->tile, args);
 
	} else {
 
		Command<Tcmd>::PostFromNet(cp->err_msg, (CommandCallback *)nullptr, cp->my_cmd, cp->tile, args);
 
	}
 
}
src/rail_cmd.h
Show inline comments
 
@@ -38,8 +38,8 @@ DEF_CMD_TRAIT(CMD_BUILD_SIGNAL_TRACK,   
 
DEF_CMD_TRAIT(CMD_REMOVE_SIGNAL_TRACK,   CmdRemoveSignalTrack,   CMD_AUTO,                CMDT_LANDSCAPE_CONSTRUCTION)
 

	
 
CommandCallback CcPlaySound_CONSTRUCTION_RAIL;
 
CommandCallback CcRailDepot;
 
CommandCallback CcStation;
 
CommandCallback CcBuildRailTunnel;
 
void CcRailDepot(Commands cmd, const CommandCost &result, TileIndex tile, RailType rt, DiagDirection dir);
 

	
 
#endif /* RAIL_CMD_H */
src/rail_gui.cpp
Show inline comments
 
@@ -89,7 +89,7 @@ static bool IsStationAvailable(const Sta
 
	return Convert8bitBooleanCallback(statspec->grf_prop.grffile, CBID_STATION_AVAILABILITY, cb_res);
 
}
 

	
 
void CcPlaySound_CONSTRUCTION_RAIL(Commands cmd, const CommandCost &result,TileIndex tile, const CommandDataBuffer &)
 
void CcPlaySound_CONSTRUCTION_RAIL(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_20_CONSTRUCTION_RAIL, tile);
 
}
 
@@ -135,12 +135,10 @@ static const DiagDirection _place_depot_
 
	DIAGDIR_NW, DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_NE,
 
};
 

	
 
void CcRailDepot(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &data)
 
void CcRailDepot(Commands cmd, const CommandCost &result, TileIndex tile, RailType rt, DiagDirection dir)
 
{
 
	if (result.Failed()) return;
 

	
 
	auto [tile_, rt, dir] = EndianBufferReader::ToValue<CommandTraits<CMD_BUILD_TRAIN_DEPOT>::Args>(data);
 

	
 
	if (_settings_client.sound.confirm) SndPlayTileFx(SND_20_CONSTRUCTION_RAIL, tile);
 
	if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 

	
 
@@ -176,7 +174,7 @@ static void PlaceRail_Waypoint(TileIndex
 
	}
 
}
 

	
 
void CcStation(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &)
 
void CcStation(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Failed()) return;
 

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

	
 
/** Command callback for building a tunnel */
 
void CcBuildRailTunnel(Commands cmd, const CommandCost &result,TileIndex tile, const CommandDataBuffer &)
 
void CcBuildRailTunnel(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Succeeded()) {
 
		if (_settings_client.sound.confirm) SndPlayTileFx(SND_20_CONSTRUCTION_RAIL, tile);
src/road_cmd.h
Show inline comments
 
@@ -31,7 +31,7 @@ DEF_CMD_TRAIT(CMD_CONVERT_ROAD,     CmdC
 

	
 
CommandCallback CcPlaySound_CONSTRUCTION_OTHER;
 
CommandCallback CcBuildRoadTunnel;
 
CommandCallback CcRoadDepot;
 
CommandCallback CcRoadStop;
 
void CcRoadDepot(Commands cmd, const CommandCost &result, TileIndex tile, RoadType rt, DiagDirection dir);
 
void CcRoadStop(Commands cmd, const CommandCost &result, TileIndex tile, uint8 width, uint8 length, RoadStopType, bool is_drive_through, DiagDirection dir, RoadType, StationID, bool);
 

	
 
#endif /* ROAD_CMD_H */
src/road_gui.cpp
Show inline comments
 
@@ -57,7 +57,7 @@ static RoadType _cur_roadtype;
 
static DiagDirection _road_depot_orientation;
 
static DiagDirection _road_station_picker_orientation;
 

	
 
void CcPlaySound_CONSTRUCTION_OTHER(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &)
 
void CcPlaySound_CONSTRUCTION_OTHER(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
 
}
 
@@ -84,7 +84,7 @@ static void PlaceRoad_Bridge(TileIndex t
 
 * @param result Whether the build succeeded.
 
 * @param start_tile Starting tile of the tunnel.
 
 */
 
void CcBuildRoadTunnel(Commands cmd, const CommandCost &result, TileIndex start_tile, const CommandDataBuffer &)
 
void CcBuildRoadTunnel(Commands cmd, const CommandCost &result, TileIndex start_tile)
 
{
 
	if (result.Succeeded()) {
 
		if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, start_tile);
 
@@ -117,12 +117,10 @@ void ConnectRoadToStructure(TileIndex ti
 
	}
 
}
 

	
 
void CcRoadDepot(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &data)
 
void CcRoadDepot(Commands cmd, const CommandCost &result, TileIndex tile, RoadType rt, DiagDirection dir)
 
{
 
	if (result.Failed()) return;
 

	
 
	auto [tile_, rt, dir] = EndianBufferReader::ToValue<CommandTraits<CMD_BUILD_ROAD_DEPOT>::Args>(data);
 

	
 
	if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
 
	if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
	ConnectRoadToStructure(tile, dir);
 
@@ -130,18 +128,19 @@ void CcRoadDepot(Commands cmd, const Com
 

	
 
/**
 
 * Command callback for building road stops.
 
 * @param cmd Unused.
 
 * @param result Result of the build road stop command.
 
 * @param cmd Unused.
 
 * @param tile Start tile.
 
 * @param data Command data.
 
 * @param width Width of the road stop.
 
 * @param length Length of the road stop.
 
 * @param is_drive_through False for normal stops, true for drive-through.
 
 * @param dir Entrance direction (#DiagDirection) for normal stops. Converted to the axis for drive-through stops.
 
 * @see CmdBuildRoadStop
 
 */
 
void CcRoadStop(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &data)
 
void CcRoadStop(Commands cmd, const CommandCost &result, TileIndex tile, uint8 width, uint8 length, RoadStopType, bool is_drive_through, DiagDirection dir, RoadType, StationID, bool)
 
{
 
	if (result.Failed()) return;
 

	
 
	auto [tile_, width, length, stop_type, is_drive_through, dir, rt, station_to_join, adjacent] = EndianBufferReader::ToValue<CommandTraits<CMD_BUILD_ROAD_STOP>::Args>(data);
 

	
 
	if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
 
	if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
	TileArea roadstop_area(tile, width, length);
src/script/api/script_object.cpp
Show inline comments
 
@@ -296,7 +296,7 @@ ScriptObject::ActiveInstance::~ActiveIns
 
	return GetStorage()->callback_value[index];
 
}
 

	
 
/* static */ CommandCallback *ScriptObject::GetDoCommandCallback()
 
/* static */ CommandCallbackData *ScriptObject::GetDoCommandCallback()
 
{
 
	return ScriptObject::GetActiveInstance()->GetDoCommandCallback();
 
}
src/script/api/script_object.hpp
Show inline comments
 
@@ -326,7 +326,7 @@ private:
 
	/* Helper functions for DoCommand. */
 
	static std::tuple<bool, bool, bool> DoCommandPrep();
 
	static bool DoCommandProcessResult(const CommandCost &res, Script_SuspendCallbackProc *callback, bool estimate_only);
 
	static CommandCallback *GetDoCommandCallback();
 
	static CommandCallbackData *GetDoCommandCallback();
 
};
 

	
 
namespace ScriptObjectInternal {
src/script/script_cmd.h
Show inline comments
 
@@ -12,7 +12,7 @@
 

	
 
#include "../command_type.h"
 

	
 
CommandCallback CcAI;
 
CommandCallback CcGame;
 
CommandCallbackData CcAI;
 
CommandCallbackData CcGame;
 

	
 
#endif /* SCRIPT_CMD_H */
src/script/script_instance.hpp
Show inline comments
 
@@ -235,7 +235,7 @@ protected:
 
	/**
 
	 * Get the callback handling DoCommands in case of networking.
 
	 */
 
	virtual CommandCallback *GetDoCommandCallback() = 0;
 
	virtual CommandCallbackData *GetDoCommandCallback() = 0;
 

	
 
	/**
 
	 * Load the dummy script.
src/signs_cmd.cpp
Show inline comments
 
@@ -105,14 +105,11 @@ CommandCost CmdRenameSign(DoCommandFlag 
 

	
 
/**
 
 * Callback function that is called after a sign is placed
 
 * @param cmd unused
 
 * @param result of the operation
 
 * @param cmd unused
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 unused
 
 * @param text unused
 
 */
 
void CcPlaceSign(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &)
 
void CcPlaceSign(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Failed()) return;
 

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

	
 
#include "safeguards.h"
 

	
 
void CcTerraform(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &)
 
void CcTerraform(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Succeeded()) {
 
		if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
src/town_gui.cpp
Show inline comments
 
@@ -1009,7 +1009,7 @@ void ShowTownDirectory()
 
	new TownDirectoryWindow(&_town_directory_desc);
 
}
 

	
 
void CcFoundTown(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &)
 
void CcFoundTown(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Failed()) return;
 

	
 
@@ -1017,7 +1017,7 @@ void CcFoundTown(Commands cmd, const Com
 
	if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
}
 

	
 
void CcFoundRandomTown(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &)
 
void CcFoundRandomTown(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Succeeded()) ScrollMainWindowToTile(Town::Get(_new_town_id)->xy);
 
}
src/train_gui.cpp
Show inline comments
 
@@ -26,7 +26,7 @@
 
 * @param result The result of the command.
 
 * @param tile   The tile the command was executed on.
 
 */
 
void CcBuildWagon(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &)
 
void CcBuildWagon(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Failed()) return;
 

	
src/tunnelbridge_cmd.h
Show inline comments
 
@@ -20,6 +20,6 @@ CommandCost CmdBuildTunnel(DoCommandFlag
 
DEF_CMD_TRAIT(CMD_BUILD_BRIDGE, CmdBuildBridge, CMD_DEITY | CMD_AUTO | CMD_NO_WATER, CMDT_LANDSCAPE_CONSTRUCTION)
 
DEF_CMD_TRAIT(CMD_BUILD_TUNNEL, CmdBuildTunnel, CMD_DEITY | CMD_AUTO,                CMDT_LANDSCAPE_CONSTRUCTION)
 

	
 
CommandCallback CcBuildBridge;
 
void CcBuildBridge(Commands cmd, const CommandCost &result, TileIndex end_tile, TileIndex tile_start, TransportType transport_type, BridgeType, byte);
 

	
 
#endif /* TUNNELBRIDGE_CMD_H */
src/vehicle_cmd.h
Show inline comments
 
@@ -40,7 +40,7 @@ DEF_CMD_TRAIT(CMD_DEPOT_SELL_ALL_VEHICLE
 
DEF_CMD_TRAIT(CMD_DEPOT_MASS_AUTOREPLACE,  CmdDepotMassAutoReplace, 0,             CMDT_VEHICLE_CONSTRUCTION)
 

	
 
CommandCallback CcBuildPrimaryVehicle;
 
CommandCallback CcStartStopVehicle;
 
void CcStartStopVehicle(Commands cmd, const CommandCost &result, VehicleID veh_id, bool);
 

	
 
template <typename Tcont, typename Titer>
 
inline EndianBufferWriter<Tcont, Titer> &operator <<(EndianBufferWriter<Tcont, Titer> &buffer, const VehicleListIdentifier &vli)
src/vehicle_gui.cpp
Show inline comments
 
@@ -2617,16 +2617,14 @@ static const StringID _vehicle_msg_trans
 

	
 
/**
 
 * This is the Callback method after attempting to start/stop a vehicle
 
 * @param cmd unused
 
 * @param result the result of the start/stop command
 
 * @param cmd unused
 
 * @param tile unused
 
 * @param data Command data
 
 * @param veh_id Vehicle ID.
 
 */
 
void CcStartStopVehicle(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &data)
 
void CcStartStopVehicle(Commands cmd, const CommandCost &result, VehicleID veh_id, bool)
 
{
 
	if (result.Failed()) return;
 

	
 
	VehicleID veh_id = std::get<0>(EndianBufferReader::ToValue<CommandTraits<CMD_START_STOP_VEHICLE>::Args>(data));
 
	const Vehicle *v = Vehicle::GetIfValid(veh_id);
 
	if (v == nullptr || !v->IsPrimaryVehicle() || v->owner != _local_company) return;
 

	
 
@@ -3124,9 +3122,8 @@ void StopGlobalFollowVehicle(const Vehic
 
 * @param result indicates completion (or not) of the operation
 
 * @param cmd unused
 
 * @param tile unused
 
 * @param data unused
 
 */
 
void CcBuildPrimaryVehicle(Commands cmd, const CommandCost &result, TileIndex tile, const CommandDataBuffer &data)
 
void CcBuildPrimaryVehicle(Commands cmd, const CommandCost &result, TileIndex tile)
 
{
 
	if (result.Failed()) return;
 

	
0 comments (0 inline, 0 general)