summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2005-07-17 17:15:33 +0000
committerDarkvater <Darkvater@openttd.org>2005-07-17 17:15:33 +0000
commit3f8ba76b2fcba7a8b25eebca5ac24a723574dc59 (patch)
treeb618eaf70bf02a242a3d2bb8f7a4a7add02e2f29
parentcddc52fb8fa5e8a4033b2a4880141f81b01742d2 (diff)
downloadopenttd-3f8ba76b2fcba7a8b25eebca5ac24a723574dc59.tar.xz
(svn r2613) - Truncate savegames, and vehicle-texts in their window.
- Hardcoded width 5 for saves-path...oops :O
-rw-r--r--aircraft_gui.c11
-rw-r--r--misc_gui.c4
-rw-r--r--roadveh_gui.c11
-rw-r--r--ship_gui.c11
-rw-r--r--train_gui.c11
5 files changed, 22 insertions, 26 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c
index 33bbef5ed..6d41b147c 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -523,10 +523,6 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e)
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
- /* draw the flag */
- DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2,
- w->widget[5].top + 1);
-
if (v->vehstatus & VS_CRASHED) {
str = STR_8863_CRASHED;
} else if (v->vehstatus & VS_STOPPED) {
@@ -559,8 +555,11 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e)
}
}
- DrawStringCentered((w->widget[5].right - w->widget[5].left) / 2,
- w->widget[5].top + 1, str, 0);
+ /* 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);
+ }
DrawWindowViewport(w);
} break;
diff --git a/misc_gui.c b/misc_gui.c
index eb15a7069..f7068dd3f 100644
--- a/misc_gui.c
+++ b/misc_gui.c
@@ -1176,7 +1176,7 @@ static void DrawFiosTexts(uint maxw)
if (str != STR_4006_UNABLE_TO_READ_DRIVE) SetDParam(0, tot);
DrawString(2, 37, str, 0);
- DoDrawStringTruncated(path, 2, 27, 16, 5);
+ DoDrawStringTruncated(path, 2, 27, 16, maxw);
}
static void MakeSortedSaveGameList(void)
@@ -1245,7 +1245,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
pos = w->vscroll.pos;
while (pos < _fios_num) {
item = _fios_list + pos;
- DoDrawString(item->title, 4, y, _fios_colors[item->type]);
+ DoDrawStringTruncated(item->title, 4, y, _fios_colors[item->type], w->width - 18);
pos++;
y+=10;
if (y >= w->vscroll.cap*10+w->widget[6].top+1)
diff --git a/roadveh_gui.c b/roadveh_gui.c
index 972770885..eba65049b 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -240,10 +240,6 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e)
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
- /* draw the flag */
- DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2,
- w->widget[5].top + 1);
-
if (v->u.road.crashed_ctr != 0) {
str = STR_8863_CRASHED;
} else if (v->breakdown_ctr == 1) {
@@ -280,8 +276,11 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e)
}
}
- DrawStringCentered((w->widget[5].right - w->widget[5].left) / 2,
- w->widget[5].top + 1, str, 0);
+ /* 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);
+ }
DrawWindowViewport(w);
} break;
diff --git a/ship_gui.c b/ship_gui.c
index 12943d85d..a71341f38 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -481,10 +481,6 @@ static void ShipViewWndProc(Window *w, WindowEvent *e) {
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
- /* draw the flag */
- DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2,
- w->widget[5].top + 1);
-
if (v->breakdown_ctr == 1) {
str = STR_885C_BROKEN_DOWN;
} else if (v->vehstatus & VS_STOPPED) {
@@ -519,8 +515,11 @@ static void ShipViewWndProc(Window *w, WindowEvent *e) {
}
}
- DrawStringCentered((w->widget[5].right - w->widget[5].left) / 2,
- w->widget[5].top + 1, str, 0);
+ /* 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);
+ }
DrawWindowViewport(w);
} break;
diff --git a/train_gui.c b/train_gui.c
index fb09cbbb3..ca1744528 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -834,10 +834,6 @@ static void TrainViewWndProc(Window *w, WindowEvent *e)
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
- /* draw the flag */
- DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2,
- w->widget[5].top + 1);
-
if (v->u.rail.crash_anim_pos != 0) {
str = STR_8863_CRASHED;
} else if (v->breakdown_ctr == 1) {
@@ -886,8 +882,11 @@ static void TrainViewWndProc(Window *w, WindowEvent *e)
}
}
- DrawStringCentered((w->widget[5].right - w->widget[5].left) / 2,
- w->widget[5].top + 1, str, 0);
+ /* 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);
+ }
DrawWindowViewport(w);
} break;