(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().

pull/155/head
frosch 13 years ago
parent 5cab5203f5
commit 4b4a40a72e

@ -182,8 +182,14 @@ struct AIListWindow : public Window {
nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
virtual void OnInvalidateData(int data)
/**
* 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 (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) {
delete this;
return;
@ -437,8 +443,14 @@ struct AISettingsWindow : public Window {
}
}
virtual void OnInvalidateData(int data)
/**
* 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 (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) delete this;
}
};
@ -692,8 +704,14 @@ struct AIConfigWindow : public Window {
}
}
virtual void OnInvalidateData(int data)
/**
* 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 (!IsEditable(this->selected_slot)) {
this->selected_slot = INVALID_COMPANY;
}
@ -1032,8 +1050,14 @@ struct AIDebugWindow : public QueryStringBaseWindow {
return state;
}
virtual void OnInvalidateData(int data = 0)
/**
* 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 (data == -1 || ai_debug_company == data) this->SetDirty();
if (data == -2) {

@ -491,8 +491,14 @@ public:
this->GetWidget<NWidgetCore>(RVW_WIDGET_RIGHT_MATRIX)->widget_data = (this->vscroll[0]->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
virtual void OnInvalidateData(int data)
/**
* 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 (data != 0) {
this->engines[0].ForceRebuild();
} else {

@ -1218,8 +1218,14 @@ struct BuildVehicleWindow : Window {
}
}
virtual void OnInvalidateData(int data)
/**
* 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;
/* When switching to original acceleration model for road vehicles, clear the selected sort criteria if it is not available now. */
if (this->vehicle_type == VEH_ROAD &&
_settings_game.vehicle.roadveh_acceleration_model == AM_ORIGINAL &&

@ -800,8 +800,14 @@ public:
}
}
virtual void OnInvalidateData(int data = 0)
/**
* 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;
this->SetWidgetsDisabledState(true, SCLW_WIDGET_CLASS_RAIL, SCLW_WIDGET_CLASS_ROAD, SCLW_WIDGET_CLASS_SHIP, SCLW_WIDGET_CLASS_AIRCRAFT, WIDGET_LIST_END);
bool current_class_valid = this->livery_class == LC_OTHER;

@ -635,8 +635,14 @@ struct DepotWindow : Window {
}
}
virtual void OnInvalidateData(int data)
/**
* 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;
this->generate_list = true;
}

@ -119,8 +119,14 @@ struct BuildDocksToolbarWindow : Window {
if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
}
void OnInvalidateData(int data = 0)
/**
* 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;
this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_SHIP),
DTW_DEPOT,
DTW_STATION,

@ -659,8 +659,14 @@ public:
this->vscroll->SetCapacityFromWidget(this, SLWW_DRIVES_DIRECTORIES_LIST);
}
virtual void OnInvalidateData(int data)
/**
* 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;
switch (data) {
case 0:
/* Rescan files */

@ -425,8 +425,14 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
}
}
virtual void OnInvalidateData(int data = 0)
/**
* 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;
/* Update the climate buttons */
this->SetWidgetLoweredState(GLAND_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
this->SetWidgetLoweredState(GLAND_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC);

@ -91,8 +91,14 @@ struct GraphLegendWindow : Window {
InvalidateWindowData(WC_COMPANY_VALUE, 0);
}
virtual void OnInvalidateData(int data)
/**
* 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 (Company::IsValidID(data)) return;
SetBit(_legend_excluded_companies, data);
@ -543,8 +549,14 @@ public:
this->UpdateStatistics(false);
}
virtual void OnInvalidateData(int data)
/**
* 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;
this->UpdateStatistics(true);
}
@ -1013,8 +1025,14 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
/* Override default OnTick */
}
virtual void OnInvalidateData(int data)
/**
* 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;
this->OnHundredthTick();
}
@ -1247,8 +1265,14 @@ public:
}
}
virtual void OnInvalidateData(int data)
/**
* 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 (data == 0) {
this->companies.ForceRebuild();
} else {
@ -1488,11 +1512,13 @@ struct PerformanceRatingDetailWindow : Window {
}
/**
* Invalidate the data of this window.
* Some data on this window has become invalid.
* @param data the company ID of the company that is going to be removed
* @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)
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
if (!gui_scope) return;
/* Disable the companies who are not active */
for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) {
this->SetWidgetDisabledState(i + PRW_COMPANY_FIRST, !Company::IsValidID(i));

@ -253,8 +253,14 @@ public:
}
}
virtual void OnInvalidateData(int data)
/**
* 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;
/* We can only set the trigger for resorting/rebuilding.
* We cannot safely resort at this point, as there might be multiple scheduled invalidations,
* and a rebuild needs to be done first though it is scheduled later. */

