summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-11-24 13:00:32 +0000
committerrubidium <rubidium@openttd.org>2007-11-24 13:00:32 +0000
commit6cf5e4cf05489dec9b3b56ea6329cd8a2008cf8b (patch)
tree91db369d383d48dbbc7ead10800f0d54ff586603 /src
parentf27acfdf7886f6d25fbfca71a40a6f9aa22c1013 (diff)
downloadopenttd-6cf5e4cf05489dec9b3b56ea6329cd8a2008cf8b.tar.xz
(svn r11512) -Change: make the subsidy window able to resize to something smaller than 640x127 (especially the 640 part) when the screen is really too small.
Diffstat (limited to 'src')
-rw-r--r--src/road_gui.cpp4
-rw-r--r--src/subsidy_gui.cpp27
2 files changed, 16 insertions, 15 deletions
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index d21834974..3c3b821d6 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -212,7 +212,7 @@ static void PlaceRoadStop(TileIndex tile, uint32 p2, uint32 cmd)
static void PlaceRoad_BusStation(TileIndex tile)
{
- if (_remove_button_clicked || _ctrl_pressed) {
+ if (_remove_button_clicked) {
DoCommandP(tile, 0, RoadStop::BUS, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[RoadStop::BUS]));
} else {
PlaceRoadStop(tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | RoadStop::BUS, CMD_BUILD_ROAD_STOP | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[RoadStop::BUS]));
@@ -221,7 +221,7 @@ static void PlaceRoad_BusStation(TileIndex tile)
static void PlaceRoad_TruckStation(TileIndex tile)
{
- if (_remove_button_clicked || _ctrl_pressed) {
+ if (_remove_button_clicked) {
DoCommandP(tile, 0, RoadStop::TRUCK, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[RoadStop::TRUCK]));
} else {
PlaceRoadStop(tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | RoadStop::TRUCK, CMD_BUILD_ROAD_STOP | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[RoadStop::TRUCK]));
diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp
index 9b9bb6f3e..0379ab29b 100644
--- a/src/subsidy_gui.cpp
+++ b/src/subsidy_gui.cpp
@@ -92,9 +92,10 @@ static void DrawSubsidiesWindow(const Window *w)
ConvertDateToYMD(_date, &ymd);
+ int width = w->width - 2;
y = 15;
x = 1;
- DrawString(x, y, STR_2026_SUBSIDIES_ON_OFFER_FOR, TC_FROMSTRING);
+ DrawStringTruncated(x, y, STR_2026_SUBSIDIES_ON_OFFER_FOR, TC_FROMSTRING, width);
y += 10;
num = 0;
@@ -103,21 +104,21 @@ static void DrawSubsidiesWindow(const Window *w)
int x2;
SetupSubsidyDecodeParam(s, 1);
- x2 = DrawString(x + 2, y, STR_2027_FROM_TO, TC_FROMSTRING);
+ x2 = DrawStringTruncated(x + 2, y, STR_2027_FROM_TO, TC_FROMSTRING, width);
SetDParam(0, _date - ymd.day + 384 - s->age * 32);
- DrawString(x2, y, STR_2028_BY, TC_FROMSTRING);
+ DrawStringTruncated(x2, y, STR_2028_BY, TC_FROMSTRING, width - x2);
y += 10;
num++;
}
}
if (num == 0) {
- DrawString(x + 2, y, STR_202A_NONE, TC_FROMSTRING);
+ DrawStringTruncated(x + 2, y, STR_202A_NONE, TC_FROMSTRING, width - 2);
y += 10;
}
- DrawString(x, y + 1, STR_202B_SERVICES_ALREADY_SUBSIDISED, TC_FROMSTRING);
+ DrawStringTruncated(x, y + 1, STR_202B_SERVICES_ALREADY_SUBSIDISED, TC_FROMSTRING, width);
y += 10;
num = 0;
@@ -130,16 +131,16 @@ static void DrawSubsidiesWindow(const Window *w)
PlayerID player = GetStation(s->to)->owner;
SetDParam(3, player);
- xt = DrawString(x + 2, y, STR_202C_FROM_TO, TC_FROMSTRING);
+ xt = DrawStringTruncated(x + 2, y, STR_202C_FROM_TO, TC_FROMSTRING, width - 2);
SetDParam(0, _date - ymd.day + 768 - s->age * 32);
- DrawString(xt, y, STR_202D_UNTIL, TC_FROMSTRING);
+ DrawStringTruncated(xt, y, STR_202D_UNTIL, TC_FROMSTRING, width - xt);
y += 10;
num++;
}
}
- if (num == 0) DrawString(x + 2, y, STR_202A_NONE, TC_FROMSTRING);
+ if (num == 0) DrawStringTruncated(x + 2, y, STR_202A_NONE, TC_FROMSTRING, width - 2);
}
static void SubsidiesListWndProc(Window *w, WindowEvent *e)
@@ -158,15 +159,15 @@ static void SubsidiesListWndProc(Window *w, WindowEvent *e)
}
static const Widget _subsidies_list_widgets[] = {
-{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, RESIZE_NONE, 13, 11, 617, 0, 13, STR_2025_SUBSIDIES, STR_018C_WINDOW_TITLE_DRAG_THIS},
-{ WWT_STICKYBOX, RESIZE_NONE, 13, 618, 629, 0, 13, STR_NULL, STR_STICKY_BUTTON},
-{ WWT_PANEL, RESIZE_NONE, 13, 0, 629, 14, 126, 0x0, STR_01FD_CLICK_ON_SERVICE_TO_CENTER},
+{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
+{ WWT_CAPTION, RESIZE_RIGHT, 13, 11, 307, 0, 13, STR_2025_SUBSIDIES, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_STICKYBOX, RESIZE_LR, 13, 308, 319, 0, 13, STR_NULL, STR_STICKY_BUTTON},
+{ WWT_PANEL, RESIZE_RIGHT, 13, 0, 319, 14, 126, 0x0, STR_01FD_CLICK_ON_SERVICE_TO_CENTER},
{ WIDGETS_END},
};
static const WindowDesc _subsidies_list_desc = {
- WDP_AUTO, WDP_AUTO, 630, 127, 630, 127,
+ WDP_AUTO, WDP_AUTO, 320, 127, 630, 127,
WC_SUBSIDIES_LIST, WC_NONE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_subsidies_list_widgets,