summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2004-11-14 08:11:05 +0000
committertron <tron@openttd.org>2004-11-14 08:11:05 +0000
commit84d1041edfb21bb42739a95cfb6fa3909dfce1b4 (patch)
treeeab11d45a037165a49d83ace86dd75270af82dc7
parent7a2a973b48c06604af7cc697d091e1180d90ec8a (diff)
downloadopenttd-84d1041edfb21bb42739a95cfb6fa3909dfce1b4.tar.xz
(svn r578) Simplify BringWindowToFront()
-rw-r--r--window.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/window.c b/window.c
index 0982c50f3..c96769d86 100644
--- a/window.c
+++ b/window.c
@@ -253,6 +253,7 @@ Window *BringWindowToFrontById(WindowClass cls, WindowNumber number)
Window *BringWindowToFront(Window *w)
{
Window *v;
+ Window temp;
v = _last_window;
do {
@@ -265,14 +266,13 @@ Window *BringWindowToFront(Window *w)
assert(w < v);
- do {
- memswap(w, w+1, sizeof(Window));
- w++;
- } while (v != w);
+ temp = *w;
+ memmove(w, w + 1, (v - w) * sizeof(Window));
+ *v = temp;
- SetWindowDirty(w);
+ SetWindowDirty(v);
- return w;
+ return v;
}
Window *AllocateWindow(