@ -597,8 +597,14 @@ public:
this->RaiseButtons();
}
virtual void OnInvalidateData(int data = 0)
/**
* 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;
this->SetupArrays();
const IndustrySpec *indsp = (this->selected_type == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(this->selected_type);
@ -947,8 +953,14 @@ public:
this->SetDirty();
}
virtual void OnInvalidateData(int data)
/**
* 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;
const Industry *i = Industry::Get(this->window_number);
if (IsProductionAlterable(i)) {
const IndustrySpec *ind = GetIndustrySpec(i->type);
@ -1346,8 +1358,14 @@ public:
this->BuildSortIndustriesList();
}
virtual void OnInvalidateData(int data)
/**
* 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;
/* We can only set the trigger for resorting/rebuilding.
* We cannot safely resort at this point, as there might be multiple scheduled invalidations,
* and a rebuild needs to be done first though it is scheduled later. */
@ -2394,13 +2412,15 @@ struct IndustryCargoesWindow : public Window {
}
/**
* Notify the window about external events.
* Some data on this window has become invalid.
* @param data Information about the changed data.
* - data = 0 .. NUM_INDUSTRYTYPES - 1: Display the chain around the given industry.
* - data = NUM_INDUSTRYTYPES: Stop sending updates to the smallmap window.
* @param data The event.
* @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)
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
if (!gui_scope) return;
if (data == NUM_INDUSTRYTYPES) {
if (this->IsWidgetLowered(ICW_NOTIFY)) {
this->RaiseWidget(ICW_NOTIFY);

@ -55,8 +55,14 @@ struct SelectGameWindow : public Window {
this->OnInvalidateData();
}
virtual void OnInvalidateData(int data = 0)
/**
* 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;
this->SetWidgetLoweredState(SGI_TEMPERATE_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
this->SetWidgetLoweredState(SGI_ARCTIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_ARCTIC);
this->SetWidgetLoweredState(SGI_TROPIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TROPIC);

@ -432,8 +432,14 @@ struct MainWindow : Window
}
}
virtual void OnInvalidateData(int data)
/**
* 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;
/* Forward the message to the appropiate toolbar (ingame or scenario editor) */
InvalidateWindowData(WC_MAIN_TOOLBAR, 0, data, true);
}

@ -332,8 +332,14 @@ public:
::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), this->tile);
}
virtual void OnInvalidateData(int data)
/**
* 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;
switch (data) {
case 1:
/* ReInit, "debug" sprite might have changed */
@ -639,8 +645,14 @@ public:
return pt;
}
virtual void OnInvalidateData(int data)
/**
* 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 company gets shut down, while displaying an error about it, remove the error message. */
if (this->face != INVALID_COMPANY && !Company::IsValidID(this->face)) delete this;
}

@ -313,8 +313,14 @@ struct MusicTrackSelectionWindow : public Window {
}
}
virtual void OnInvalidateData(int data = 0)
/**
* 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;
for (int i = 0; i < 6; i++) {
this->SetWidgetLoweredState(MTSW_ALL + i, i == _settings_client.music.playlist);
}
@ -638,8 +644,14 @@ struct MusicWindow : public Window {
}
}
virtual void OnInvalidateData(int data = 0)
/**
* 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;
for (int i = 0; i < 6; i++) {
this->SetWidgetLoweredState(MW_ALL + i, i == _settings_client.music.playlist);
}

@ -531,8 +531,14 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
ShowOnScreenKeyboard(this, wid, NWCW_CLOSE, NWCW_SENDBUTTON);
}
virtual void OnInvalidateData(int data)
/**
* 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 (data == this->dest) delete this;
}
};

@ -751,8 +751,14 @@ public:
this->InvalidateData();
}
virtual void OnInvalidateData(int data)
/**
* 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 (this->content.NeedRebuild()) this->BuildContentList();
/* To sum all the bytes we intend to download */

@ -794,8 +794,14 @@ public:
if (this->field == NGWW_CLIENT) this->HandleEditBox(NGWW_CLIENT);
}
virtual void OnInvalidateData(int data)
/**
* 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 (data == 1) {
this->server = NULL;
this->list_pos = SLP_INVALID;

@ -772,8 +772,14 @@ struct SpriteAlignerWindow : Window {
this->SetDirty();
}
virtual void OnInvalidateData(int data)
/**
* 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 (data == 1) {
/* Sprite picker finished */
this->RaiseWidget(SAW_PICKER);

