summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-30 21:00:35 +0000
committerrubidium <rubidium@openttd.org>2009-09-30 21:00:35 +0000
commit00324050930287e25d9a616f12cdf1421c3445e7 (patch)
tree9b463f5f1c52a367a2b364754d8697ff149145eb /src
parent2fa312aab9f7bcad6689f9da9dc92b0b096b0247 (diff)
downloadopenttd-00324050930287e25d9a616f12cdf1421c3445e7.tar.xz
(svn r17673) -Codechange: make InvalidateThisWindowData a function of the window class
Diffstat (limited to 'src')
-rw-r--r--src/main_gui.cpp3
-rw-r--r--src/newgrf_gui.cpp9
-rw-r--r--src/vehicle_gui.cpp2
-rw-r--r--src/window.cpp15
-rw-r--r--src/window_func.h1
-rw-r--r--src/window_gui.h10
6 files changed, 18 insertions, 22 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 147a521ae..83a84fee2 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -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;
}
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 03d6758e1..f9c753452 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -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);
}
};
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index e11220b3d..3fee59bcc 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -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();
}
}
diff --git a/src/window.cpp b/src/window.cpp
index 69e7e41ed..99a0f9c85 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2477,17 +2477,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
* @param number Window number within the 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);
}
}
diff --git a/src/window_func.h b/src/window_func.h
index f14d94459..feadd7a18 100644
--- a/src/window_func.h
+++ b/src/window_func.h
@@ -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);
diff --git a/src/window_gui.h b/src/window_gui.h
index 73e8e06b2..2e9b590b8 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -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 ***/
/**