summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/guic.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-26 10:39:39 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-26 10:39:39 +0000
commit61cae4a761c2f72cda44ae269c7007b37a0c14a7 (patch)
treefec8ec71ca7ca6eebd9d48881bc5ee3fe27d04c1 /crawl-ref/source/guic.cc
parentd4acdf4a6a4b73607d58714a66efd372674adb56 (diff)
downloadcrawl-ref-61cae4a761c2f72cda44ae269c7007b37a0c14a7.tar.gz
crawl-ref-61cae4a761c2f72cda44ae269c7007b37a0c14a7.zip
Misc. minor cleanups. (Yes, a huge amount of them but still...)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6146 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/guic.cc')
-rw-r--r--crawl-ref/source/guic.cc72
1 files changed, 48 insertions, 24 deletions
diff --git a/crawl-ref/source/guic.cc b/crawl-ref/source/guic.cc
index c21f24a581..3e0aa4e1c3 100644
--- a/crawl-ref/source/guic.cc
+++ b/crawl-ref/source/guic.cc
@@ -348,15 +348,20 @@ void MapRegionClass::resize(int mx0, int my0, int dx0, int dy0)
bool RegionClass::is_active()
{
- if (!flag) return false;
+ if (!flag)
+ return (false);
+
if (win->active_layer == layer)
- return true;
- else return false;
+ return (true);
+ else
+ return (false);
}
void RegionClass::make_active()
{
- if (!flag) return;
+ if (!flag)
+ return;
+
win->active_layer = layer;
}
@@ -398,8 +403,8 @@ bool RegionClass::convert_redraw_rect(int x1, int y1, int x2, int y2,
int cx2 = x2-ox;
int cy2 = y2-oy;
- if ( (cx2 < 0) || (cy2 < 0) || (cx1 >= dx*mx) || (cy1 >=dy*my))
- return false;
+ if (cx2 < 0 || cy2 < 0 || cx1 >= dx * mx || cy1 >= dy * my)
+ return (false);
cx1 /= dx;
cy1 /= dy;
@@ -420,7 +425,7 @@ bool RegionClass::convert_redraw_rect(int x1, int y1, int x2, int y2,
*rx2 = cx2;
*ry2 = cy2;
- return true;
+ return (true);
}
bool TileRegionClass::convert_redraw_rect(int x1, int y1, int x2, int y2,
@@ -436,7 +441,7 @@ bool TileRegionClass::convert_redraw_rect(int x1, int y1, int x2, int y2,
int wwy = dy*my;
if (cx2 < 0 || cy2 < 0 || cx1 >= wwx || cy1 >=wwy)
- return false;
+ return (false);
if (cx2 >= wwx - 1)
cx2 = wwx - 1;
@@ -452,57 +457,76 @@ bool TileRegionClass::convert_redraw_rect(int x1, int y1, int x2, int y2,
*rx2 = cx2;
*ry2 = cy2;
- return true;
+ return (true);
}
bool RegionClass::mouse_pos(int mouse_x, int mouse_y, int *cx, int *cy)
{
int x = mouse_x - ox;
int y = mouse_y - oy;
- if (!is_active()) return false;
- if ( x < 0 || y < 0 ) return false;
+
+ if (!is_active())
+ return (false);
+ if ( x < 0 || y < 0 )
+ return (false);
+
x /= dx;
y /= dy;
- if (x >= mx || y >= my) return false;
+
+ if (x >= mx || y >= my)
+ return (false);
+
*cx = x;
*cy = y;
- return true;
+
+ return (true);
}
bool MapRegionClass::mouse_pos(int mouse_x, int mouse_y, int *cx, int *cy)
{
int x = mouse_x - ox - x_margin;
int y = mouse_y - oy - y_margin;
- if ( x < 0 || y < 0 ) return false;
+
+ if (x < 0 || y < 0)
+ return (false);
+
x /= dx;
y /= dy;
- if (x >= mx || y >= my) return false;
- if (!is_active()) return false;
+
+ if (x >= mx || y >= my)
+ return (false);
+ if (!is_active())
+ return (false);
*cx = x;
*cy = y;
- return true;
+
+ return (true);
}
bool TileRegionClass::mouse_pos(int mouse_x, int mouse_y, int *cx, int *cy)
{
int x = mouse_x - ox;
int y = mouse_y - oy;
- if (!is_active()) return false;
- if ( x < 0 || y < 0 ) return false;
- if ( x >= dx*mx || y >= dy*my ) return false;
+
+ if (!is_active())
+ return (false);
+ if (x < 0 || y < 0)
+ return (false);
+ if (x >= dx * mx || y >= dy * my)
+ return (false);
x /= dx;
y /= dy;
*cx = x;
*cy = y;
- return true;
+ return (true);
}
-/*
- * Text related
- */
+//
+// Text related
+//
void TextRegionClass::scroll()
{