summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ai/ai_gui.cpp20
-rw-r--r--src/autoreplace_gui.cpp2
-rw-r--r--src/build_vehicle_gui.cpp6
-rw-r--r--src/genworld_gui.cpp7
-rw-r--r--src/gfx.cpp78
-rw-r--r--src/gfx_func.h3
-rw-r--r--src/industry_gui.cpp23
-rw-r--r--src/misc_gui.cpp4
-rw-r--r--src/network/network_content_gui.cpp2
-rw-r--r--src/network/network_gui.cpp23
-rw-r--r--src/newgrf_gui.cpp4
-rw-r--r--src/news_gui.cpp2
-rw-r--r--src/order_gui.cpp2
-rw-r--r--src/rail_gui.cpp4
-rw-r--r--src/roadveh_gui.cpp2
-rw-r--r--src/settings_gui.cpp4
-rw-r--r--src/station_gui.cpp6
-rw-r--r--src/subsidy_gui.cpp18
-rw-r--r--src/timetable_gui.cpp2
-rw-r--r--src/widget.cpp8
20 files changed, 67 insertions, 153 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index b8635c352..227396675 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -79,7 +79,7 @@ struct AIListWindow : public Window {
int y = this->widget[AIL_WIDGET_LIST].top;
/* First AI in the list is hardcoded to random */
if (this->vscroll.pos == 0) {
- DrawStringTruncated(4, y + 3, STR_AI_RANDOM_AI, this->selected == -1 ? TC_WHITE : TC_BLACK, this->width - 8);
+ DrawString(4, this->widget[AIL_WIDGET_LIST].right - 4, y + 3, STR_AI_RANDOM_AI, this->selected == -1 ? TC_WHITE : TC_BLACK);
y += 14;
}
AIInfo *selected_info = NULL;
@@ -87,7 +87,7 @@ struct AIListWindow : public Window {
for (int i = 1; it != this->ai_info_list->end(); i++, it++) {
if (this->selected == i - 1) selected_info = (*it).second;
if (IsInsideBS(i, this->vscroll.pos, this->vscroll.cap)) {
- DoDrawStringTruncated((*it).second->GetName(), 4, y + 3, (this->selected == i - 1) ? TC_WHITE : TC_BLACK, this->width - 8);
+ DrawString(4, this->widget[AIL_WIDGET_LIST].right - 4, y + 3, (*it).second->GetName(), (this->selected == i - 1) ? TC_WHITE : TC_BLACK);
y += 14;
}
}
@@ -96,12 +96,12 @@ struct AIListWindow : public Window {
if (selected_info != NULL) {
int y = this->widget[AIL_WIDGET_INFO_BG].top + 6;
int x = DrawString(4, y, STR_AI_AUTHOR, TC_BLACK);
- DoDrawStringTruncated(selected_info->GetAuthor(), x + 5, y, TC_BLACK, this->width - x - 8);
+ DrawString(x + 5, this->widget[AIL_WIDGET_LIST].right - 4, y, selected_info->GetAuthor(), TC_BLACK);
y += 13;
x = DrawString(4, y, STR_AI_VERSION, TC_BLACK);
static char buf[8];
sprintf(buf, "%d", selected_info->GetVersion());
- DoDrawStringTruncated(buf, x + 5, y, TC_BLACK, this->width - x - 8);
+ DrawString(x + 5, this->widget[AIL_WIDGET_LIST].right - 4, y, buf, TC_BLACK);
y += 13;
SetDParamStr(0, selected_info->GetDescription());
DrawStringMultiLine(4, y, STR_JUST_RAW_STRING, this->width - 8, this->widget[AIL_WIDGET_INFO_BG].bottom - y);
@@ -263,14 +263,14 @@ struct AISettingsWindow : public Window {
} else {
DrawArrowButtons(4, y + 2, COLOUR_YELLOW, (this->clicked_button == i) ? 1 + !!this->clicked_increase : 0, current_value > (*it).min_value, current_value < (*it).max_value);
if (it->labels != NULL && it->labels->Find(current_value) != it->labels->End()) {
- x = DoDrawStringTruncated(it->labels->Find(current_value)->second, 28, y + 3, TC_ORANGE, this->width - 32);
+ x = DrawString(28, this->widget[AIS_WIDGET_BACKGROUND].right - 4, y + 3, it->labels->Find(current_value)->second, TC_ORANGE);
} else {
SetDParam(0, current_value);
- x = DrawStringTruncated(28, y + 3, STR_JUST_INT, TC_ORANGE, this->width - 32);
+ x = DrawString(28, this->widget[AIS_WIDGET_BACKGROUND].right - 4, y + 3, STR_JUST_INT, TC_ORANGE);
}
}
- DoDrawStringTruncated((*it).description, max(x + 3, 54), y + 3, TC_LIGHT_BLUE, this->width - (4 + max(x + 3, 54)));
+ DrawString(max(x + 3, 54), this->widget[AIS_WIDGET_BACKGROUND].right - 4, y + 3, (*it).description, TC_LIGHT_BLUE);
y += 14;
}
}
@@ -475,7 +475,7 @@ struct AIConfigWindow : public Window {
} else {
text = STR_AI_RANDOM_AI;
}
- DrawStringTruncated(10, y + 3, text, (this->selected_slot == i) ? TC_WHITE : ((i > _settings_newgame.difficulty.max_no_competitors || i == 0) ? TC_SILVER : TC_ORANGE), this->width - 20);
+ DrawString(10, this->widget[AIC_WIDGET_LIST].right - 10, y + 3, text, (this->selected_slot == i) ? TC_WHITE : ((i > _settings_newgame.difficulty.max_no_competitors || i == 0) ? TC_SILVER : TC_ORANGE));
y += 14;
}
}
@@ -657,7 +657,7 @@ struct AIDebugWindow : public Window {
assert(info != NULL);
char name[1024];
snprintf(name, sizeof(name), "%s (v%d)", info->GetName(), info->GetVersion());
- DoDrawString(name, 7, 47, TC_BLACK);
+ DrawString(7, this->widget[AID_WIDGET_VIEW].right, 47, name, TC_BLACK);
CompanyID old_company = _current_company;
_current_company = ai_debug_company;
@@ -683,7 +683,7 @@ struct AIDebugWindow : public Window {
default: colour = TC_BLACK; break;
}
- DoDrawStringTruncated(log->lines[pos], 7, this->widget[AID_WIDGET_LOG_PANEL].top + y, colour, this->widget[AID_WIDGET_LOG_PANEL].right - this->widget[AID_WIDGET_LOG_PANEL].left - 14);
+ DrawString(this->widget[AID_WIDGET_LOG_PANEL].right + 7, this->widget[AID_WIDGET_LOG_PANEL].left - 7, this->widget[AID_WIDGET_LOG_PANEL].top + y, log->lines[pos], colour);
y += 12;
}
}
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 91372ed5d..2fede9abe 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -306,7 +306,7 @@ public:
SetDParam(0, STR_NOT_REPLACING_VEHICLE_SELECTED);
}
- DrawStringTruncated(this->widget[RVW_WIDGET_INFO_TAB].left + 6, this->widget[RVW_WIDGET_INFO_TAB].top + 1, STR_02BD, TC_BLACK, this->GetWidgetWidth(RVW_WIDGET_INFO_TAB) - 12);
+ DrawString(this->widget[RVW_WIDGET_INFO_TAB].left + 6, this->widget[RVW_WIDGET_INFO_TAB].right - 6, this->widget[RVW_WIDGET_INFO_TAB].top + 1, STR_02BD, TC_BLACK);
/* Draw the lists */
for (byte i = 0; i < 2; i++) {
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 639eade40..92d3c36cf 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -668,19 +668,17 @@ void DrawEngineList(VehicleType type, int x, int r, int y, const GUIEngineList *
default: NOT_REACHED();
}
- uint maxw = r - x - x_offset;
-
for (; min < max; min++, y += step_size) {
const EngineID engine = (*eng_list)[min];
/* Note: num_engines is only used in the autoreplace GUI, so it is correct to use _local_company here. */
const uint num_engines = GetGroupNumEngines(_local_company, selected_group, engine);
SetDParam(0, engine);
- DrawStringTruncated(x + x_offset, y, STR_ENGINE_NAME, engine == selected_id ? TC_WHITE : TC_BLACK, maxw);
+ DrawString(x + x_offset, r, y, STR_ENGINE_NAME, engine == selected_id ? TC_WHITE : TC_BLACK);
DrawVehicleEngine(type, x, y + y_offset, engine, (count_location != 0 && num_engines == 0) ? PALETTE_CRASH : GetEnginePalette(engine, _local_company));
if (count_location != 0) {
SetDParam(0, num_engines);
- DrawStringRightAligned(count_location, y + (GetVehicleListHeight(type) == 14 ? 3 : 8), STR_TINY_BLACK, TC_FROMSTRING);
+ DrawString(x, count_location, y + (GetVehicleListHeight(type) == 14 ? 3 : 8), STR_TINY_BLACK, TC_FROMSTRING, SA_RIGHT);
}
}
}
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index 8fc28caf2..5163c0025 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -388,8 +388,6 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
this->DrawEditBox(GLAND_RANDOM_EDITBOX);
if (mode != GLWP_GENERATE) {
- char buffer[512];
-
if (_settings_newgame.game_creation.heightmap_rotation == HM_CLOCKWISE) {
SetDParam(0, this->y);
SetDParam(1, this->x);
@@ -397,12 +395,11 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
SetDParam(0, this->x);
SetDParam(1, this->y);
}
- GetString(buffer, STR_HEIGHTMAP_SIZE, lastof(buffer));
- DrawStringRightAligned(326, 91, STR_HEIGHTMAP_SIZE, TC_BLACK);
+ int right = DrawString(0, 326, 91, STR_HEIGHTMAP_SIZE, TC_BLACK, SA_RIGHT);
DrawString( 12, 91, STR_HEIGHTMAP_NAME, TC_BLACK);
SetDParamStr(0, this->name);
- DrawStringTruncated(114, 91, STR_JUST_RAW_STRING, TC_ORANGE, 326 - 114 - GetStringBoundingBox(buffer).width - 5);
+ DrawString(114, right - 5, 91, STR_JUST_RAW_STRING, TC_ORANGE);
}
}
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 9ad178501..a65b30131 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -484,20 +484,6 @@ int DrawString(int left, int right, int top, StringID str, TextColour colour, St
}
/**
- * Draw string, possibly truncated to make it fit in its allocated space
- *
- * @param x X position to start drawing
- * @param y Y position to start drawing
- * @param str String to draw
- * @param colour Colour used for drawing the string, see DoDrawString() for details
- * @param maxw Maximal width of the string
- */
-int DrawStringTruncated(int x, int y, StringID str, TextColour colour, uint maxw)
-{
- return DrawString(x, x + maxw, y, str, colour, SA_LEFT, false);
-}
-
-/**
* Draw string right-aligned.
*
* @param x Right-most x position of the string
@@ -511,20 +497,6 @@ int DrawStringRightAligned(int x, int y, StringID str, TextColour colour)
}
/**
- * Draw string right-aligned, possibly truncated to make it fit in its allocated space
- *
- * @param x Right-most x position to start drawing
- * @param y Y position to start drawing
- * @param str String to draw
- * @param colour Colour used for drawing the string, see DoDrawString() for details
- * @param maxw Maximal width of the string
- */
-int DrawStringRightAlignedTruncated(int x, int y, StringID str, TextColour colour, uint maxw)
-{
- return DrawString(x - maxw, x, y, str, colour, SA_RIGHT, false);
-}
-
-/**
* Draw string right-aligned with a line underneath it.
*
* @param x Right-most x position of the string
@@ -554,22 +526,6 @@ int DrawStringCentered(int x, int y, StringID str, TextColour colour)
}
/**
- * Draw string centered, possibly truncated to fit in the assigned space.
- *
- * @param xl Left-most x position
- * @param xr Right-most x position
- * @param y Y position of the string
- * @param str String to draw
- * @param colour Colour used for drawing the string, see DoDrawString() for details
- *
- * @return Width of the drawn string in pixels
- */
-int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, TextColour colour)
-{
- return DrawString(xl, xr, y, str, colour, SA_CENTER, false);
-}
-
-/**
* Draw string centered.
*
* @param x X position of center of the string
@@ -603,20 +559,6 @@ int DrawStringCenterUnderline(int x, int y, StringID str, TextColour colour)
}
/**
- * Draw string centered possibly truncated, with additional line underneath it
- *
- * @param xl Left x position of the string
- * @param xr Right x position of the string
- * @param y Y position of center of the string
- * @param str String to draw
- * @param colour Colour used for drawing the string, see DoDrawString() for details
- */
-int DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, TextColour colour)
-{
- return DrawString(xl, xr, y, str, colour, SA_CENTER, true);
-}
-
-/**
* 'Correct' a string to a maximum length. Longer strings will be cut into
* additional lines at whitespace characters if possible. The string parameter
* is modified with terminating characters mid-string which are the
@@ -1008,26 +950,6 @@ skip_cont:;
}
/**
- * Draw the string of the character buffer, starting at position (x,y) with a given maximal width.
- * String is truncated if it is too long.
- *
- * @param str Character buffer containing the string
- * @param x Left-most x coordinate to start drawing
- * @param y Y coordinate to draw the string
- * @param colour Colour to use, see DoDrawString() for details.
- * @param maxw Maximal width in pixels that may be used for drawing
- *
- * @return Right-most x position after drawing the (possibly truncated) string
- */
-int DoDrawStringTruncated(const char *str, int x, int y, TextColour colour, uint maxw)
-{
- char buffer[DRAW_STRING_BUFFER];
- strecpy(buffer, str, lastof(buffer));
- TruncateString(buffer, maxw);
- return DoDrawString(buffer, x, y, colour);
-}
-
-/**
* Draw a sprite.
* @param img Image number to draw
* @param pal Palette to use.
diff --git a/src/gfx_func.h b/src/gfx_func.h
index 183045abe..1faa8dea8 100644
--- a/src/gfx_func.h
+++ b/src/gfx_func.h
@@ -99,15 +99,12 @@ int DrawStringCentered(int x, int y, StringID str, TextColour colour);
int DoDrawStringCentered(int x, int y, const char *str, TextColour colour);
int DrawString(int x, int y, StringID str, TextColour colour);
-int DrawStringTruncated(int x, int y, StringID str, TextColour colour, uint maxw);
int DoDrawString(const char *string, int x, int y, TextColour colour, bool parse_string_also_when_clipped = false);
-int DoDrawStringTruncated(const char *str, int x, int y, TextColour colour, uint maxw);
int DrawStringCenterUnderline(int x, int y, StringID str, TextColour colour);
int DrawStringRightAligned(int x, int y, StringID str, TextColour colour);
-int DrawStringRightAlignedTruncated(int x, int y, StringID str, TextColour colour, uint maxw);
int DrawStringRightAlignedUnderline(int x, int y, StringID str, TextColour colour);
void DrawCharCentered(uint32 c, int x, int y, TextColour colour);
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 21a43b03b..b04a85736 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -189,6 +189,7 @@ public:
int y_str = this->widget[DPIW_INFOPANEL].top + 3;
const Widget *wi = &this->widget[DPIW_INFOPANEL];
int max_width = wi->right - wi->left - 4;
+ int right = wi->right - 1;
/* Raw industries might be prospected. Show this fact by changing the string
* In Editor, you just build, while ingame, or you fund or you prospect */
@@ -213,13 +214,13 @@ public:
bool selected = this->selected_index == i + this->vscroll.pos;
if (this->index[i + this->vscroll.pos] == INVALID_INDUSTRYTYPE) {
- DrawStringTruncated(20, y + offset, STR_MANY_RANDOM_INDUSTRIES, selected ? TC_WHITE : TC_ORANGE, max_width - 25);
+ DrawString(20, right, y + offset, STR_MANY_RANDOM_INDUSTRIES, selected ? TC_WHITE : TC_ORANGE);
continue;
}
const IndustrySpec *indsp = GetIndustrySpec(this->index[i + this->vscroll.pos]);
/* Draw the name of the industry in white is selected, otherwise, in orange */
- DrawStringTruncated(20, y + offset, indsp->name, selected ? TC_WHITE : TC_ORANGE, max_width - 25);
+ DrawString(20, right, y + offset, indsp->name, selected ? TC_WHITE : TC_ORANGE);
GfxFillRect(x, y + 1 + offset, x + 10, y + 7 + offset, selected ? 15 : 0);
GfxFillRect(x + 1, y + 2 + offset, x + 9, y + 6 + offset, indsp->map_colour);
}
@@ -231,7 +232,7 @@ public:
if (_game_mode != GM_EDITOR) {
SetDParam(0, indsp->GetConstructionCost());
- DrawStringTruncated(x_str, y_str, STR_482F_COST, TC_FROMSTRING, max_width);
+ DrawString(x_str, right, y_str, STR_482F_COST, TC_FROMSTRING);
y_str += 11;
}
@@ -246,7 +247,7 @@ public:
SetDParam(p++, GetCargo(indsp->accepts_cargo[j])->name);
SetDParam(p++, GetCargoSuffix(j, CST_FUND, NULL, this->selected_type, indsp));
}
- DrawStringTruncated(x_str, y_str, str, TC_FROMSTRING, max_width);
+ DrawString(x_str, right, y_str, str, TC_FROMSTRING);
y_str += 11;
/* Draw the produced cargos, if any. Otherwhise, will print "Nothing" */
@@ -260,7 +261,7 @@ public:
SetDParam(p++, GetCargo(indsp->produced_cargo[j])->name);
SetDParam(p++, GetCargoSuffix(j + 3, CST_FUND, NULL, this->selected_type, indsp));
}
- DrawStringTruncated(x_str, y_str, str, TC_FROMSTRING, max_width);
+ DrawString(x_str, right, y_str, str, TC_FROMSTRING);
y_str += 11;
/* Get the additional purchase info text, if it has not already been */
@@ -487,14 +488,14 @@ public:
if (i->accepts_cargo[j] == CT_INVALID) continue;
has_accept = true;
if (first) {
- DrawStringTruncated(2, y, STR_INDUSTRY_WINDOW_WAITING_FOR_PROCESSING, TC_FROMSTRING, this->widget[IVW_INFO].right - 2);
+ DrawString(2, this->widget[IVW_INFO].right, y, STR_INDUSTRY_WINDOW_WAITING_FOR_PROCESSING, TC_FROMSTRING);
y += 10;
first = false;
}
SetDParam(0, i->accepts_cargo[j]);
SetDParam(1, i->incoming_cargo_waiting[j]);
SetDParam(2, GetCargoSuffix(j, CST_VIEW, i, i->type, ind));
- DrawStringTruncated(4, y, STR_INDUSTRY_WINDOW_WAITING_STOCKPILE_CARGO, TC_FROMSTRING, this->widget[IVW_INFO].right - 4);
+ DrawString(4, this->widget[IVW_INFO].right, y, STR_INDUSTRY_WINDOW_WAITING_STOCKPILE_CARGO, TC_FROMSTRING);
y += 10;
}
} else {
@@ -508,7 +509,7 @@ public:
SetDParam(p++, GetCargoSuffix(j, CST_VIEW, i, i->type, ind));
}
if (has_accept) {
- DrawStringTruncated(2, y, str, TC_FROMSTRING, this->widget[IVW_INFO].right - 2);
+ DrawString(2, this->widget[IVW_INFO].right, y, str, TC_FROMSTRING);
y += 10;
}
}
@@ -518,7 +519,7 @@ public:
if (i->produced_cargo[j] == CT_INVALID) continue;
if (first) {
if (has_accept) y += 10;
- DrawStringTruncated(2, y, STR_482A_PRODUCTION_LAST_MONTH, TC_FROMSTRING, this->widget[IVW_INFO].right - 2);
+ DrawString(2, this->widget[IVW_INFO].right, y, STR_482A_PRODUCTION_LAST_MONTH, TC_FROMSTRING);
y += 10;
this->production_offset_y = y;
first = false;
@@ -530,7 +531,7 @@ public:
SetDParam(3, i->last_month_pct_transported[j] * 100 >> 8);
uint x = 4 + (IsProductionAlterable(i) ? 30 : 0);
- DrawStringTruncated(x, y, STR_482B_TRANSPORTED, TC_FROMSTRING, this->widget[IVW_INFO].right - x);
+ DrawString(x, this->widget[IVW_INFO].right, y, STR_482B_TRANSPORTED, TC_FROMSTRING);
/* Let's put out those buttons.. */
if (IsProductionAlterable(i)) {
DrawArrowButtons(5, y, COLOUR_YELLOW, (this->clicked_line == j + 1) ? this->clicked_button : 0,
@@ -903,7 +904,7 @@ public:
/* Drawing the right string */
StringID str = STR_INDUSTRYDIR_ITEM_NOPROD;
if (p != 1) str = (p == 5) ? STR_INDUSTRYDIR_ITEM : STR_INDUSTRYDIR_ITEM_TWO;
- DrawStringTruncated(4, y, str, TC_FROMSTRING, this->widget[IDW_INDUSTRY_LIST].right - 4);
+ DrawString(4, this->widget[IDW_INDUSTRY_LIST].right, y, str, TC_FROMSTRING);
y += 10;
}
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index df474d598..c6f2d0b47 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1409,7 +1409,7 @@ static void DrawFiosTexts(uint maxw)
if (str != STR_4006_UNABLE_TO_READ_DRIVE) SetDParam(0, tot);
DrawString(2, 37, str, TC_FROMSTRING);
- DoDrawStringTruncated(path, 2, 27, TC_BLACK, maxw);
+ DrawString(2, 2 + maxw, 27, path, TC_BLACK);
}
static void MakeSortedSaveGameList()
@@ -1570,7 +1570,7 @@ public:
for (uint pos = this->vscroll.pos; pos < _fios_items.Length(); pos++) {
const FiosItem *item = _fios_items.Get(pos);
- DoDrawStringTruncated(item->title, 4, y, _fios_colours[item->type], this->width - 18);
+ DrawString(4, widg->right - 2, y, item->title, _fios_colours[item->type]);
y += 10;
if (y >= this->vscroll.cap * 10 + widg->top + 1) break;
}
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 87f3f6dad..081674a9c 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -424,7 +424,7 @@ public:
DrawString(this->widget[NCLWW_TYPE].left, this->widget[NCLWW_TYPE].right, y, str, TC_BLACK, SA_CENTER);
SetDParamStr(0, ci->name);
- DrawStringTruncated(this->widget[NCLWW_NAME].left + 5, y, STR_JUST_RAW_STRING, TC_BLACK, this->widget[NCLWW_NAME].right - this->widget[NCLWW_NAME].left - 5);
+ DrawString(this->widget[NCLWW_NAME].left + 5, this->widget[NCLWW_NAME].right, y, STR_JUST_RAW_STRING, TC_BLACK);
y += this->resize.step_height;
}
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 005034d55..a6b98015e 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -240,7 +240,7 @@ protected:
if (highlight) GfxFillRect(this->widget[NGWW_NAME].left + 1, y - 2, this->widget[NGWW_INFO].right - 1, y + 9, 10);
SetDParamStr(0, cur_item->info.server_name);
- DrawStringTruncated(this->widget[NGWW_NAME].left + 5, y, STR_JUST_RAW_STRING, TC_BLACK, this->widget[NGWW_NAME].right - this->widget[NGWW_NAME].left - 5);
+ DrawString(this->widget[NGWW_NAME].left + 5, this->widget[NGWW_NAME].right, y, STR_JUST_RAW_STRING, TC_BLACK);
/* only draw details if the server is online */
if (cur_item->online) {
@@ -1215,7 +1215,7 @@ struct NetworkLobbyWindow : public Window {
GfxFillRect(11, y - 1, 154, y + 10, 10); // show highlighted item with a different colour
}
- DoDrawStringTruncated(this->company_info[company].company_name, 13, y, TC_BLACK, 135 - 13);
+ DrawString(13, 135, y, this->company_info[company].company_name, TC_BLACK);
if (this->company_info[company].use_password != 0) DrawSprite(SPR_LOCK, PAL_NONE, 135, y);
/* If the company's income was positive puts a green dot else a red dot */
@@ -1232,7 +1232,6 @@ struct NetworkLobbyWindow : public Window {
DrawStringCentered(290, 50, STR_NETWORK_COMPANY_INFO, TC_FROMSTRING);
if (this->company != INVALID_COMPANY && !StrEmpty(this->company_info[this->company].company_name)) {
const uint x = 183;
- const uint trunc_width = this->widget[NLWW_DETAILS].right - x;
y = 80;
SetDParam(0, gi->clients_on);
@@ -1243,27 +1242,27 @@ struct NetworkLobbyWindow : public Window {
y += 10;
SetDParamStr(0, this->company_info[this->company].company_name);
- DrawStringTruncated(x, y, STR_NETWORK_COMPANY_NAME, TC_GOLD, trunc_width);
+ DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_COMPANY_NAME, TC_GOLD);
y += 10;
SetDParam(0, this->company_info[this->company].inaugurated_year);
- DrawString(x, y, STR_NETWORK_INAUGURATION_YEAR, TC_GOLD); // inauguration year
+ DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_INAUGURATION_YEAR, TC_GOLD); // inauguration year
y += 10;
SetDParam(0, this->company_info[this->company].company_value);
- DrawString(x, y, STR_NETWORK_VALUE, TC_GOLD); // company value
+ DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_VALUE, TC_GOLD); // company value
y += 10;
SetDParam(0, this->company_info[this->company].money);
- DrawString(x, y, STR_NETWORK_CURRENT_BALANCE, TC_GOLD); // current balance
+ DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_CURRENT_BALANCE, TC_GOLD); // current balance
y += 10;
SetDParam(0, this->company_info[this->company].income);
- DrawString(x, y, STR_NETWORK_LAST_YEARS_INCOME, TC_GOLD); // last year's income
+ DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_LAST_YEARS_INCOME, TC_GOLD); // last year's income
y += 10;
SetDParam(0, this->company_info[this->company].performance);
- DrawString(x, y, STR_NETWORK_PERFORMANCE, TC_GOLD); // performance
+ DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_PERFORMANCE, TC_GOLD); // performance
y += 10;
SetDParam(0, this->company_info[this->company].num_vehicle[0]);
@@ -1271,7 +1270,7 @@ struct NetworkLobbyWindow : public Window {
SetDParam(2, this->company_info[this->company].num_vehicle[2]);
SetDParam(3, this->company_info[this->company].num_vehicle[3]);
SetDParam(4, this->company_info[this->company].num_vehicle[4]);
- DrawString(x, y, STR_NETWORK_VEHICLES, TC_GOLD); // vehicles
+ DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_VEHICLES, TC_GOLD); // vehicles
y += 10;
SetDParam(0, this->company_info[this->company].num_station[0]);
@@ -1279,11 +1278,11 @@ struct NetworkLobbyWindow : public Window {
SetDParam(2, this->company_info[this->company].num_station[2]);
SetDParam(3, this->company_info[this->company].num_station[3]);
SetDParam(4, this->company_info[this->company].num_station[4]);
- DrawString(x, y, STR_NETWORK_STATIONS, TC_GOLD); // stations
+ DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_STATIONS, TC_GOLD); // stations
y += 10;
SetDParamStr(0, this->company_info[this->company].clients);
- DrawStringTruncated(x, y, STR_NETWORK_PLAYERS, TC_GOLD, trunc_width); // players
+ DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_PLAYERS, TC_GOLD); // players
}
}
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 2558336f6..e45f74501 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -171,7 +171,7 @@ struct NewGRFAddWindow : public Window {
/* Draw selection background */
if (h) GfxFillRect(3, y, this->width - 15, y + 9, 156);
- DoDrawStringTruncated(text, 4, y, h ? TC_WHITE : TC_ORANGE, this->width - 18);
+ DrawString(4, this->width - 22, y, text, h ? TC_WHITE : TC_ORANGE);
y += 10;
}
}
@@ -448,7 +448,7 @@ struct NewGRFWindow : public Window {
DrawSprite(SPR_SQUARE, pal, 5, y + 2);
if (c->error != NULL) DrawSprite(SPR_WARNING_SIGN, 0, 20, y + 2);
txtoffset = c->error != NULL ? 35 : 25;
- DoDrawStringTruncated(text, txtoffset, y + 3, this->sel == c ? TC_WHITE : TC_BLACK, this->width - txtoffset - 10);
+ DrawString(txtoffset, this->widget[SNGRFS_FILE_LIST].right - 2, y + 3, text, this->sel == c ? TC_WHITE : TC_BLACK);
y += 14;
}
}
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index 46c18eeac..eb81caa7f 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -698,7 +698,7 @@ static void DrawNewsString(int x, int y, TextColour colour, const NewsItem *ni,
*dest = '\0';
/* Truncate and show string; postfixed by '...' if neccessary */
- DoDrawStringTruncated(buffer2, x, y, colour, maxw);
+ DrawString(x, x + maxw, y, buffer2, colour);
}
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index b4b9d5bb0..8a9472ea6 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -280,7 +280,7 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
}
SetDParam(0, order_index + 1);
- DrawStringTruncated(2, y, str, selected ? TC_WHITE : TC_BLACK, width);
+ DrawString(2, width + 2, y, str, selected ? TC_WHITE : TC_BLACK);
}
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index c523977cf..484dd733b 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -1078,9 +1078,9 @@ public:
GfxFillRect(8, y - 2, 127, y + 10, 0, FILLRECT_CHECKER);
}
- DrawStringTruncated(9, y, statspec->name, i == _railstation.station_type ? TC_WHITE : TC_BLACK, 118);
+ DrawString(9, 127, y, statspec->name, i == _railstation.station_type ? TC_WHITE : TC_BLACK);
} else {
- DrawStringTruncated(9, y, STR_STAT_CLASS_DFLT, i == _railstation.station_type ? TC_WHITE : TC_BLACK, 118);
+ DrawString(9, 127, y, STR_STAT_CLASS_DFLT, i == _railstation.station_type ? TC_WHITE : TC_BLACK);
}
y += 14;
diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp
index 765bb36d5..3c6e915e9 100644
--- a/src/roadveh_gui.cpp
+++ b/src/roadveh_gui.cpp
@@ -65,7 +65,7 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y)
}
SetDParamStr(0, capacity);
- DrawStringTruncated(x, y + 10 + y_offset, STR_JUST_RAW_STRING, TC_BLUE, 380 - x);
+ DrawString(x, 300, y + 10 + y_offset, STR_JUST_RAW_STRING, TC_BLUE);
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
if (u->cargo_cap == 0) continue;
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index b3ce74de2..69e9e35d7 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -849,7 +849,7 @@ uint SettingEntry::Draw(GameSettings *settings_ptr, int base_x, int base_y, int
case SEF_SUBTREE_KIND:
if (cur_row >= first_row) {
DrawSprite((this->d.sub.folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED), PAL_NONE, x, y);
- DrawStringTruncated(x + 12, y, this->d.sub.title, TC_FROMSTRING, max_x - x - 12);
+ DrawString(x + 12, max_x, y, this->d.sub.title, TC_FROMSTRING);
}
cur_row++;
if (!this->d.sub.folded) {
@@ -916,7 +916,7 @@ void SettingEntry::DrawSetting(GameSettings *settings_ptr, const SettingDesc *sd
SetDParam(1, value);
}
}
- DrawStringTruncated(x + 25, y, (sdb->str) + disabled, TC_FROMSTRING, max_x - x - 25);
+ DrawString(x + 25, max_x, y, (sdb->str) + disabled, TC_FROMSTRING);
}
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 28b82a3d5..565402649 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -827,7 +827,7 @@ struct StationViewWindow : public Window {
SetDParam(0, cd->cargo);
SetDParam(1, cd->count);
SetDParam(2, cd->source);
- DrawStringRightAlignedTruncated(x + width, y, STR_EN_ROUTE_FROM, TC_FROMSTRING, width);
+ DrawString(x, x + width, y, STR_EN_ROUTE_FROM, TC_FROMSTRING, SA_RIGHT);
}
y += 10;
@@ -1143,7 +1143,7 @@ struct SelectStationWindow : Window {
uint y = 17;
if (this->vscroll.pos == 0) {
- DrawStringTruncated(3, y, STR_CREATE_SPLITTED_STATION, TC_FROMSTRING, this->widget[JSW_PANEL].right - 5);
+ DrawString(3, this->widget[JSW_PANEL].right - 2, y, STR_CREATE_SPLITTED_STATION, TC_FROMSTRING);
y += 10;
}
@@ -1154,7 +1154,7 @@ struct SelectStationWindow : Window {
const Station *st = GetStation(_stations_nearby_list[i - 1]);
SetDParam(0, st->index);
SetDParam(1, st->facilities);
- DrawStringTruncated(3, y, STR_3049_0, TC_FROMSTRING, this->widget[JSW_PANEL].right - 5);
+ DrawString(3, this->widget[JSW_PANEL].right - 2, y, STR_3049_0, TC_FROMSTRING);
}
}
diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp
index c774b16f8..a84737a68 100644
--- a/src/subsidy_gui.cpp
+++ b/src/subsidy_gui.cpp
@@ -107,12 +107,12 @@ struct SubsidyListWindow : Window {
ConvertDateToYMD(_date, &ymd);
- int width = this->width - 13; // scroll bar = 11 + pixel each side
+ int right = this->width - 12; // scroll bar = 11 + pixel each side
int y = 15;
int x = 1;
/* Section for drawing the offered subisidies */
- DrawStringTruncated(x, y, STR_2026_SUBSIDIES_ON_OFFER_FOR, TC_FROMSTRING, width);
+ DrawString(x, right, y, STR_2026_SUBSIDIES_ON_OFFER_FOR, TC_FROMSTRING);
y += 10;
uint num = 0;
@@ -122,12 +122,12 @@ struct SubsidyListWindow : Window {
/* Displays the two offered towns */
SetupSubsidyDecodeParam(s, 1);
- x2 = DrawStringTruncated(x + 2, y, STR_2027_FROM_TO, TC_FROMSTRING, width - 2);
+ x2 = DrawString(x + 2, right - 2, y, STR_2027_FROM_TO, TC_FROMSTRING);
if (width - x2 > 10) {
/* Displays the deadline before voiding the proposal */
SetDParam(0, _date - ymd.day + 384 - s->age * 32);
- DrawStringTruncated(x2, y, STR_2028_BY, TC_FROMSTRING, width - x2);
+ DrawString(x2, right, y, STR_2028_BY, TC_FROMSTRING);
}
y += 10;
@@ -136,12 +136,12 @@ struct SubsidyListWindow : Window {
}
if (num == 0) {
- DrawStringTruncated(x + 2, y, STR_202A_NONE, TC_FROMSTRING, width - 2);
+ DrawString(x + 2, right - 2, y, STR_202A_NONE, TC_FROMSTRING);
y += 10;
}
/* Section for drawing the already granted subisidies */
- DrawStringTruncated(x, y + 1, STR_202B_SERVICES_ALREADY_SUBSIDISED, TC_FROMSTRING, width);
+ DrawString(x, right, y + 1, STR_202B_SERVICES_ALREADY_SUBSIDISED, TC_FROMSTRING);
y += 10;
num = 0;
@@ -154,19 +154,19 @@ struct SubsidyListWindow : Window {
SetDParam(3, GetStation(s->to)->owner);
/* Displays the two connected stations */
- xt = DrawStringTruncated(x + 2, y, STR_202C_FROM_TO, TC_FROMSTRING, width - 2);
+ xt = DrawString(x + 2, right - 2, y, STR_202C_FROM_TO, TC_FROMSTRING);
/* Displays the date where the granted subsidy will end */
if ((xt > 3) && (width - xt) > 9 ) { // do not draw if previous drawing failed or if it will overlap on scrollbar
SetDParam(0, _date - ymd.day + 768 - s->age * 32);
- DrawStringTruncated(xt, y, STR_202D_UNTIL, TC_FROMSTRING, width - xt);
+ DrawString(xt, right, y, STR_202D_UNTIL, TC_FROMSTRING);
}
y += 10;
num++;
}
}
- if (num == 0) DrawStringTruncated(x + 2, y, STR_202A_NONE, TC_FROMSTRING, width - 2);
+ if (num == 0) DrawString(x + 2, right - 2, y, STR_202A_NONE, TC_FROMSTRING);
}
};
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index e6050ee19..2391b3f55 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -205,7 +205,7 @@ struct TimetableWindow : Window {
string = STR_TIMETABLE_TRAVEL_FOR;
}
- DrawStringTruncated(2, y, string, (i == selected) ? TC_WHITE : TC_BLACK, this->widget[TTV_TIMETABLE_PANEL].right - 4);
+ DrawString(this->widget[TTV_TIMETABLE_PANEL].left + 2, this->widget[TTV_TIMETABLE_PANEL].right - 2, y, string, (i == selected) ? TC_WHITE : TC_BLACK);
if (final_order) break;
}
diff --git a/src/widget.cpp b/src/widget.cpp
index 82854b7df..088c6a7be 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -257,7 +257,7 @@ void Window::DrawWidgets() const
case WWT_TEXT: {
const StringID str = wi->data;
- if (str != STR_NULL) DrawStringTruncated(r.left, r.top, str, (TextColour)wi->colour, r.right - r.left);
+ if (str != STR_NULL) DrawString(r.left, r.right, r.top, str, (TextColour)wi->colour);
break;
}
@@ -265,7 +265,7 @@ void Window::DrawWidgets() const
const StringID str = wi->data;
DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->colour, FR_LOWERED | FR_DARKENED);
- if (str != STR_NULL) DrawStringTruncated(r.left + 2, r.top + 1, str, TC_FROMSTRING, r.right - r.left - 10);
+ if (str != STR_NULL) DrawString(r.left + 2, r.right - 2, r.top + 1, str, TC_FROMSTRING);
break;
}
@@ -488,7 +488,7 @@ void Window::DrawWidgets() const
DrawFrameRect(r.left, r.top, r.right - 12, r.bottom, wi->colour, FR_NONE);
DrawFrameRect(r.right - 11, r.top, r.right, r.bottom, wi->colour, clicked ? FR_LOWERED : FR_NONE);
DrawString(r.right - (clicked ? 8 : 9), r.top + (clicked ? 2 : 1), STR_0225, TC_BLACK);
- if (str != STR_NULL) DrawStringTruncated(r.left + 2, r.top + 1, str, TC_BLACK, r.right - r.left - 12);
+ if (str != STR_NULL) DrawString(r.left + 2, r.right - 14, r.top + 1, str, TC_BLACK);
break;
}
@@ -499,7 +499,7 @@ void Window::DrawWidgets() const
DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->colour, FR_LOWERED | FR_DARKENED);
DrawFrameRect(r.right - 11, r.top + 1, r.right - 1, r.bottom - 1, wi->colour, clicked ? FR_LOWERED : FR_NONE);
DrawString(r.right - (clicked ? 8 : 9), r.top + (clicked ? 2 : 1), STR_0225, TC_BLACK);
- if (str != STR_NULL) DrawStringTruncated(r.left + 2, r.top + 2, str, TC_BLACK, r.right - r.left - 12);
+ if (str != STR_NULL) DrawString(r.left + 2, r.right - 13, r.top + 2, str, TC_BLACK);
break;
}
}