Changeset - r14220:2b66d13ca715
[Not reviewed]
master
0 25 0
rubidium - 14 years ago 2010-01-11 18:46:09
rubidium@openttd.org
(svn r18781) -Codechange: pass the CommandCost to the callback instead of whether it succeeded or not.
-Fix: AIs did update their last cost incorrectly in network games if the cost of the DC_EXEC phase differed from the ~DC_EXEC phase.
25 files changed with 137 insertions and 150 deletions:
0 comments (0 inline, 0 general)
src/ai/ai.hpp
Show inline comments
 
@@ -20,8 +20,6 @@
 
typedef std::map<const char *, class AIInfo *, StringCompare> AIInfoList;
 

	
 

	
 
void CcAI(bool success, TileIndex tile, uint32 p1, uint32 p2);
 

	
 
class AI {
 
public:
 
	/**
src/ai/ai_core.cpp
Show inline comments
 
@@ -218,14 +218,15 @@
 
	event->Release();
 
}
 

	
 
void CcAI(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcAI(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	AIObject::SetLastCommandRes(success);
 
	AIObject::SetLastCommandRes(result.Succeeded());
 

	
 
	if (!success) {
 
		AIObject::SetLastError(AIError::StringToError(_error_message));
 
	if (result.Failed()) {
 
		AIObject::SetLastError(AIError::StringToError(result.GetErrorMessage()));
 
	} else {
 
		AIObject::IncreaseDoCommandCosts(AIObject::GetLastCost());
 
		AIObject::IncreaseDoCommandCosts(result.GetCost());
 
		AIObject::SetLastCost(result.GetCost());
 
	}
 

	
 
	Company::Get(_current_company)->ai_instance->Continue();
src/ai/api/ai_object.hpp
Show inline comments
 
@@ -36,7 +36,7 @@ typedef bool (AIModeProc)();
 
 *   command processing, and command-validation checks.
 
 */
 
class AIObject : public SimpleCountedObject {
 
friend void CcAI(bool success, TileIndex tile, uint32 p1, uint32 p2);
 
friend void CcAI(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2);
 
friend class AIInstance;
 
protected:
 