@ -379,8 +379,14 @@ struct NewGRFParametersWindow : public Window {
nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
virtual void OnInvalidateData(int data)
/**
* 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 (!this->action14present) {
this->SetWidgetDisabledState(GRFPAR_WIDGET_NUMPAR_DEC, this->grf_config->num_params == 0);
this->SetWidgetDisabledState(GRFPAR_WIDGET_NUMPAR_INC, this->grf_config->num_params >= this->grf_config->num_valid_params);
@ -1025,15 +1031,18 @@ struct NewGRFWindow : public QueryStringBaseWindow {
}
/**
* Calback to update internal data.
* Some data on this window has become invalid.
* @param data Information about the changed data.
* - 0: (optionally) build availables, update button status.
* - 1: build availables, Add newly found grfs, update button status.
* - 2: (optionally) build availables, Reset preset, + 3
* - 3: (optionally) build availables, Update active scrollbar, update button status.
* - 4: Force a rebuild of the availables, + 2
* @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)
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
if (!gui_scope) return;
switch (data) {
default: NOT_REACHED();
case 0:

@ -498,8 +498,14 @@ struct NewsWindow : Window {
return ES_NOT_HANDLED;
}
virtual void OnInvalidateData(int data)
/**
* 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;
/* The chatbar has notified us that is was either created or closed */
int newtop = this->top + this->chat_height - data;
this->chat_height = data;
@ -1035,8 +1041,14 @@ struct MessageHistoryWindow : Window {
}
}
virtual void OnInvalidateData(int data)
/**
* 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;
this->vscroll->SetCount(_total_news);
}
@ -1201,8 +1213,14 @@ struct MessageOptionsWindow : Window {
}
}
virtual void OnInvalidateData(int data)
/**
* 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;
/* Update the dropdown value for 'set all categories'. */
this->GetWidget<NWidgetCore>(WIDGET_NEWSOPT_DROP_SUMMARY)->widget_data = this->message_opt[this->state];

@ -805,8 +805,14 @@ public:
}
}
virtual void OnInvalidateData(int data)
/**
* 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;
VehicleOrderID from = INVALID_VEH_ORDER_ID;
VehicleOrderID to = INVALID_VEH_ORDER_ID;

@ -247,8 +247,14 @@ struct OskWindow : public Window {
this->parent->SetWidgetDirty(this->text_btn);
}
virtual void OnInvalidateData(int)
/**
* 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;
this->SetWidgetDirty(OSK_WIDGET_TEXT);
}
};

@ -1617,8 +1617,14 @@ public:
this->InvalidateData();
}
virtual void OnInvalidateData(int data = 0)
/**
* 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;
this->LowerWidget((_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type);
this->SetWidgetLoweredState(BSW_CONVERT, _convert_signal_button);

@ -341,8 +341,14 @@ struct BuildRoadToolbarWindow : Window {
if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
}
void OnInvalidateData(int data = 0)
/**
* 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;
this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_ROAD),
RTW_DEPOT,
RTW_BUS_STATION,

@ -460,8 +460,14 @@ struct GameOptionsWindow : Window {
}
}
virtual void OnInvalidateData(int data)
/**
* 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;
this->SetWidgetLoweredState(GOW_FULLSCREEN_BUTTON, _fullscreen);
bool missing_files = BaseGraphics::GetUsedSet()->GetNumMissing() == 0;
@ -724,8 +730,14 @@ public:
}
}
virtual void OnInvalidateData(int data = 0)
/**
* 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;
uint i;
const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i);
for (i = 0; i < GAME_DIFFICULTY_NUM; i++, sd++) {

@ -367,8 +367,14 @@ struct SignListWindow : QueryStringBaseWindow, SignList {
this->SetDirty();
}
virtual void OnInvalidateData(int data)
/**
* 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;
/* When there is a filter string, we always need to rebuild the list even if
* the amount of signs in total is unchanged, as the subset of signs that is
* accepted by the filter might has changed.

@ -1423,12 +1423,15 @@ public:
}
/**
* Notifications for the smallmap window.
* Some data on this window has become invalid.
* @param data Information about the changed data.
* - data = 0: Displayed industries at the industry chain window have changed.
* - data = 1: Companies have changed.
* @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)
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
if (!gui_scope) return;
switch (data) {
case 1:
/* The owner legend has already been rebuilt. */

@ -687,8 +687,14 @@ public:
this->vscroll->SetCapacityFromWidget(this, SLW_LIST, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM);
}
virtual void OnInvalidateData(int data)
/**
* 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;
/* We can only set the trigger for resorting/rebuilding.
* We cannot safely resort at this point, as there might be multiple scheduled invalidations,
* and a rebuild needs to be done first though it is scheduled later. */
@ -1451,8 +1457,14 @@ struct SelectStationWindow : Window {
this->vscroll->SetCapacityFromWidget(this, JSW_PANEL, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM);
}
virtual void OnInvalidateData(int data)
/**
* 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;
FindStationsNearby<T>(this->area, true);
this->vscroll->SetCount(_stations_nearby_list.Length() + 1);
this->SetDirty();

@ -183,8 +183,14 @@ struct StatusBarWindow : Window {
}
}
virtual void OnInvalidateData(int data)
/**
* 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;
switch (data) {
default: NOT_REACHED();
case SBI_SAVELOAD_START: this->saving = true; break;

@ -215,8 +215,14 @@ struct SubsidyListWindow : Window {
this->vscroll->SetCapacityFromWidget(this, SLW_PANEL);
}
virtual void OnInvalidateData(int data)
/**
* 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;
this->vscroll->SetCount(this->CountLines());
}
};

@ -243,8 +243,14 @@ struct TimetableWindow : Window {
return (sel < v->GetNumOrders() * 2 && sel >= 0) ? sel : INVALID_ORDER;
}
virtual void OnInvalidateData(int data)
/**
* 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;
switch (data) {
case -666:
/* Autoreplace replaced the vehicle */

