From 2e90f7f8b975d380c3d544995ef6db9d6c8a86d8 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 18 Apr 2010 14:56:05 +0000 Subject: (svn r19670) -Codechange: Add CeilDiv() and RoundDiv() to simplify integer divisions with rounding. --- src/station_gui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/station_gui.cpp') diff --git a/src/station_gui.cpp b/src/station_gui.cpp index f672823c0..bc0e6066b 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -1105,7 +1105,7 @@ struct StationViewWindow : public Window { } Rect s = {r.left + WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP, r.right - WD_FRAMERECT_RIGHT, INT32_MAX}; int bottom = DrawCargoListText(cargo_mask, s, STR_STATION_VIEW_ACCEPTS_CARGO); - return (bottom - r.top - WD_FRAMERECT_TOP + FONT_HEIGHT_NORMAL - 1) / FONT_HEIGHT_NORMAL; + return CeilDiv(bottom - r.top - WD_FRAMERECT_TOP, FONT_HEIGHT_NORMAL); } /** Draw cargo ratings in the #SVW_ACCEPTLIST widget. @@ -1131,7 +1131,7 @@ struct StationViewWindow : public Window { DrawString(r.left + WD_FRAMERECT_LEFT + 6, r.right - WD_FRAMERECT_RIGHT - 6, y, STR_STATION_VIEW_CARGO_RATING); y += FONT_HEIGHT_NORMAL; } - return (y - r.top - WD_FRAMERECT_TOP + FONT_HEIGHT_NORMAL - 1) / FONT_HEIGHT_NORMAL; + return CeilDiv(y - r.top - WD_FRAMERECT_TOP, FONT_HEIGHT_NORMAL); } void HandleCargoWaitingClick(int row) -- cgit v1.2.3-54-g00ecf