summaryrefslogtreecommitdiff
path: root/train_gui.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2005-07-17 19:23:18 +0000
committerDarkvater <darkvater@openttd.org>2005-07-17 19:23:18 +0000
commit0550c4a87a4d9dc1fb3536234ad1f23621123e95 (patch)
tree9376c9d570e22b44516c49ab07ce3e375c97c948 /train_gui.c
parent52b42ff5081f25da96f70d7f16705e71e691216e (diff)
downloadopenttd-0550c4a87a4d9dc1fb3536234ad1f23621123e95.tar.xz
(svn r2623) - CodeChange: rework DrawStringCenteredTruncated() a bit. Instead of giving center + width you give the coordinates of the bounding box (left, right) it has to fit in (ludde)
- CodeChange: changed (back) maximum pixel length of truncated strings to a signed integer.
Diffstat (limited to 'train_gui.c')
-rw-r--r--train_gui.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/train_gui.c b/train_gui.c
index ca1744528..9a4c15cc9 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -417,9 +417,9 @@ static void DrawTrainDepotWindow(Window *w)
do {
i += u->u.rail.cached_veh_length + 1;
} while ( (u=u->next) != NULL); //Determine length of train
- SetDParam(0, (i+8) / 9); //Set the counter
- i = (w->hscroll.cap * 29) + (x + 26); //Calculate position of text according to window size
- DrawStringCentered(i, y+5, STR_TINY_BLACK, 0); //Draw the counter
+
+ SetDParam(0, (i + 8) / 9); //Set the counter
+ DrawStringRightAligned(w->widget[6].right - 1, y + 4, STR_TINY_BLACK, 0); //Draw the counter
/* Draw the pretty flag */
DrawSprite(v->vehstatus&VS_STOPPED ? 0xC12 : 0xC13, x+15, y);
@@ -441,8 +441,7 @@ static void DrawTrainDepotWindow(Window *w)
u = v;
do i++; while ( (u=u->next) != NULL); //Determine length of train
SetDParam(0, i); //Set the counter
- i = (w->hscroll.cap * 29) + (x + 26); //Calculate position of text according to window size
- DrawStringCentered(i, y+5, STR_TINY_BLACK, 0); //Draw the counter
+ DrawStringRightAligned(w->widget[6].right - 1, y + 4, STR_TINY_BLACK, 0); //Draw the counter
y += 14;
}
}
@@ -883,10 +882,8 @@ static void TrainViewWndProc(Window *w, WindowEvent *e)
}
/* draw the flag plus orders */
- { int w_width = w->widget[5].right - w->widget[5].left;
- DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, w->widget[5].top + 1);
- DrawStringCenteredTruncated(w_width / 2 + 6, w->widget[5].top + 1, str, 0, w_width - 8);
- }
+ DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, w->widget[5].top + 1);
+ DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0);
DrawWindowViewport(w);
} break;