Changeset - r22007:58dd28c3d424
[Not reviewed]
master
0 6 0
frosch - 10 years ago 2015-02-22 15:26:27
frosch@openttd.org
(svn r27163) -Fix [FS#6204]: Toolbars were not invalidated when changing max-vehicles settings. (adf88)
6 files changed with 51 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/airport_gui.cpp
Show inline comments
 
@@ -79,12 +79,24 @@ struct BuildAirToolbarWindow : Window {
 

	
 
	~BuildAirToolbarWindow()
 
	{
 
		if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
 
	}
 

	
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 

	
 
		if (!CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) delete this;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case WID_AT_AIRPORT:
 
				if (HandlePlacePushButton(this, WID_AT_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) {
 
					ShowBuildAirportPicker(this);
src/dock_gui.cpp
Show inline comments
 
@@ -113,17 +113,23 @@ struct BuildDocksToolbarWindow : Window 
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_SHIP),
 

	
 
		bool can_build = CanBuildVehicleInfrastructure(VEH_SHIP);
 
		this->SetWidgetsDisabledState(!can_build,
 
			WID_DT_DEPOT,
 
			WID_DT_STATION,
 
			WID_DT_BUOY,
 
			WIDGET_LIST_END);
 
		if (!can_build) {
 
			DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
 
			DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case WID_DT_CANAL: // Build canal button
src/rail_gui.cpp
Show inline comments
 
@@ -432,12 +432,24 @@ struct BuildRailToolbarWindow : Window {
 
	~BuildRailToolbarWindow()
 
	{
 
		if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
 
	}
 

	
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 

	
 
		if (!CanBuildVehicleInfrastructure(VEH_TRAIN)) delete this;
 
	}
 

	
 
	/**
 
	 * Configures the rail toolbar for railtype given
 
	 * @param railtype the railtype to display
 
	 */
 
	void SetupRailToolbar(RailType railtype)
 
	{
 
		this->railtype = railtype;
src/road_gui.cpp
Show inline comments
 
@@ -335,17 +335,24 @@ struct BuildRoadToolbarWindow : Window {
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_ROAD),
 

	
 
		bool can_build = CanBuildVehicleInfrastructure(VEH_ROAD);
 
		this->SetWidgetsDisabledState(!can_build,
 
				WID_ROT_DEPOT,
 
				WID_ROT_BUS_STATION,
 
				WID_ROT_TRUCK_STATION,
 
				WIDGET_LIST_END);
 
		if (!can_build) {
 
			DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD);
 
			DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
 
			DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
 
		}
 
	}
 

	
 
	/**
 
	 * Update the remove button lowered state of the road toolbar
 
	 *
 
	 * @param clicked_widget The widget which the client clicked just now
src/settings.cpp
Show inline comments
 
@@ -1301,12 +1301,19 @@ static bool ChangeMaxHeightLevel(int32 p
 
static bool StationCatchmentChanged(int32 p1)
 
{
 
	Station::RecomputeIndustriesNearForAll();
 
	return true;
 
}
 

	
 
static bool MaxVehiclesChanged(int32 p1)
 
{
 
	InvalidateWindowClassesData(WC_BUILD_TOOLBAR);
 
	MarkWholeScreenDirty();
 
	return true;
 
}
 

	
 

	
 
#ifdef ENABLE_NETWORK
 

	
 
static bool UpdateClientName(int32 p1)
 
{
 
	NetworkUpdateClientName();
src/table/settings.ini
Show inline comments
 
@@ -38,12 +38,13 @@ static bool InvalidateNewGRFChangeWindow
 
static bool InvalidateIndustryViewWindow(int32 p1);
 
static bool InvalidateAISettingsWindow(int32 p1);
 
static bool RedrawTownAuthority(int32 p1);
 
static bool InvalidateCompanyInfrastructureWindow(int32 p1);
 
static bool InvalidateCompanyWindow(int32 p1);
 
static bool ZoomMinMaxChanged(int32 p1);
 
static bool MaxVehiclesChanged(int32 p1);
 

	
 
#ifdef ENABLE_NETWORK
 
static bool UpdateClientName(int32 p1);
 
static bool UpdateServerPassword(int32 p1);
 
static bool UpdateRconPassword(int32 p1);
 
static bool UpdateClientConfigValues(int32 p1);
 
@@ -958,52 +959,52 @@ type     = SLE_UINT16
 
def      = 500
 
min      = 0
 
max      = 5000
 
str      = STR_CONFIG_SETTING_MAX_TRAINS
 
strhelp  = STR_CONFIG_SETTING_MAX_TRAINS_HELPTEXT
 
strval   = STR_JUST_COMMA
 
proc     = RedrawScreen
 
proc     = MaxVehiclesChanged
 
cat      = SC_BASIC
 

	
 
[SDT_VAR]
 
base     = GameSettings
 
var      = vehicle.max_roadveh
 
type     = SLE_UINT16
 
def      = 500
 
min      = 0
 
max      = 5000
 
str      = STR_CONFIG_SETTING_MAX_ROAD_VEHICLES
 
strhelp  = STR_CONFIG_SETTING_MAX_ROAD_VEHICLES_HELPTEXT
 
strval   = STR_JUST_COMMA
 
proc     = RedrawScreen
 
proc     = MaxVehiclesChanged
 
cat      = SC_BASIC
 

	
 
[SDT_VAR]
 
base     = GameSettings
 
var      = vehicle.max_aircraft
 
type     = SLE_UINT16
 
def      = 200
 
min      = 0
 
max      = 5000
 
str      = STR_CONFIG_SETTING_MAX_AIRCRAFT
 
strhelp  = STR_CONFIG_SETTING_MAX_AIRCRAFT_HELPTEXT
 
strval   = STR_JUST_COMMA
 
proc     = RedrawScreen
 
proc     = MaxVehiclesChanged
 
cat      = SC_BASIC
 

	
 
[SDT_VAR]
 
base     = GameSettings
 
var      = vehicle.max_ships
 
type     = SLE_UINT16
 
def      = 300
 
min      = 0
 
max      = 5000
 
str      = STR_CONFIG_SETTING_MAX_SHIPS
 
strhelp  = STR_CONFIG_SETTING_MAX_SHIPS_HELPTEXT
 
strval   = STR_JUST_COMMA
 
proc     = RedrawScreen
 
proc     = MaxVehiclesChanged
 
cat      = SC_BASIC
 

	
 
[SDTG_BOOL]
 
name     = NULL
 
guiflags = SGF_NO_NETWORK
 
var      = _old_vds.servint_ispercent
0 comments (0 inline, 0 general)