mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
(svn r17673) -Codechange: make InvalidateThisWindowData a function of the window class
This commit is contained in:
parent
2fa312aab9
commit
0032405093
@ -166,9 +166,8 @@ bool DoZoomInOutWindow(int how, Window *w)
|
||||
vp->virtual_left = w->viewport->scrollpos_x;
|
||||
vp->virtual_top = w->viewport->scrollpos_y;
|
||||
}
|
||||
w->SetDirty();
|
||||
/* Update the windows that have zoom-buttons to perhaps disable their buttons */
|
||||
InvalidateThisWindowData(w);
|
||||
w->InvalidateData();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ public:
|
||||
this->sel = NULL;
|
||||
this->sel_pos = -1;
|
||||
}
|
||||
InvalidateThisWindowData(this, 1);
|
||||
this->InvalidateData(1);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ public:
|
||||
|
||||
case ANGRFW_RESCAN: // Rescan list
|
||||
ScanNewGRFFiles();
|
||||
InvalidateThisWindowData(this, 0);
|
||||
this->InvalidateData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -437,8 +437,7 @@ public:
|
||||
this->sel = this->grfs[this->sel_pos];
|
||||
|
||||
this->ScrollToSelected();
|
||||
|
||||
InvalidateThisWindowData(this, 1);
|
||||
this->InvalidateData(1);
|
||||
}
|
||||
|
||||
return ES_HANDLED;
|
||||
@ -448,7 +447,7 @@ public:
|
||||
{
|
||||
this->grfs.SetFilterState(!StrEmpty(this->edit_str_buf));
|
||||
this->grfs.ForceRebuild();
|
||||
InvalidateThisWindowData(this, 1);
|
||||
this->InvalidateData(1);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -663,7 +663,7 @@ static inline void ChangeVehicleWindow(WindowClass window_class, VehicleID from_
|
||||
if (w != NULL) {
|
||||
w->window_number = to_index;
|
||||
if (w->viewport != NULL) w->viewport->follow_vehicle = to_index;
|
||||
if (to_index != INVALID_VEHICLE) InvalidateThisWindowData(w, 0);
|
||||
if (to_index != INVALID_VEHICLE) w->InvalidateData();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2476,17 +2476,6 @@ void SetWindowClassesDirty(WindowClass cls)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark window data as invalid (in need of re-computing)
|
||||
* @param w Window with invalid data
|
||||
* @param data The data to invalidate with
|
||||
*/
|
||||
void InvalidateThisWindowData(Window *w, int data)
|
||||
{
|
||||
w->OnInvalidateData(data);
|
||||
w->SetDirty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark window data of the window of a given class and specific window number as invalid (in need of re-computing)
|
||||
* @param cls Window class
|
||||
@ -2497,7 +2486,7 @@ void InvalidateWindowData(WindowClass cls, WindowNumber number, int data)
|
||||
{
|
||||
Window *w;
|
||||
FOR_ALL_WINDOWS_FROM_BACK(w) {
|
||||
if (w->window_class == cls && w->window_number == number) InvalidateThisWindowData(w, data);
|
||||
if (w->window_class == cls && w->window_number == number) w->InvalidateData(data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2511,7 +2500,7 @@ void InvalidateWindowClassesData(WindowClass cls, int data)
|
||||
Window *w;
|
||||
|
||||
FOR_ALL_WINDOWS_FROM_BACK(w) {
|
||||
if (w->window_class == cls) InvalidateThisWindowData(w, data);
|
||||
if (w->window_class == cls) w->InvalidateData(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,6 @@ void ResetWindowSystem();
|
||||
void SetupColoursAndInitialWindow();
|
||||
void InputLoop();
|
||||
|
||||
void InvalidateThisWindowData(Window *w, int data = 0);
|
||||
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data = 0);
|
||||
void InvalidateWindowClassesData(WindowClass cls, int data = 0);
|
||||
|
||||
|
@ -634,6 +634,16 @@ public:
|
||||
void SetDirty() const;
|
||||
void ReInit();
|
||||
|
||||
/**
|
||||
* Mark this window's data as invalid (in need of re-computing)
|
||||
* @param data The data to invalidate with
|
||||
*/
|
||||
void InvalidateData(int data = 0)
|
||||
{
|
||||
this->SetDirty();
|
||||
this->OnInvalidateData(data);
|
||||
}
|
||||
|
||||
/*** Event handling ***/
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user