@ -1482,8 +1482,14 @@ struct MainToolbarWindow : Window {
}
}
virtual void OnInvalidateData(int data)
/**
* 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 (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, TBN_ZOOMIN, TBN_ZOOMOUT);
}
@ -1792,8 +1798,14 @@ struct ScenarioEditorToolbarWindow : Window {
}
}
virtual void OnInvalidateData(int data)
/**
* 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 (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, TBSE_ZOOMIN, TBSE_ZOOMOUT);
}

@ -523,8 +523,14 @@ public:
}
}
virtual void OnInvalidateData(int data = 0)
/**
* 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;
/* Called when setting station noise or required cargos have changed, in order to resize the window */
this->SetDirty(); // refresh display for current size. This will allow to avoid glitches when downgrading
this->ResizeWindowAsNeeded();
@ -863,8 +869,14 @@ public:
this->vscroll->SetCapacityFromWidget(this, TDW_CENTERTOWN);
}
virtual void OnInvalidateData(int data)
/**
* 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;
/* We can only set the trigger for resorting/rebuilding.
* We cannot safely resort at this point, as there might be multiple scheduled invalidations,
* and a rebuild needs to be done first though it is scheduled later. */
@ -1165,8 +1177,14 @@ public:
this->UpdateButtons(false);
}
virtual void OnInvalidateData(int)
/**
* 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;
this->UpdateButtons(true);
}
};

@ -125,8 +125,14 @@ public:
return pt;
}
virtual void OnInvalidateData(int data)
/**
* 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;
for (uint i = TTW_WIDGET_BEGIN; i < TTW_WIDGET_END; i++) {
this->SetWidgetLoweredState(i, IsTransparencySet((TransparencyOption)(i - TTW_WIDGET_BEGIN)));
}

@ -144,8 +144,14 @@ public:
}
}
virtual void OnInvalidateData(int data = 0)
/**
* 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;
this->base = _tree_base_by_landscape[_settings_game.game_creation.landscape];
this->count = _tree_count_by_landscape[_settings_game.game_creation.landscape];
}

@ -683,8 +683,14 @@ struct RefitWindow : public Window {
}
}
virtual void OnInvalidateData(int data)
/**
* 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;
switch (data) {
case -666:
/* Autoreplace replaced the vehicle.
@ -1600,8 +1606,14 @@ public:
this->GetWidget<NWidgetCore>(VLW_WIDGET_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
virtual void OnInvalidateData(int data)
/**
* 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 (HasBit(data, 31) && this->vli.type == VL_SHARED_ORDERS) {
this->vli.index = GB(data, 0, 20);
this->window_number = this->vli.Pack();
@ -1787,8 +1799,14 @@ struct VehicleDetailsWindow : Window {
this->tab = TDW_TAB_CARGO;
}
virtual void OnInvalidateData(int data)
/**
* 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 (data == -666) {
/* Autoreplace replaced the vehicle.
* Nothing to do for this window though.
@ -2596,8 +2614,14 @@ public:
}
}
virtual void OnInvalidateData(int data)
/**
* 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 (data == -666) {
/* Autoreplace replaced the vehicle.
* Nothing to do for this window though.

@ -148,8 +148,14 @@ public:
}
}
virtual void OnInvalidateData(int data = 0)
/**
* 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;
/* Only handle zoom message if intended for us (msg ZOOM_IN/ZOOM_OUT) */
HandleZoomMessage(this, this->viewport, EVW_ZOOMIN, EVW_ZOOMOUT);
}

@ -114,8 +114,14 @@ public:
}
}
virtual void OnInvalidateData(int data)
/**
* 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;
/* You can only change your own waypoints */
this->SetWidgetDisabledState(WAYPVW_RENAME, !this->wp->IsInUse() || (this->wp->owner != _local_company && this->wp->owner != OWNER_NONE));
/* Disable the widget for waypoints with no use */

@ -651,9 +651,9 @@ public:
/**
* 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) {}
virtual void OnInvalidateData(int data = 0, bool gui_scope = true) {}
/**
* The user clicked some place on the map when a tile highlight mode

Loading…
Cancel
Save