# HG changeset patch # User sbr # Date 1375531718 -7200 # Sat Aug 03 14:08:38 2013 +0200 # Node ID 04da75219e19a94dddfa63c038cdb2c84ec96d8e # Parent 34230cec1ffb276ab415d72e369c22c480ee777b -Fix (r24839, r24203): When drawing EngineList in RTL mode, correctly align the engine name and the engine count. diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -898,7 +898,7 @@ void DrawEngineList(VehicleType type, in int text_left = l + (rtl ? WD_FRAMERECT_LEFT + replace_icon.width + 8 + count_width : sprite_width + WD_FRAMETEXT_LEFT); int text_right = r - (rtl ? sprite_width + WD_FRAMETEXT_RIGHT : WD_FRAMERECT_RIGHT + replace_icon.width + 8 + count_width); int replace_icon_left = rtl ? l + WD_FRAMERECT_LEFT : r - WD_FRAMERECT_RIGHT - replace_icon.width; - int count_left = l; + int count_left = rtl ? l + WD_FRAMERECT_LEFT + replace_icon.width + 8 : text_right; int count_right = rtl ? text_left : r - WD_FRAMERECT_RIGHT - replace_icon.width - 8; int normal_text_y_offset = (step_size - FONT_HEIGHT_NORMAL) / 2; @@ -911,11 +911,11 @@ void DrawEngineList(VehicleType type, in const uint num_engines = GetGroupNumEngines(_local_company, selected_group, engine); SetDParam(0, engine); - DrawString(text_left, text_right, y + normal_text_y_offset, STR_ENGINE_NAME, engine == selected_id ? TC_WHITE : TC_BLACK, (rtl ? SA_RIGHT : SA_LEFT)); + DrawString(text_left, text_right, y + normal_text_y_offset, STR_ENGINE_NAME, engine == selected_id ? TC_WHITE : TC_BLACK); DrawVehicleEngine(l, r, sprite_x, y + sprite_y_offset, engine, (show_count && num_engines == 0) ? PALETTE_CRASH : GetEnginePalette(engine, _local_company), EIT_PURCHASE); if (show_count) { SetDParam(0, num_engines); - DrawString(count_left, count_right, y + small_text_y_offset, STR_TINY_BLACK_COMA, TC_FROMSTRING, SA_RIGHT | SA_FORCE); + DrawString(count_left, count_right, y + small_text_y_offset, STR_TINY_BLACK_COMA, TC_FROMSTRING, (rtl ? SA_LEFT : SA_RIGHT) | SA_FORCE); if (EngineHasReplacementForCompany(Company::Get(_local_company), engine, selected_group)) DrawSprite(SPR_GROUP_REPLACE_ACTIVE, num_engines == 0 ? PALETTE_CRASH : PAL_NONE, replace_icon_left, y + replace_icon_y_offset); } }