summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-13 09:56:25 +0000
committerrubidium <rubidium@openttd.org>2010-11-13 09:56:25 +0000
commit30637a8340844abce2aab469295b4160d1f2d532 (patch)
tree9fd08dd8b612649aa6e27fa4f36ca4be3b587e97
parent43f807a9189a1dde0260f40f8553bcc8050a3e1d (diff)
downloadopenttd-30637a8340844abce2aab469295b4160d1f2d532.tar.xz
(svn r21157) -Codechange: remove information about the text direction out of the language "list"
-rw-r--r--src/ai/ai_gui.cpp4
-rw-r--r--src/aircraft_gui.cpp2
-rw-r--r--src/build_vehicle_gui.cpp2
-rw-r--r--src/cheat_gui.cpp4
-rw-r--r--src/company_gui.cpp6
-rw-r--r--src/depot_gui.cpp6
-rw-r--r--src/gfx.cpp4
-rw-r--r--src/graph_gui.cpp10
-rw-r--r--src/industry_gui.cpp10
-rw-r--r--src/music_gui.cpp10
-rw-r--r--src/network/network.cpp2
-rw-r--r--src/network/network_gui.cpp4
-rw-r--r--src/newgrf_gui.cpp6
-rw-r--r--src/news_gui.cpp2
-rw-r--r--src/order_gui.cpp4
-rw-r--r--src/roadveh_gui.cpp2
-rw-r--r--src/settings_gui.cpp10
-rw-r--r--src/ship_gui.cpp2
-rw-r--r--src/signs_gui.cpp2
-rw-r--r--src/smallmap_gui.cpp4
-rw-r--r--src/station_gui.cpp6
-rw-r--r--src/statusbar_gui.cpp4
-rw-r--r--src/strings.cpp9
-rw-r--r--src/strings_func.h1
-rw-r--r--src/strings_type.h1
-rw-r--r--src/terraform_gui.cpp2
-rw-r--r--src/timetable_gui.cpp4
-rw-r--r--src/toolbar_gui.cpp6
-rw-r--r--src/town_gui.cpp4
-rw-r--r--src/train_gui.cpp6
-rw-r--r--src/vehicle_gui.cpp4
-rw-r--r--src/widget.cpp16
-rw-r--r--src/widgets/dropdown.cpp2
-rw-r--r--src/window.cpp10
34 files changed, 86 insertions, 85 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index bf03a4760..b956582d4 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -290,7 +290,7 @@ struct AISettingsWindow : public Window {
int i = 0;
for (; !this->vscroll->IsVisible(i); i++) it++;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
uint buttons_left = rtl ? r.right - 23 : r.left + 4;
uint text_left = r.left + (rtl ? WD_FRAMERECT_LEFT : 28);
uint text_right = r.right - (rtl ? 28 : WD_FRAMERECT_RIGHT);
@@ -360,7 +360,7 @@ struct AISettingsWindow : public Window {
bool bool_item = (config_item.flags & AICONFIG_BOOLEAN) != 0;
int x = pt.x - wid->pos_x;
- if (_dynlang.text_dir == TD_RTL) x = wid->current_x - x;
+ if (_current_text_dir == TD_RTL) x = wid->current_x - x;
x -= 4;
/* One of the arrows is clicked (or green/red rect in case of bool value) */
if (IsInsideMM(x, 0, 21)) {
diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp
index 08c9f8a88..fafa7195f 100644
--- a/src/aircraft_gui.cpp
+++ b/src/aircraft_gui.cpp
@@ -78,7 +78,7 @@ void DrawAircraftDetails(const Aircraft *v, int left, int right, int y)
*/
void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID selection)
{
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
SpriteID sprite = v->GetImage(rtl ? DIR_E : DIR_W);
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index b7252206e..8b018261f 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -842,7 +842,7 @@ void DrawEngineList(VehicleType type, int l, int r, int y, const GUIEngineList *
assert_compile(lengthof(sprite_y_offsets) == lengthof(sprite_widths));
assert(max <= eng_list->Length());
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
int step_size = GetEngineListHeight(type);
int sprite_width = sprite_widths[type];
diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp
index 0b3aa1db4..f9715da85 100644
--- a/src/cheat_gui.cpp
+++ b/src/cheat_gui.cpp
@@ -163,7 +163,7 @@ struct CheatWindow : Window {
int y = r.top + WD_FRAMERECT_TOP + this->header_height;
DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP, y, STR_CHEATS_WARNING, TC_FROMSTRING, SA_CENTER);
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
uint box_left = rtl ? r.right - 12 : r.left + 5;
uint button_left = rtl ? r.right - 40 : r.left + 20;
uint text_left = r.left + (rtl ? WD_FRAMERECT_LEFT: 50);
@@ -280,7 +280,7 @@ struct CheatWindow : Window {
const NWidgetBase *wid = this->GetWidget<NWidgetBase>(CW_PANEL);
uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / (FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL);
uint x = pt.x - wid->pos_x;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
if (rtl) x = wid->current_x - x;
/* Not clicking a button? */
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index d2eb299b3..ff1012777 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -547,7 +547,7 @@ public:
void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
{
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
DrawSprite(SPR_VEH_BUS_SIDE_VIEW, PALETTE_RECOLOUR_START + this->result, rtl ? right - 16 : left + 16, top + 7);
DrawString(rtl ? left + 2 : left + 32, rtl ? right - 32 : right - 2, top + max(0, 13 - FONT_HEIGHT_NORMAL), this->String(), sel ? TC_WHITE : TC_BLACK);
}
@@ -687,7 +687,7 @@ public:
{
if (widget != SCLW_WIDGET_MATRIX) return;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
/* Horizontal coordinates of scheme name column. */
const NWidgetBase *nwi = this->GetWidget<NWidgetBase>(SCLW_WIDGET_SPACER_DROPDOWN);
@@ -776,7 +776,7 @@ public:
if (j >= LS_END) return;
/* If clicking on the left edge, toggle using the livery */
- if (_dynlang.text_dir == TD_RTL ? pt.x - wid->pos_x > wid->current_x - TEXT_INDENT : pt.x - wid->pos_x < TEXT_INDENT) {
+ if (_current_text_dir == TD_RTL ? pt.x - wid->pos_x > wid->current_x - TEXT_INDENT : pt.x - wid->pos_x < TEXT_INDENT) {
DoCommandP(0, j | (2 << 8), !Company::Get((CompanyID)this->window_number)->livery[j].in_use, CMD_SET_COMPANY_COLOUR);
}
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 05ef295e6..0e4d195bc 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -273,7 +273,7 @@ struct DepotWindow : Window {
bool free_wagon = false;
int sprite_y = y + (this->resize.step_height - GetVehicleHeight(v->type)) / 2;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
int image_left = rtl ? left + this->count_width : left + this->header_width;
int image_right = rtl ? right - this->header_width : right - this->count_width;
@@ -331,7 +331,7 @@ struct DepotWindow : Window {
{
if (widget != DEPOT_WIDGET_MATRIX) return;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
/* Set the row and number of boxes in each row based on the number of boxes drawn in the matrix */
uint16 mat_data = this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->widget_data;
@@ -389,7 +389,7 @@ struct DepotWindow : Window {
{
const NWidgetCore *matrix_widget = this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX);
/* In case of RTL the widgets are swapped as a whole */
- if (_dynlang.text_dir == TD_RTL) x = matrix_widget->current_x - x;
+ if (_current_text_dir == TD_RTL) x = matrix_widget->current_x - x;
uint xt = 0, xm = 0, ym = 0;
if (this->type == VEH_TRAIN) {
diff --git a/src/gfx.cpp b/src/gfx.cpp
index e28255db2..44c480cfb 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -346,7 +346,7 @@ static UChar *HandleBiDiAndArabicShapes(UChar *buffer)
UBiDi *para = ubidi_openSized((int32_t)length, 0, &err);
if (para == NULL) return buffer;
- ubidi_setPara(para, input_output, (int32_t)length, _dynlang.text_dir == TD_RTL ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR, NULL, &err);
+ ubidi_setPara(para, input_output, (int32_t)length, _current_text_dir == TD_RTL ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR, NULL, &err);
ubidi_writeReordered(para, intermediate, (int32_t)length, UBIDI_REMOVE_BIDI_CONTROLS, &err);
length = u_shapeArabic(intermediate, (int32_t)length, input_output, lengthof(input_output), U_SHAPE_TEXT_DIRECTION_VISUAL_LTR | U_SHAPE_LETTERS_SHAPE, &err);
ubidi_close(para);
@@ -555,7 +555,7 @@ static int DrawString(int left, int right, int top, char *str, const char *last,
}
/* In case we have a RTL language we swap the alignment. */
- if (!(align & SA_FORCE) && _dynlang.text_dir == TD_RTL && !(align & SA_STRIP) && (align & SA_HOR_MASK) != SA_HOR_CENTER) align ^= SA_RIGHT;
+ if (!(align & SA_FORCE) && _current_text_dir == TD_RTL && !(align & SA_STRIP) && (align & SA_HOR_MASK) != SA_HOR_CENTER) align ^= SA_RIGHT;
for (UChar **iter = setx_offsets.Begin(); iter != setx_offsets.End(); iter++) {
UChar *to_draw = *iter;
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index c40ca2ae1..f646bb318 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -74,7 +74,7 @@ struct GraphLegendWindow : Window {
if (!Company::IsValidID(cid)) return;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
DrawCompanyIcon(cid, rtl ? r.right - 16 : r.left + 2, r.top + 2 + (FONT_HEIGHT_NORMAL - 10) / 2);
@@ -964,7 +964,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
}
const CargoSpec *cs = _sorted_cargo_specs[widget - CPW_CARGO_FIRST];
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
/* Since the buttons have no text, no images,
* both the text and the coloured box have to be manually painted.
@@ -1196,7 +1196,7 @@ public:
uint y = r.top + WD_FRAMERECT_TOP;
int icon_y_offset = 1 + (FONT_HEIGHT_NORMAL - 10) / 2;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
uint ordinal_left = rtl ? r.right - WD_FRAMERECT_LEFT - this->ordinal_width : r.left + WD_FRAMERECT_LEFT;
uint ordinal_right = rtl ? r.right - WD_FRAMERECT_LEFT : r.left + WD_FRAMERECT_LEFT + this->ordinal_width;
uint icon_left = r.left + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT + (rtl ? this->text_width : this->ordinal_width);
@@ -1381,7 +1381,7 @@ struct PerformanceRatingDetailWindow : Window {
uint left = 7;
uint right = size->width - 7;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
this->score_info_left = rtl ? right - score_info_width : left;
this->score_info_right = rtl ? right : left + score_info_width;
@@ -1444,7 +1444,7 @@ struct PerformanceRatingDetailWindow : Window {
/* Calculate the %-bar */
uint x = Clamp(val, 0, needed) * this->bar_width / needed;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
if (rtl) {
x = this->bar_right - x;
} else {
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 0766122c8..b574cee06 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -1654,7 +1654,7 @@ struct CargoesField {
/* Draw the industry legend. */
int blob_left, blob_right;
- if (_dynlang.text_dir == TD_RTL) {
+ if (_current_text_dir == TD_RTL) {
blob_right = xpos2 - BLOB_DISTANCE;
blob_left = blob_right - BLOB_WIDTH;
} else {
@@ -1669,7 +1669,7 @@ struct CargoesField {
/* Draw the other_produced/other_accepted cargoes. */
const CargoID *other_right, *other_left;
- if (_dynlang.text_dir == TD_RTL) {
+ if (_current_text_dir == TD_RTL) {
other_right = this->u.industry.other_accepted;
other_left = this->u.industry.other_produced;
} else {
@@ -1713,7 +1713,7 @@ struct CargoesField {
}
const CargoID *hor_left, *hor_right;
- if (_dynlang.text_dir == TD_RTL) {
+ if (_current_text_dir == TD_RTL) {
hor_left = this->u.cargo.cust_cargoes;
hor_right = this->u.cargo.supp_cargoes;
} else {
@@ -2434,7 +2434,7 @@ struct IndustryCargoesWindow : public Window {
if (vpos + row_height >= 0) {
int xpos = left_pos;
int col, dir;
- if (_dynlang.text_dir == TD_RTL) {
+ if (_current_text_dir == TD_RTL) {
col = last_column;
dir = -1;
} else {
@@ -2490,7 +2490,7 @@ struct IndustryCargoesWindow : public Window {
/* Return both positions, compensating for RTL languages (which works due to the equal symmetry in both displays). */
fieldxy->y = row;
xy->y = vpos;
- if (_dynlang.text_dir == TD_RTL) {
+ if (_current_text_dir == TD_RTL) {
fieldxy->x = num_columns - column;
xy->x = ((column & 1) ? CargoesField::CARGO_FIELD_WIDTH : CargoesField::industry_width) - xpos;
} else {
diff --git a/src/music_gui.cpp b/src/music_gui.cpp
index 45d03b0d5..740744e3e 100644
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -580,9 +580,9 @@ struct MusicWindow : public Window {
/* Hack-ish: set the proper widget data; only needs to be done once
* per (Re)Init as that's the only time the language changes. */
- case MW_PREV: this->GetWidget<NWidgetCore>(MW_PREV)->widget_data = _dynlang.text_dir == TD_RTL ? SPR_IMG_SKIP_TO_NEXT : SPR_IMG_SKIP_TO_PREV; break;
- case MW_NEXT: this->GetWidget<NWidgetCore>(MW_NEXT)->widget_data = _dynlang.text_dir == TD_RTL ? SPR_IMG_SKIP_TO_PREV : SPR_IMG_SKIP_TO_NEXT; break;
- case MW_PLAY: this->GetWidget<NWidgetCore>(MW_PLAY)->widget_data = _dynlang.text_dir == TD_RTL ? SPR_IMG_PLAY_MUSIC_RTL : SPR_IMG_PLAY_MUSIC; break;
+ case MW_PREV: this->GetWidget<NWidgetCore>(MW_PREV)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_SKIP_TO_NEXT : SPR_IMG_SKIP_TO_PREV; break;
+ case MW_NEXT: this->GetWidget<NWidgetCore>(MW_NEXT)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_SKIP_TO_PREV : SPR_IMG_SKIP_TO_NEXT; break;
+ case MW_PLAY: this->GetWidget<NWidgetCore>(MW_PLAY)->widget_data = _current_text_dir == TD_RTL ? SPR_IMG_PLAY_MUSIC_RTL : SPR_IMG_PLAY_MUSIC; break;
}
}
@@ -631,7 +631,7 @@ struct MusicWindow : public Window {
DrawFrameRect(r.left, r.top + 2, r.right, r.bottom - 2, COLOUR_GREY, FR_LOWERED);
byte volume = (widget == MW_MUSIC_VOL) ? msf.music_vol : msf.effect_vol;
int x = (volume * (r.right - r.left) / 127);
- if (_dynlang.text_dir == TD_RTL) {
+ if (_current_text_dir == TD_RTL) {
x = r.right - x;
} else {
x += r.left;
@@ -684,7 +684,7 @@ struct MusicWindow : public Window {
byte *vol = (widget == MW_MUSIC_VOL) ? &msf.music_vol : &msf.effect_vol;
byte new_vol = x * 127 / this->GetWidget<NWidgetBase>(widget)->current_x;
- if (_dynlang.text_dir == TD_RTL) new_vol = 127 - new_vol;
+ if (_current_text_dir == TD_RTL) new_vol = 127 - new_vol;
if (new_vol != *vol) {
*vol = new_vol;
if (widget == MW_MUSIC_VOL) MusicVolumeChanged(new_vol);
diff --git a/src/network/network.cpp b/src/network/network.cpp
index 69c238e25..050b644ba 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -207,7 +207,7 @@ void NetworkTextMessage(NetworkAction action, ConsoleColour colour, bool self_se
* right-to-left characters depending on the context. As the next text might be an user's name, the
* user name's characters will influence the direction of the "***" instead of the language setting
* of the game. Manually set the direction of the "***" by inserting a text-direction marker. */
- char *msg_ptr = message + Utf8Encode(message, _dynlang.text_dir == TD_LTR ? CHAR_TD_LRM : CHAR_TD_RLM);
+ char *msg_ptr = message + Utf8Encode(message, _current_text_dir == TD_LTR ? CHAR_TD_LRM : CHAR_TD_RLM);
GetString(msg_ptr, strid, lastof(message));
DEBUG(desync, 1, "msg: %08x; %02x; %s", _date, _date_fract, message);
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 8e312e5a5..6db9f5d1b 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -1543,7 +1543,7 @@ struct NetworkLobbyWindow : public Window {
void DrawMatrix(const Rect &r) const
{
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
uint left = r.left + WD_FRAMERECT_LEFT;
uint right = r.right - WD_FRAMERECT_RIGHT;
@@ -2064,7 +2064,7 @@ struct NetworkClientListWindow : Window {
{
if (widget != CLW_PANEL) return;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
int icon_y_offset = 1 + (FONT_HEIGHT_NORMAL - 10) / 2;
uint y = r.top + WD_FRAMERECT_TOP;
uint left = r.left + WD_FRAMERECT_LEFT;
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 3ee1a8a19..6836b13e7 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -243,7 +243,7 @@ struct NewGRFParametersWindow : public Window {
return;
}
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
uint buttons_left = rtl ? r.right - 23 : r.left + 4;
uint text_left = r.left + (rtl ? WD_FRAMERECT_LEFT : 28);
uint text_right = r.right - (rtl ? 28 : WD_FRAMERECT_RIGHT);
@@ -316,7 +316,7 @@ struct NewGRFParametersWindow : public Window {
const NWidgetBase *wid = this->GetWidget<NWidgetBase>(GRFPAR_WIDGET_BACKGROUND);
int x = pt.x - wid->pos_x;
- if (_dynlang.text_dir == TD_RTL) x = wid->current_x - x;
+ if (_current_text_dir == TD_RTL) x = wid->current_x - x;
x -= 4;
GRFParameterInfo *par_info = (num < this->grf_config->param_info.Length()) ? this->grf_config->param_info[num] : NULL;
@@ -700,7 +700,7 @@ struct NewGRFWindow : public QueryStringBaseWindow {
int sprite_offset_y = (step_height - 10) / 2;
int offset_y = (step_height - FONT_HEIGHT_NORMAL) / 2;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
uint text_left = rtl ? r.left + WD_FRAMERECT_LEFT : r.left + 25;
uint text_right = rtl ? r.right - 25 : r.right - WD_FRAMERECT_RIGHT;
uint square_left = rtl ? r.right - 15 : r.left + 5;
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index 19537b177..4e2ebd4f9 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -994,7 +994,7 @@ struct MessageHistoryWindow : Window {
/* Fill the widget with news items. */
int y = r.top + this->top_spacing;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
uint date_left = rtl ? r.right - WD_FRAMERECT_RIGHT - this->date_width : r.left + WD_FRAMERECT_LEFT;
uint date_right = rtl ? r.right - WD_FRAMERECT_RIGHT : r.left + WD_FRAMERECT_LEFT + this->date_width;
uint news_left = rtl ? r.left + WD_FRAMERECT_LEFT : r.left + WD_FRAMERECT_LEFT + this->date_width + WD_FRAMERECT_RIGHT;
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 1fb52dc80..2a6dacaf8 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -188,7 +188,7 @@ static int DepotActionStringIndex(const Order *order)
*/
void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int left, int middle, int right)
{
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
SpriteID sprite = rtl ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT;
Dimension sprite_size = GetSpriteSize(sprite);
@@ -944,7 +944,7 @@ public:
{
if (widget != ORDER_WIDGET_ORDER_LIST) return;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
SetDParam(0, 99);
int index_column_width = GetStringBoundingBox(STR_ORDER_INDEX).width + GetSpriteSize(rtl ? SPR_ARROW_RIGHT : SPR_ARROW_LEFT).width + 3;
int middle = rtl ? r.right - WD_FRAMETEXT_RIGHT - index_column_width : r.left + WD_FRAMETEXT_LEFT + index_column_width;
diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp
index abe6441e1..d25f43655 100644
--- a/src/roadveh_gui.cpp
+++ b/src/roadveh_gui.cpp
@@ -131,7 +131,7 @@ void DrawRoadVehDetails(const Vehicle *v, int left, int right, int y)
*/
void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection)
{
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
Direction dir = rtl ? DIR_E : DIR_W;
const RoadVehicle *u = RoadVehicle::From(v);
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 4ab938f80..14476b5dd 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1046,7 +1046,7 @@ uint SettingEntry::Draw(GameSettings *settings_ptr, int left, int right, int bas
{
if (cur_row >= max_row) return cur_row;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
int offset = rtl ? -4 : 4;
int level_width = rtl ? -LEVEL_WIDTH : LEVEL_WIDTH;
@@ -1126,7 +1126,7 @@ void SettingEntry::DrawSetting(GameSettings *settings_ptr, const SettingDesc *sd
bool editable = true;
bool disabled = false;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
uint buttons_left = rtl ? right - 19 : left;
uint text_left = left + (rtl ? 0 : 25);
uint text_right = right - (rtl ? 25 : 0);
@@ -1566,7 +1566,7 @@ struct GameSettingsWindow : Window {
if (pe == NULL) return; // Clicked below the last setting of the page
- int x = (_dynlang.text_dir == TD_RTL ? this->width - pt.x : pt.x) - SETTINGTREE_LEFT_OFFSET - (pe->level + 1) * LEVEL_WIDTH; // Shift x coordinate
+ int x = (_current_text_dir == TD_RTL ? this->width - pt.x : pt.x) - SETTINGTREE_LEFT_OFFSET - (pe->level + 1) * LEVEL_WIDTH; // Shift x coordinate
if (x < 0) return; // Clicked left of the entry
if ((pe->flags & SEF_KIND_MASK) == SEF_SUBTREE_KIND) {
@@ -1631,7 +1631,7 @@ struct GameSettingsWindow : Window {
this->clicked_entry->SetButtons(0);
}
this->clicked_entry = pe;
- this->clicked_entry->SetButtons((x >= 10) != (_dynlang.text_dir == TD_RTL) ? SEF_RIGHT_DEPRESSED : SEF_LEFT_DEPRESSED);
+ this->clicked_entry->SetButtons((x >= 10) != (_current_text_dir == TD_RTL) ? SEF_RIGHT_DEPRESSED : SEF_LEFT_DEPRESSED);
this->flags4 |= WF_TIMEOUT_BEGIN;
_left_button_clicked = false;
}
@@ -1753,7 +1753,7 @@ void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clic
DrawSprite(SPR_ARROW_RIGHT, PAL_NONE, x + WD_IMGBTN_LEFT + 10, y + WD_IMGBTN_TOP);
/* Grey out the buttons that aren't clickable */
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
if (rtl ? !clickable_right : !clickable_left) {
GfxFillRect(x + 1, y + 1, x + 1 + 8, y + 8, colour, FILLRECT_CHECKER);
}
diff --git a/src/ship_gui.cpp b/src/ship_gui.cpp
index 34d88f2e9..9580d578e 100644
--- a/src/ship_gui.cpp
+++ b/src/ship_gui.cpp
@@ -30,7 +30,7 @@
*/
void DrawShipImage(const Vehicle *v, int left, int right, int y, VehicleID selection)
{
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
SpriteID sprite = v->GetImage(rtl ? DIR_E : DIR_W);
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 45564cc99..7a6032596 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -229,7 +229,7 @@ struct SignListWindow : QueryStringBaseWindow, SignList {
return;
}
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
int sprite_offset_y = (FONT_HEIGHT_NORMAL - 10) / 2 + 1;
uint icon_left = 4 + (rtl ? r.right - this->text_offset : r.left);
uint text_left = r.left + (rtl ? WD_FRAMERECT_LEFT : this->text_offset);
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index 99250ac6b..6d7184b3e 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -1081,7 +1081,7 @@ public:
case SM_WIDGET_LEGEND: {
uint columns = this->GetNumberColumnsLegend(r.right - r.left + 1);
uint number_of_rows = max(this->map_type == SMT_INDUSTRY ? CeilDiv(_smallmap_industry_count, columns) : 0, this->min_number_of_fixed_rows);
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
uint y_org = r.top + WD_FRAMERECT_TOP;
uint x = rtl ? r.right - this->column_width - WD_FRAMERECT_RIGHT : r.left + WD_FRAMERECT_LEFT;
uint y = y_org;
@@ -1226,7 +1226,7 @@ public:
uint number_of_rows = max(CeilDiv(_smallmap_industry_count, columns), this->min_number_of_fixed_rows);
if (line >= number_of_rows) break;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
int x = pt.x - wi->pos_x;
if (rtl) x = wi->current_x - x;
uint column = (x - WD_FRAMERECT_LEFT) / this->column_width;
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index cf886eb57..41194e4b4 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -450,7 +450,7 @@ public:
break;
case SLW_LIST: {
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->stations.Length());
int y = r.top + WD_FRAMERECT_TOP;
for (int i = this->vscroll->GetPosition(); i < max; ++i) { // do until max number of stations of owner
@@ -850,7 +850,7 @@ static void DrawCargoIcons(CargoID i, uint waiting, int left, int right, int y)
SpriteID sprite = CargoSpec::Get(i)->GetCargoIcon();
- int x = _dynlang.text_dir == TD_RTL ? right - num * 10 : left;
+ int x = _current_text_dir == TD_RTL ? right - num * 10 : left;
do {
DrawSprite(sprite, PAL_NONE, x, y);
x += 10;
@@ -1059,7 +1059,7 @@ struct StationViewWindow : public Window {
y += FONT_HEIGHT_NORMAL;
}
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
int text_left = rtl ? r.left + this->expand_shrink_width : r.left + WD_FRAMERECT_LEFT;
int text_right = rtl ? r.right - WD_FRAMERECT_LEFT : r.right - this->expand_shrink_width;
int shrink_left = rtl ? r.left + WD_FRAMERECT_LEFT : r.right - this->expand_shrink_width + WD_FRAMERECT_LEFT;
diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp
index 021e73e52..a9bc17e95 100644
--- a/src/statusbar_gui.cpp
+++ b/src/statusbar_gui.cpp
@@ -62,14 +62,14 @@ static bool DrawScrollingStatusText(const NewsItem *ni, int scroll_pos, int left
if (!FillDrawPixelInfo(&tmp_dpi, left, top, right - left, bottom)) return true;
int width = GetStringBoundingBox(buffer).width;
- int pos = (_dynlang.text_dir == TD_RTL) ? (scroll_pos - width) : (right - scroll_pos - left);
+ int pos = (_current_text_dir == TD_RTL) ? (scroll_pos - width) : (right - scroll_pos - left);
DrawPixelInfo *old_dpi = _cur_dpi;
_cur_dpi = &tmp_dpi;
DrawString(pos, INT16_MAX, 0, buffer, TC_LIGHT_BLUE, SA_LEFT | SA_FORCE);
_cur_dpi = old_dpi;
- return (_dynlang.text_dir == TD_RTL) ? (pos < right - left) : (pos + width > 0);
+ return (_current_text_dir == TD_RTL) ? (pos < right - left) : (pos + width > 0);
}
enum StatusbarWidget {
diff --git a/src/strings.cpp b/src/strings.cpp
index 3318acdd4..d1fffe6f6 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -40,8 +40,9 @@
#include "table/strings.h"
#include "table/control_codes.h"
-DynamicLanguages _dynlang; ///< Language information of the program.
-uint64 _decode_parameters[20]; ///< Global array of string parameters. To access, use #SetDParam.
+DynamicLanguages _dynlang; ///< Language information of the program.
+TextDirection _current_text_dir; ///< Text direction of the currently selected language
+uint64 _decode_parameters[20]; ///< Global array of string parameters. To access, use #SetDParam.
static char *StationGetSpecialString(char *buff, int x, const char *last);
static char *GetSpecialTownNameString(char *buff, int ind, uint32 seed, const char *last);
@@ -1385,7 +1386,7 @@ bool ReadLanguagePack(int lang_index)
strecpy(_dynlang.curr_file, c_file, lastof(_dynlang.curr_file));
_dynlang.curr = lang_index;
- _dynlang.text_dir = (TextDirection)lang_pack->text_dir;
+ _current_text_dir = (TextDirection)lang_pack->text_dir;
SetCurrentGrfLangID(_langpack->newgrflangid);
InitializeSortedCargoSpecs();
SortIndustryTypes();
@@ -1701,7 +1702,7 @@ void CheckForMissingGlyphsInLoadedLanguagePack()
* exactly three characters, so it replaces the "XXX" with
* the colour marker.
*/
- if (_dynlang.text_dir != TD_LTR) {
+ if (_current_text_dir != TD_LTR) {
static char *err_str = strdup("XXXThis version of OpenTTD does not support right-to-left languages. Recompile with icu enabled.");
Utf8Encode(err_str, SCC_YELLOW);
SetDParamStr(0, err_str);
diff --git a/src/strings_func.h b/src/strings_func.h
index e9a22288d..6d7e5dc33 100644
--- a/src/strings_func.h
+++ b/src/strings_func.h
@@ -96,6 +96,7 @@ static inline void CopyOutDParam(uint64 *dst, int offs, int num)
}
extern DynamicLanguages _dynlang; // defined in strings.cpp
+extern TextDirection _current_text_dir; ///< Text direction of the currently selected language
bool ReadLanguagePack(int index);
void InitializeLanguagePacks();
diff --git a/src/strings_type.h b/src/strings_type.h
index a1c45f341..0987c2e9b 100644
--- a/src/strings_type.h
+++ b/src/strings_type.h
@@ -37,7 +37,6 @@ struct DynamicLanguages {
int num; ///< Number of languages
int curr; ///< Currently selected language index
char curr_file[MAX_PATH]; ///< Currently selected language file name without path (needed for saving the filename of the loaded language).
- TextDirection text_dir; ///< Text direction of the currently selected language
Language ent[MAX_LANG]; ///< Information about the languages
};
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index 51112d821..349e539ba 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -373,7 +373,7 @@ Window *ShowTerraformToolbar(Window *link)
w->top -= w->height;
w->SetDirty();
/* Put the linked toolbar to the left / right of it. */
- link->left = w->left + (_dynlang.text_dir == TD_RTL ? w->width : -link->width);
+ link->left = w->left + (_current_text_dir == TD_RTL ? w->width : -link->width);
link->top = w->top;
link->SetDirty();
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index 0a470a7b0..026d20a10 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -364,7 +364,7 @@ struct TimetableWindow : Window {
VehicleOrderID order_id = (i + 1) / 2;
bool final_order = false;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
SetDParam(0, 99);
int index_column_width = GetStringBoundingBox(STR_ORDER_INDEX).width + GetSpriteSize(rtl ? SPR_ARROW_RIGHT : SPR_ARROW_LEFT).width + 3;
int middle = rtl ? r.right - WD_FRAMERECT_RIGHT - index_column_width : r.left + WD_FRAMERECT_LEFT + index_column_width;
@@ -426,7 +426,7 @@ struct TimetableWindow : Window {
bool show_late = this->show_expected && v->lateness_counter > DAY_TICKS;
Ticks offset = show_late ? 0 : -v->lateness_counter;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
int abbr_left = rtl ? r.right - WD_FRAMERECT_RIGHT - this->deparr_abbr_width : r.left + WD_FRAMERECT_LEFT;
int abbr_right = rtl ? r.right - WD_FRAMERECT_RIGHT : r.left + WD_FRAMERECT_LEFT + this->deparr_abbr_width;
int time_left = rtl ? r.left + WD_FRAMERECT_LEFT : r.right - WD_FRAMERECT_RIGHT - this->deparr_time_width;
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index b703f6790..c57084dfa 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -138,7 +138,7 @@ public:
void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
{
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
if (this->checked) {
DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, STR_JUST_CHECKMARK, sel ? TC_WHITE : TC_BLACK);
}
@@ -177,7 +177,7 @@ public:
void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
{
CompanyID company = (CompanyID)this->result;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
/* It's possible the company is deleted while the dropdown is open */
if (!Company::IsValidID(company)) return;
@@ -1054,7 +1054,7 @@ public:
GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1, 0xB2);
GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1, 0xB4, FILLRECT_CHECKER);
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
for (NWidgetBase *child_wid = rtl ? this->tail : this->head; child_wid != NULL; child_wid = rtl ? child_wid->prev : child_wid->next) {
if (child_wid->type == NWID_SPACER) continue;
if (!this->visible[((NWidgetCore*)child_wid)->index]) continue;
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 35544cd2e..c3bf70312 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -144,7 +144,7 @@ public:
int exclusive_width = exclusive_size.width;
int exclusive_y_offset = (FONT_HEIGHT_NORMAL - exclusive_size.height) / 2;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
uint text_left = left + (rtl ? 0 : icon_width + exclusive_width + 4);
uint text_right = right - (rtl ? icon_width + exclusive_width + 4 : 0);
uint icon_left = rtl ? right - icon_width : left;
@@ -398,7 +398,7 @@ public:
if (cargo_needed_for_growth > 0) {
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, y += FONT_HEIGHT_NORMAL, STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH);
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
uint cargo_text_left = r.left + WD_FRAMERECT_LEFT + (rtl ? 0 : 20);
uint cargo_text_right = r.right - WD_FRAMERECT_RIGHT - (rtl ? 20 : 0);
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index 73bb7afa6..616b2d5c9 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -55,7 +55,7 @@ void CcBuildWagon(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p
*/
static int HighlightDragPosition(int px, int max_width, VehicleID selection)
{
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
assert(selection != INVALID_VEHICLE);
Point offset;
@@ -85,7 +85,7 @@ static int HighlightDragPosition(int px, int max_width, VehicleID selection)
*/
void DrawTrainImage(const Train *v, int left, int right, int y, VehicleID selection, int skip, VehicleID drag_dest)
{
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
Direction dir = rtl ? DIR_E : DIR_W;
DrawPixelInfo tmp_dpi, *old_dpi;
@@ -335,7 +335,7 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
{
/* draw the first 3 details tabs */
if (det_tab != TDW_TAB_TOTALS) {
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
Direction dir = rtl ? DIR_E : DIR_W;
int x = rtl ? right : left;
int sprite_y_offset = 4 + (FONT_HEIGHT_NORMAL - 10) / 2;
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index a5215f914..56c043d63 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1032,7 +1032,7 @@ void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle, int
int left = r.left + WD_MATRIX_LEFT;
int right = r.right - WD_MATRIX_RIGHT;
int width = right - left;
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
int text_offset = GetDigitWidth() * this->unitnumber_digits + WD_FRAMERECT_RIGHT;
int text_left = left + (rtl ? 0 : text_offset);
@@ -1739,7 +1739,7 @@ struct VehicleDetailsWindow : Window {
case VLD_WIDGET_MIDDLE_DETAILS: {
/* For other vehicles, at the place of the matrix. */
- bool rtl = _dynlang.text_dir == TD_RTL;
+ bool rtl = _current_text_dir == TD_RTL;
uint sprite_width = max<uint>(GetSprite(v->GetImage(rtl ? DIR_E : DIR_W), ST_NORMAL)->width, 70U) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
uint text_left = r.left + (rtl ? 0 : sprite_width);
diff --git a/src/widget.cpp b/src/widget.cpp
index df89438ca..4831284fb 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -52,7 +52,7 @@ static Point HandleScrollbarHittest(const Scrollbar *sb, int top, int bottom, bo
if (count != 0) bottom -= (count - pos - cap) * height / count;
Point pt;
- if (horizontal && _dynlang.text_dir == TD_RTL) {
+ if (horizontal && _current_text_dir == TD_RTL) {
pt.x = rev_base - (bottom - 1);
pt.y = rev_base - top;
} else {
@@ -78,7 +78,7 @@ static void ScrollbarClickPositioning(Window *w, NWidgetScrollbar *sb, int x, in
if (sb->type == NWID_HSCROLLBAR) {
pos = x;
- rtl = _dynlang.text_dir == TD_RTL;
+ rtl = _current_text_dir == TD_RTL;
} else {
pos = y;
}
@@ -387,7 +387,7 @@ static inline void DrawFrame(const Rect &r, Colours colour, StringID str)
if (str != STR_NULL) dy1 = FONT_HEIGHT_NORMAL / 2 - 1;
int dy2 = dy1 + 1;
- if (_dynlang.text_dir == TD_LTR) {
+ if (_current_text_dir == TD_LTR) {
/* Line from upper left corner to start of text */
GfxFillRect(r.left, r.top + dy1, r.left + 4, r.top + dy1, c1);
GfxFillRect(r.left + 1, r.top + dy2, r.left + 4, r.top + dy2, c2);
@@ -514,7 +514,7 @@ void DrawCaption(const Rect &r, Colours colour, Owner owner, StringID str)
*/
static inline void DrawButtonDropdown(const Rect &r, Colours colour, bool clicked_button, bool clicked_dropdown, StringID str)
{
- if (_dynlang.text_dir == TD_LTR) {
+ if (_current_text_dir == TD_LTR) {
DrawFrameRect(r.left, r.top, r.right - 12, r.bottom, colour, clicked_button ? FR_LOWERED : FR_NONE);
DrawFrameRect(r.right - 11, r.top, r.right, r.bottom, colour, clicked_dropdown ? FR_LOWERED : FR_NONE);
DrawString(r.right - (clicked_dropdown ? 10 : 11), r.right, r.top + (clicked_dropdown ? 2 : 1), DOWNARROW, TC_BLACK, SA_HOR_CENTER);
@@ -564,7 +564,7 @@ void Window::DrawSortButtonState(int widget, SortButtonState state) const
const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(widget);
int offset = this->IsWidgetLowered(widget) ? 1 : 0;
- int base = offset + nwid->pos_x + (_dynlang.text_dir == TD_LTR ? nwid->current_x - WD_SORTBUTTON_ARROW_WIDTH : 0);
+ int base = offset + nwid->pos_x + (_current_text_dir == TD_LTR ? nwid->current_x - WD_SORTBUTTON_ARROW_WIDTH : 0);
int top = nwid->pos_y;
DrawString(base, base + WD_SORTBUTTON_ARROW_WIDTH, top + 1 + offset, state == SBS_DOWN ? DOWNARROW : UPARROW, TC_BLACK, SA_HOR_CENTER);
@@ -2014,8 +2014,8 @@ void NWidgetLeaf::Draw(const Window *w)
case WWT_PUSHARROWBTN: {
SpriteID sprite;
switch (this->widget_data) {
- case AWV_DECREASE: sprite = _dynlang.text_dir != TD_RTL ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT; break;
- case AWV_INCREASE: sprite = _dynlang.text_dir == TD_RTL ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT; break;
+ case AWV_DECREASE: sprite = _current_text_dir != TD_RTL ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT; break;
+ case AWV_INCREASE: sprite = _current_text_dir == TD_RTL ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT; break;
case AWV_LEFT: sprite = SPR_ARROW_LEFT; break;
case AWV_RIGHT: sprite = SPR_ARROW_RIGHT; break;
default: NOT_REACHED();
@@ -2098,7 +2098,7 @@ void NWidgetLeaf::Draw(const Window *w)
*/
bool NWidgetLeaf::ButtonHit(const Point &pt)
{
- if (_dynlang.text_dir == TD_LTR) {
+ if (_current_text_dir == TD_LTR) {
int button_width = this->pos_x + this->current_x - 12;
return pt.x < button_width;
} else {
diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp
index ca859e799..80b06e6f5 100644
--- a/src/widgets/dropdown.cpp
+++ b/src/widgets/dropdown.cpp
@@ -413,7 +413,7 @@ void ShowDropDownList(Window *w, DropDownList *list, int selected, int button, u
if (auto_width) width = max(width, max_item_width);
- Point dw_pos = { w->left + (_dynlang.text_dir == TD_RTL ? wi_rect.right + 1 - width : wi_rect.left), top};
+ Point dw_pos = { w->left + (_current_text_dir == TD_RTL ? wi_rect.right + 1 - width : wi_rect.left), top};
Dimension dw_size = {width, height};
new DropdownWindow(w, list, selected, button, instant_close, dw_pos, dw_size, wi_colour, scroll);
}
diff --git a/src/window.cpp b/src/window.cpp
index 9d8213261..8d219ea45 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -573,7 +573,7 @@ void Window::ReInit(int rx, int ry)
this->OnInit();
/* Re-initialize the window from the ground up. No need to change the nested_array, as all widgets stay where they are. */
this->nested_root->SetupSmallestSize(this, false);
- this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _dynlang.text_dir == TD_RTL);
+ this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _current_text_dir == TD_RTL);
this->width = this->nested_root->smallest_x;
this->height = this->nested_root->smallest_y;
this->resize.step_width = this->nested_root->resize_x;
@@ -907,7 +907,7 @@ void Window::InitializeData(const WindowDesc *desc, WindowNumber window_number)
this->nested_root->SetupSmallestSize(this, false);
}
/* Initialize to smallest size. */
- this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _dynlang.text_dir == TD_RTL);
+ this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _current_text_dir == TD_RTL);
/* Further set up window properties,
* this->left, this->top, this->width, this->height, this->resize.width, and this->resize.height are initialized later. */
@@ -1186,7 +1186,7 @@ Point GetToolbarAlignedWindowPosition(int window_width)
{
const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
assert(w != NULL);
- Point pt = { _dynlang.text_dir == TD_RTL ? w->left : (w->left + w->width) - window_width, w->top + w->height };
+ Point pt = { _current_text_dir == TD_RTL ? w->left : (w->left + w->width) - window_width, w->top + w->height };
return pt;
}
@@ -1594,7 +1594,7 @@ void ResizeWindow(Window *w, int delta_x, int delta_y)
assert(w->nested_root->resize_x == 0 || new_xinc % w->nested_root->resize_x == 0);
assert(w->nested_root->resize_y == 0 || new_yinc % w->nested_root->resize_y == 0);
- w->nested_root->AssignSizePosition(ST_RESIZE, 0, 0, w->nested_root->smallest_x + new_xinc, w->nested_root->smallest_y + new_yinc, _dynlang.text_dir == TD_RTL);
+ w->nested_root->AssignSizePosition(ST_RESIZE, 0, 0, w->nested_root->smallest_x + new_xinc, w->nested_root->smallest_y + new_yinc, _current_text_dir == TD_RTL);
w->width = w->nested_root->current_x;
w->height = w->nested_root->current_y;
}
@@ -1861,7 +1861,7 @@ static EventState HandleScrollbarScrolling()
if (sb->type == NWID_HSCROLLBAR) {
i = _cursor.pos.x - _cursorpos_drag_start.x;
- rtl = _dynlang.text_dir == TD_RTL;
+ rtl = _current_text_dir == TD_RTL;
} else {
i = _cursor.pos.y - _cursorpos_drag_start.y;
}