	/**
src/airport_gui.cpp
Show inline comments
 
@@ -31,12 +31,12 @@ static byte _selected_airport_type;
 
static void ShowBuildAirportPicker(Window *parent);
 

	
 

	
 
void CcBuildAirport(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcBuildAirport(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) {
 
		SndPlayTileFx(SND_1F_SPLAT, tile);
 
		if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
	}
 
	if (result.Failed()) return;
 

	
 
	SndPlayTileFx(SND_1F_SPLAT, tile);
 
	if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
}
 

	
 
static void PlaceAirport(TileIndex tile)
src/bridge_gui.cpp
Show inline comments
 
@@ -44,14 +44,14 @@ typedef GUIList<BuildBridgeData> GUIBrid
 
/**
 
 * Callback executed after a build Bridge CMD has been called
 
 *
 
 * @param success True if the build succeded
 
 * @param result Whether the build succeded
 
 * @param tile The tile where the command has been executed
 
 * @param p1 not used
 
 * @param p2 not used
 
 */
 
void CcBuildBridge(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcBuildBridge(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) SndPlayTileFx(SND_27_BLACKSMITH_ANVIL, tile);
 
	if (result.Succeeded()) SndPlayTileFx(SND_27_BLACKSMITH_ANVIL, tile);
 
}
 

	
 
/* Names of the build bridge selection window */
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -1034,7 +1034,7 @@ struct BuildVehicleWindow : Window {
 
			case BUILD_VEHICLE_WIDGET_BUILD: {
 
				EngineID sel_eng = this->sel_engine;
 
				if (sel_eng != INVALID_ENGINE) {
 
					CommandCallback *callback = (this->vehicle_type == VEH_TRAIN && RailVehInfo(sel_eng)->railveh_type == RAILVEH_WAGON) ? CcBuildWagon : CcBuildPrimaryVehicle;
 
					CommandCallback *callback = (this->vehicle_type == VEH_TRAIN && RailVehInfo(sel_eng)->railveh_type == RAILVEH_WAGON) ? NULL : CcBuildPrimaryVehicle;
 
					DoCommandP(this->window_number, sel_eng, 0, GetCmdBuildVeh(this->vehicle_type), callback);
 
				}
 
				break;
src/callback_table.cpp
Show inline comments
 
@@ -11,58 +11,12 @@
 

	
 
#include "stdafx.h"
 
#include "callback_table.h"
 
#include "command_type.h"
 
#include "command_func.h"
 

	
 
/* If you add a callback for DoCommandP, also add the callback in here
 
 *   see below for the full list!
 
 * If you don't do it, it won't work across the network!! */
 

	
 
/* ai/ai_core.cpp */
 
CommandCallback CcAI;
 

	
 
/* airport_gui.cpp */
 
CommandCallback CcBuildAirport;
 

	
 
/* bridge_gui.cpp */
 
CommandCallback CcBuildBridge;
 

	
 
/* dock_gui.cpp */
 
CommandCallback CcBuildDocks;
 
CommandCallback CcBuildCanal;
 

	
 
/* depot_gui.cpp */
 
CommandCallback CcCloneVehicle;
 

	
 
/* group_gui.cpp */
 
CommandCallback CcCreateGroup;
 

	
 
/* main_gui.cpp */
 
CommandCallback CcPlaySound10;
 
CommandCallback CcPlaceSign;
 
CommandCallback CcTerraform;
 
CommandCallback CcGiveMoney;
 

	
 
/* rail_gui.cpp */
 
CommandCallback CcPlaySound1E;
 
CommandCallback CcRailDepot;
 
CommandCallback CcStation;
 
CommandCallback CcBuildRailTunnel;
 

	
 
/* road_gui.cpp */
 
CommandCallback CcPlaySound1D;
 
CommandCallback CcBuildRoadTunnel;
 
CommandCallback CcRoadDepot;
 

	
 
/* train_gui.cpp */
 
CommandCallback CcBuildWagon;
 

	
 
/* town_gui.cpp */
 
CommandCallback CcFoundTown;
 
CommandCallback CcFoundRandomTown;
 

	
 
/* vehicle_gui.cpp */
 
CommandCallback CcBuildPrimaryVehicle;
 

	
 
CommandCallback * const _callback_table[] = {
 
	/* 0x00 */ NULL,
 
	/* 0x01 */ CcBuildPrimaryVehicle,
src/command.cpp
Show inline comments
 
@@ -635,7 +635,7 @@ bool DoCommandP(TileIndex tile, uint32 p
 

	
 
	_docommand_recursive = 0;
 

	
 
	if (callback) callback(true, tile, p1, p2);
 
	if (callback) callback(res2, tile, p1, p2);
 
	ClearStorageChanges(true);
 
	return true;
 

	
 
@@ -648,7 +648,7 @@ show_error:
 
callb_err:
 
	_docommand_recursive = 0;
 

	
 
	if (callback) callback(false, tile, p1, p2);
 
	if (callback) callback(CMD_ERROR, tile, p1, p2);
 
	ClearStorageChanges(false);
 
	return false;
 
}
src/command_func.h
Show inline comments
 
@@ -107,6 +107,52 @@ static inline DoCommandFlag CommandFlags
 
	return flags;
 
}
 

	
 
/*** All command callbacks that exist ***/
 

	
 
/* ai/ai_core.cpp */
 
CommandCallback CcAI;
 

	
 
/* airport_gui.cpp */
 
CommandCallback CcBuildAirport;
 

	
 
/* bridge_gui.cpp */
 
CommandCallback CcBuildBridge;
 

	
 
/* dock_gui.cpp */
 
CommandCallback CcBuildDocks;
 
CommandCallback CcBuildCanal;
 

	
 
/* depot_gui.cpp */
 
CommandCallback CcCloneVehicle;
 

	
 
/* group_gui.cpp */
 
CommandCallback CcCreateGroup;
 

	
 
/* main_gui.cpp */
 
CommandCallback CcPlaySound10;
 
CommandCallback CcPlaceSign;
 
CommandCallback CcTerraform;
 
CommandCallback CcGiveMoney;
 

	
 
/* rail_gui.cpp */
 
CommandCallback CcPlaySound1E;
 
CommandCallback CcRailDepot;
 
CommandCallback CcStation;
 
CommandCallback CcBuildRailTunnel;
 

	
 
/* road_gui.cpp */
 
CommandCallback CcPlaySound1D;
 
CommandCallback CcBuildRoadTunnel;
 
CommandCallback CcRoadDepot;
 

	
 
/* train_gui.cpp */
 
CommandCallback CcBuildWagon;
 

	
 
/* town_gui.cpp */
 
CommandCallback CcFoundTown;
 
CommandCallback CcFoundRandomTown;
 

	
 
/* vehicle_gui.cpp */
 
CommandCallback CcBuildPrimaryVehicle;
 

	
 
#endif /* COMMAND_FUNC_H */
src/command_type.h
Show inline comments
 
@@ -392,13 +392,13 @@ struct Command {
 
 * are from the #CommandProc callback type. The boolean parameter indicates if the
 
 * command succeeded or failed.
 
 *
 
 * @param success If the command succeeded or not.
 
 * @param result The result of the executed command
 
 * @param tile The tile of the command action
 
 * @param p1 Additional data of the command
 
 * @param p1 Additional data of the command
 
 * @see CommandProc
 
 */
 
typedef void CommandCallback(bool success, TileIndex tile, uint32 p1, uint32 p2);
 
typedef void CommandCallback(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2);
 

	
 
/**
 
 * Structure for buffering the build command when selecting a station to join.
src/depot_gui.cpp
Show inline comments
 
@@ -121,14 +121,14 @@ extern void DepotSortList(VehicleList *l
 

	
 
/**
 
 * This is the Callback method after the cloning attempt of a vehicle
 
 * @param success indicates completion (or not) of the operation
 
 * @param result the result of the cloning command
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 unused
 
 */
 
void CcCloneVehicle(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcCloneVehicle(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (!success) return;
 
	if (result.Failed()) return;
 

	
 
	const Vehicle *v = Vehicle::Get(_new_vehicle_id);
 

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

	
 
static Axis _ship_depot_direction;
 

	
 
void CcBuildDocks(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcBuildDocks(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) {
 
		SndPlayTileFx(SND_02_SPLAT, tile);
 
		if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
	}
 
	if (result.Failed()) return;
 

	
 
	SndPlayTileFx(SND_02_SPLAT, tile);
 
	if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
}
 

	
 
void CcBuildCanal(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcBuildCanal(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) SndPlayTileFx(SND_02_SPLAT, tile);
 
	if (result.Succeeded()) SndPlayTileFx(SND_02_SPLAT, tile);
 
}
 

	
 

	
 
@@ -218,7 +218,6 @@ struct BuildDocksToolbarWindow : Window 
 
			switch (select_proc) {
 
				case DDSP_BUILD_BRIDGE:
 
					if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
					extern void CcBuildBridge(bool success, TileIndex tile, uint32 p1, uint32 p2);
 
					DoCommandP(end_tile, start_tile, TRANSPORT_WATER << 15, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_AQUEDUCT_HERE), CcBuildBridge);
 

	
 
				case DDSP_DEMOLISH_AREA:
src/group_gui.cpp
Show inline comments
 
@@ -485,7 +485,6 @@ public:
 
			}
 

	
 
			case GRP_WIDGET_CREATE_GROUP: { // Create a new group
 
				extern void CcCreateGroup(bool success, TileIndex tile, uint32 p1, uint32 p2);
 
				DoCommandP(0, this->vehicle_type, 0, CMD_CREATE_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_CREATE), CcCreateGroup);
 
				break;
 
			}
 
@@ -725,9 +724,9 @@ static inline VehicleGroupWindow *FindVe
 
 * @param p2 unused
 
 * @see CmdCreateGroup
 
 */
 
void CcCreateGroup(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcCreateGroup(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (!success) return;
 
	if (result.Failed()) return;
 
	assert(p1 <= VEH_AIRCRAFT);
 

	
 
	VehicleGroupWindow *w = FindVehicleGroupWindow((VehicleType)p1, _current_company);
src/gui.h
Show inline comments
 
@@ -21,8 +21,6 @@
 
#include "transport_type.h"
 

	
 
/* main_gui.cpp */
 
void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2);
 
void CcBuildCanal(bool success, TileIndex tile, uint32 p1, uint32 p2);
 
void HandleOnEditText(const char *str);
 
void InitializeGUI();
 

	
src/main_gui.cpp
Show inline comments
 
@@ -43,10 +43,10 @@
 
static int _rename_id = 1;
 
static int _rename_what = -1;
 

	
 
void CcGiveMoney(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcGiveMoney(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
#ifdef ENABLE_NETWORK
 
	if (!success || !_settings_game.economy.give_money) return;
 
	if (result.Failed() || !_settings_game.economy.give_money) return;
 

	
 
	/* Inform the company of the action of one of it's clients (controllers). */
 
	char msg[64];
 
@@ -112,9 +112,9 @@ bool HandlePlacePushButton(Window *w, in
 
}
 

	
 

	
 
void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcPlaySound10(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) SndPlayTileFx(SND_12_EXPLOSION, tile);
 
	if (result.Succeeded()) SndPlayTileFx(SND_12_EXPLOSION, tile);
 
}
 

	
 
#ifdef ENABLE_NETWORK
src/rail_gui.cpp
Show inline comments
 
@@ -66,9 +66,9 @@ static void ShowBuildWaypointPicker(Wind
 
static void ShowStationBuilder(Window *parent);
 
static void ShowSignalBuilder(Window *parent);
 

	
 
void CcPlaySound1E(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcPlaySound1E(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) SndPlayTileFx(SND_20_SPLAT_2, tile);
 
	if (result.Succeeded()) SndPlayTileFx(SND_20_SPLAT_2, tile);
 
}
 

	
 
static void GenericPlaceRail(TileIndex tile, int cmd)
 
@@ -128,21 +128,21 @@ static const uint16 _place_depot_extra[1
 
};
 

	
 

	
 
void CcRailDepot(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcRailDepot(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) {
 
		DiagDirection dir = (DiagDirection)p2;
 
	if (result.Failed()) return;
 

	
 
		SndPlayTileFx(SND_20_SPLAT_2, tile);
 
		if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
	DiagDirection dir = (DiagDirection)p2;
 

	
 
		tile += TileOffsByDiagDir(dir);
 
	SndPlayTileFx(SND_20_SPLAT_2, tile);
 
	if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 

	
 
	tile += TileOffsByDiagDir(dir);
 

	
 
		if (IsTileType(tile, MP_RAILWAY)) {
 
			PlaceExtraDepotRail(tile, _place_depot_extra[dir]);
 
			PlaceExtraDepotRail(tile, _place_depot_extra[dir + 4]);
 
			PlaceExtraDepotRail(tile, _place_depot_extra[dir + 8]);
 
		}
 
	if (IsTileType(tile, MP_RAILWAY)) {
 
		PlaceExtraDepotRail(tile, _place_depot_extra[dir]);
 
		PlaceExtraDepotRail(tile, _place_depot_extra[dir + 4]);
 
		PlaceExtraDepotRail(tile, _place_depot_extra[dir + 8]);
 
	}
 
}
 

	
 
@@ -171,13 +171,13 @@ static void PlaceRail_Waypoint(TileIndex
 
	}
 
}
 

	
 
void CcStation(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcStation(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) {
 
		SndPlayTileFx(SND_20_SPLAT_2, tile);
 
		/* Only close the station builder window if the default station and non persistent building is chosen. */
 
		if (_railstation.station_class == STAT_CLASS_DFLT && _railstation.station_type == 0 && !_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
	}
 
	if (result.Failed()) return;
 

	
 
	SndPlayTileFx(SND_20_SPLAT_2, tile);
 
	/* Only close the station builder window if the default station and non persistent building is chosen. */
 
	if (_railstation.station_class == STAT_CLASS_DFLT && _railstation.station_type == 0 && !_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
}
 

	
 
static void PlaceRail_Station(TileIndex tile)
 
@@ -258,9 +258,9 @@ static void PlaceRail_Bridge(TileIndex t
 
}
 

	
 
/** Command callback for building a tunnel */
 
void CcBuildRailTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcBuildRailTunnel(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) {
 
	if (result.Succeeded()) {
 
		SndPlayTileFx(SND_20_SPLAT_2, tile);
 
		if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
	} else {
src/road_gui.cpp
Show inline comments
 
@@ -62,9 +62,9 @@ static RoadType _cur_roadtype;
 
static DiagDirection _road_depot_orientation;
 
static DiagDirection _road_station_picker_orientation;
 

	
 
void CcPlaySound1D(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcPlaySound1D(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) SndPlayTileFx(SND_1F_SPLAT, tile);
 
	if (result.Succeeded()) SndPlayTileFx(SND_1F_SPLAT, tile);
 
}
 

	
 
/**
 
@@ -119,9 +119,9 @@ static void PlaceRoad_Bridge(TileIndex t
 
}
 

	
 

	
 
void CcBuildRoadTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcBuildRoadTunnel(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) {
 
	if (result.Succeeded()) {
 
		SndPlayTileFx(SND_20_SPLAT_2, tile);
 
		if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
	} else {
 
@@ -191,16 +191,16 @@ static void BuildRoadOutsideStation(Tile
 
	}
 
}
 

	
 
void CcRoadDepot(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcRoadDepot(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) {
 
		DiagDirection dir = (DiagDirection)GB(p1, 0, 2);
 
		SndPlayTileFx(SND_1F_SPLAT, tile);
 
		if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
		BuildRoadOutsideStation(tile, dir);
 
		/* For a drive-through road stop build connecting road for other entrance */
 
		if (HasBit(p2, 1)) BuildRoadOutsideStation(tile, ReverseDiagDir(dir));
 
	}
 
	if (result.Failed()) return;
 

	
 
	DiagDirection dir = (DiagDirection)GB(p1, 0, 2);
 
	SndPlayTileFx(SND_1F_SPLAT, tile);
 
	if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
	BuildRoadOutsideStation(tile, dir);
 
	/* For a drive-through road stop build connecting road for other entrance */
 
	if (HasBit(p2, 1)) BuildRoadOutsideStation(tile, ReverseDiagDir(dir));
 
}
 

	
 
static void PlaceRoad_Depot(TileIndex tile)
src/signs_cmd.cpp
Show inline comments
 
@@ -105,17 +105,17 @@ CommandCost CmdRenameSign(TileIndex tile
 

	
 
/**
 
 * Callback function that is called after a sign is placed
 
 * @param success of the operation
 
 * @param result of the operation
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 unused
 
 */
 
void CcPlaceSign(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcPlaceSign(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) {
 
		ShowRenameSignWindow(Sign::Get(_new_sign_id));
 
		ResetObjectToPlace();
 
	}
 
	if (result.Failed()) return;
 

	
 
	ShowRenameSignWindow(Sign::Get(_new_sign_id));
 
	ResetObjectToPlace();
 
}
 

	
 
/**
src/terraform_gui.cpp
Show inline comments
 
@@ -36,9 +36,9 @@
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
void CcTerraform(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcTerraform(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) {
 
	if (result.Succeeded()) {
 
		SndPlayTileFx(SND_1F_SPLAT, tile);
 
	} else {
 
		extern TileIndex _terraform_err_tile;
 
@@ -145,8 +145,6 @@ static const uint16 _terraform_keycodes[
 
	'O',
 
};
 

	
 
void CcPlaySound1E(bool success, TileIndex tile, uint32 p1, uint32 p2);
 

	
 
static void PlaceProc_BuyLand(TileIndex tile)
 
{
 
	DoCommandP(tile, 0, 0, CMD_PURCHASE_LAND_AREA | CMD_MSG(STR_ERROR_CAN_T_PURCHASE_THIS_LAND), CcPlaySound1E);
src/terraform_gui.h
Show inline comments
 
@@ -14,8 +14,6 @@
 

	
 
#include "window_type.h"
 

	
 
void CcTerraform(bool success, TileIndex tile, uint32 p1, uint32 p2);
 

	
 
Window *ShowTerraformToolbar(Window *link = NULL);
 
void ShowTerraformToolbarWithTool(uint16 key, uint16 keycode);
 
Window *ShowEditorTerraformToolbar();
src/town_gui.cpp
Show inline comments
 
@@ -885,17 +885,17 @@ void ShowTownDirectory()
 
	new TownDirectoryWindow(&_town_directory_desc);
 
}
 

	
 
void CcFoundTown(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcFoundTown(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) {
 
		SndPlayTileFx(SND_1F_SPLAT, tile);
 
		if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
	}
 
	if (result.Failed()) return;
 

	
 
	SndPlayTileFx(SND_1F_SPLAT, tile);
 
	if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
 
}
 

	
 
void CcFoundRandomTown(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcFoundRandomTown(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) ScrollMainWindowToTile(Town::Get(_new_town_id)->xy);
 
	if (result.Succeeded()) ScrollMainWindowToTile(Town::Get(_new_town_id)->xy);
 
}
 

	
 
/** Widget numbers of town scenario editor window. */
src/train.h
Show inline comments
 
@@ -44,8 +44,6 @@ enum VehicleRailFlags {
 
	VRF_TRAIN_STUCK    = 8,
 
};
 

	
 
void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2);
 

	
 
byte FreightWagonMult(CargoID cargo);
 

	
 
void UpdateTrainAcceleration(Train *v);
src/train_gui.cpp
Show inline comments
 
@@ -23,9 +23,9 @@
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcBuildWagon(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (!success) return;
 
	if (result.Failed()) return;
 

	
 
	/* find a locomotive in the depot. */
 
	const Vehicle *found = NULL;
src/vehicle_func.h
Show inline comments
 
@@ -65,8 +65,6 @@ void VehicleEnterDepot(Vehicle *v);
 

	
 
bool CanBuildVehicleInfrastructure(VehicleType type);
 

	
 
void CcCloneVehicle(bool success, TileIndex tile, uint32 p1, uint32 p2);
 

	
 
/** Position information of a vehicle after it moved */
 
struct GetNewVehiclePosResult {
 
	int x, y;  ///< x and y position of the vehicle after moving
src/vehicle_gui.cpp
Show inline comments
 
@@ -2145,14 +2145,14 @@ void StopGlobalFollowVehicle(const Vehic
 

	
 
/**
 
 * This is the Callback method after the construction attempt of a primary vehicle
 
 * @param success indicates completion (or not) of the operation
 
 * @param result indicates completion (or not) of the operation
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 unused
 
 */
 
void CcBuildPrimaryVehicle(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
void CcBuildPrimaryVehicle(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (!success) return;
 
	if (result.Failed()) return;
 

	
 
	const Vehicle *v = Vehicle::Get(_new_vehicle_id);
 
	if (v->tile == _backup_orders_tile) {
0 comments (0 inline, 0 general)