summaryrefslogtreecommitdiff
path: root/src/statusbar_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-05-12 20:01:39 +0000
committerrubidium <rubidium@openttd.org>2009-05-12 20:01:39 +0000
commit31272407f5d2377c3fb47859c2ff06ff0e8e6742 (patch)
tree868d8ac5370f53b2ee79c3fe4a1bb7913d8ba617 /src/statusbar_gui.cpp
parentc96dac54432ef0281ed7334296448ed1620f3306 (diff)
downloadopenttd-31272407f5d2377c3fb47859c2ff06ff0e8e6742.tar.xz
(svn r16284) -Codechange: replace some magic numbers with the left/right/top/bottom of a widget
Diffstat (limited to 'src/statusbar_gui.cpp')
-rw-r--r--src/statusbar_gui.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp
index f07e50fa0..c8bfeff38 100644
--- a/src/statusbar_gui.cpp
+++ b/src/statusbar_gui.cpp
@@ -23,7 +23,7 @@
#include "table/strings.h"
#include "table/sprites.h"
-static bool DrawScrollingStatusText(const NewsItem *ni, int pos, int width)
+static bool DrawScrollingStatusText(const NewsItem *ni, int scroll_pos, int left, int right, int top, int bottom)
{
CopyInDParam(0, ni->params, lengthof(ni->params));
StringID str = ni->string_id;
@@ -52,12 +52,12 @@ static bool DrawScrollingStatusText(const NewsItem *ni, int pos, int width)
*d = '\0';
DrawPixelInfo tmp_dpi;
- if (!FillDrawPixelInfo(&tmp_dpi, 141, 1, width, 11)) return true;
+ if (!FillDrawPixelInfo(&tmp_dpi, left, top, right - left, bottom)) return true;
DrawPixelInfo *old_dpi = _cur_dpi;
_cur_dpi = &tmp_dpi;
- int x = DrawString(pos, INT16_MAX, 0, buffer, TC_LIGHT_BLUE);
+ int x = DrawString(scroll_pos, INT16_MAX, 0, buffer, TC_LIGHT_BLUE);
_cur_dpi = old_dpi;
return x > 0;
@@ -114,7 +114,7 @@ struct StatusBarWindow : Window {
DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_STATUSBAR_PAUSED, TC_FROMSTRING, SA_CENTER);
} else if (this->ticker_scroll > TICKER_STOP && FindWindowById(WC_NEWS_WINDOW, 0) == NULL && _statusbar_news_item.string_id != 0) {
/* Draw the scrolling news text */
- if (!DrawScrollingStatusText(&_statusbar_news_item, this->ticker_scroll, this->widget[SBW_MIDDLE].right - this->widget[SBW_MIDDLE].left - 2)) {
+ if (!DrawScrollingStatusText(&_statusbar_news_item, this->ticker_scroll, this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, this->widget[SBW_MIDDLE].top + 1, this->widget[SBW_MIDDLE].bottom)) {
this->ticker_scroll = TICKER_STOP;
if (c != NULL) {
/* This is the default text */