1
0
Fork 0

Compare commits

...

4 Commits

Author SHA1 Message Date
Peter Nelson d3cb6e1e67
Codechange: Call Widget::SetDirty/SetLowered directly. (#11417)
In these instances we already have the widget to hand, so don't need to look it up by index again.
2023-11-01 20:12:08 +00:00
Tyler Trahan 89480f3531
Change: Don't set vehicle on time if timetable not started (#11359) 2023-11-01 15:26:39 -04:00
Peter Nelson bb50cbb772
Codechange: Assign/StoreSizePosition x/y can be negative. (#11416)
AssignSizePosition is used with negative values when an NWidgetMatrix is
scrolled, but they were passed as unsigned and then stored as signed.

Widget pos_x/pos_y were already made signed.
2023-11-01 18:44:23 +00:00
translators c97120f003 Update: Translations from eints
english (au): 1 change by krysclarke
chinese (simplified): 5 changes by WenSimEHRP
korean: 2 changes by telk5093
russian: 1 change by Ln-Wolf
portuguese: 1 change by azulcosta
portuguese (brazilian): 1 change by pasantoro
polish: 1 change by pAter-exe
2023-11-01 18:38:53 +00:00
17 changed files with 49 additions and 26 deletions

View File

@ -3385,6 +3385,7 @@ STR_SAVE_PRESET_SAVE :{BLACK}Salvar
STR_SAVE_PRESET_SAVE_TOOLTIP :{BLACK}Salva o padrão com o nome selecionado
# NewGRF parameters window
STR_BASEGRF_PARAMETERS_CAPTION :{WHITE}Alterar parâmetros dos gráficos base
STR_NEWGRF_PARAMETERS_CAPTION :{WHITE}Alterar parâmetros NewGRF
STR_NEWGRF_PARAMETERS_CLOSE :{BLACK}Fechar
STR_NEWGRF_PARAMETERS_RESET :{BLACK}Redefinir parâmetros

View File

@ -5189,6 +5189,7 @@ STR_ERROR_CAN_T_TIMETABLE_VEHICLE :{WHITE}Can't ti
STR_ERROR_TIMETABLE_ONLY_WAIT_AT_STATIONS :{WHITE}Vehicles can only wait at stations
STR_ERROR_TIMETABLE_NOT_STOPPING_HERE :{WHITE}This vehicle is not stopping at this station
STR_ERROR_TIMETABLE_INCOMPLETE :{WHITE}... timetable is incomplete
STR_ERROR_TIMETABLE_NOT_STARTED :{WHITE}... timetable has not started yet
# Sign related errors
STR_ERROR_TOO_MANY_SIGNS :{WHITE}... too many signs

View File

@ -3384,6 +3384,7 @@ STR_SAVE_PRESET_SAVE :{BLACK}Save
STR_SAVE_PRESET_SAVE_TOOLTIP :{BLACK}Save the preset to the current selected name
# NewGRF parameters window
STR_BASEGRF_PARAMETERS_CAPTION :{WHITE}Change base graphics parameters
STR_NEWGRF_PARAMETERS_CAPTION :{WHITE}Change NewGRF parameters
STR_NEWGRF_PARAMETERS_CLOSE :{BLACK}Close
STR_NEWGRF_PARAMETERS_RESET :{BLACK}Reset

View File

@ -534,6 +534,7 @@ STR_ABOUT_MENU_ABOUT_OPENTTD :'OpenTTD'에
STR_ABOUT_MENU_SPRITE_ALIGNER :스프라이트 정렬 도구
STR_ABOUT_MENU_TOGGLE_BOUNDING_BOXES :박스 경계선 보기 전환
STR_ABOUT_MENU_TOGGLE_DIRTY_BLOCKS :시각적 업데이트 블록 표시 전환
STR_ABOUT_MENU_TOGGLE_WIDGET_OUTLINES :위젯 경계선 켜기/끄기
# Place in highscore window
###length 15
@ -3384,6 +3385,7 @@ STR_SAVE_PRESET_SAVE :{BLACK}저장
STR_SAVE_PRESET_SAVE_TOOLTIP :{BLACK}이 프리셋을 선택한 이름으로 저장합니다
# NewGRF parameters window
STR_BASEGRF_PARAMETERS_CAPTION :{WHITE}기본 그래픽 매개 변수를 변경합니다
STR_NEWGRF_PARAMETERS_CAPTION :{WHITE}NewGRF 매개 변숫값 변경
STR_NEWGRF_PARAMETERS_CLOSE :{BLACK}닫기
STR_NEWGRF_PARAMETERS_RESET :{BLACK}초기화

View File

@ -3764,6 +3764,7 @@ STR_SAVE_PRESET_SAVE :{BLACK}Zapisz
STR_SAVE_PRESET_SAVE_TOOLTIP :{BLACK}Zapisz schemat z wybraną nazwą
# NewGRF parameters window
STR_BASEGRF_PARAMETERS_CAPTION :{WHITE}Zmień parametry grafik podstawowych
STR_NEWGRF_PARAMETERS_CAPTION :{WHITE}Zmień parametry NewGRF
STR_NEWGRF_PARAMETERS_CLOSE :{BLACK}Zamknij
STR_NEWGRF_PARAMETERS_RESET :{BLACK}Resetuj

View File

@ -3385,6 +3385,7 @@ STR_SAVE_PRESET_SAVE :{BLACK}Grava
STR_SAVE_PRESET_SAVE_TOOLTIP :{BLACK}Grava a predefinição com o nome seleccionado
# NewGRF parameters window
STR_BASEGRF_PARAMETERS_CAPTION :{WHITE}Alterar os parâmetros dos gráficos base
STR_NEWGRF_PARAMETERS_CAPTION :{WHITE}Alterar parâmetros de NewGRF
STR_NEWGRF_PARAMETERS_CLOSE :{BLACK}Fechar
STR_NEWGRF_PARAMETERS_RESET :{BLACK}Repor

View File

@ -3559,6 +3559,7 @@ STR_SAVE_PRESET_SAVE :{BLACK}Сохр
STR_SAVE_PRESET_SAVE_TOOLTIP :{BLACK}Сохранить набор под выбранным именем
# NewGRF parameters window
STR_BASEGRF_PARAMETERS_CAPTION :{WHITE}Изменение параметров графического пакета
STR_NEWGRF_PARAMETERS_CAPTION :{WHITE}Изменить параметры NewGRF
STR_NEWGRF_PARAMETERS_CLOSE :{BLACK}Закрыть
STR_NEWGRF_PARAMETERS_RESET :{BLACK}Сброс

View File

@ -533,6 +533,7 @@ STR_ABOUT_MENU_ABOUT_OPENTTD :关于 'OpenTTD
STR_ABOUT_MENU_SPRITE_ALIGNER :Sprite 对齐
STR_ABOUT_MENU_TOGGLE_BOUNDING_BOXES :切换边界框
STR_ABOUT_MENU_TOGGLE_DIRTY_BLOCKS :切换脏方块的颜色
STR_ABOUT_MENU_TOGGLE_WIDGET_OUTLINES :调节小组件边框
# Place in highscore window
###length 15
@ -924,6 +925,8 @@ STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}新 {STR
STR_NEWS_SHOW_VEHICLE_GROUP_TOOLTIP :{BLACK}打开该运输工具所属的组
STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_LIST :{WHITE}{STATION}不再接受:{CARGO_LIST}
STR_NEWS_STATION_NOW_ACCEPTS_CARGO_LIST :{WHITE}{STATION}现在接受:{CARGO_LIST}
STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}财政补贴项目到期:{}{}将 {STRING} 从 {STRING} 运送到 {STRING} 将不再获得财政补贴。
STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE :{BIG_FONT}{BLACK}财政补贴项目流标:{}{}将 {STRING} 从 {STRING} 运送到 {STRING} 将不是财政补贴项目。
@ -2192,6 +2195,7 @@ STR_CHEAT_EDIT_MAX_HL_QUERY_CAPT :{WHITE}修改
STR_CHEAT_CHANGE_DATE :{LTBLUE}改变日期:{ORANGE}{DATE_SHORT}
STR_CHEAT_CHANGE_DATE_QUERY_CAPT :{WHITE}改变当前年份
STR_CHEAT_SETUP_PROD :{LTBLUE}开启可调整产量模式:{ORANGE}{STRING}
STR_CHEAT_STATION_RATING :{LTBLUE}车站评价固定为100%{ORANGE}{STRING}
# Livery window
STR_LIVERY_CAPTION :{WHITE}{COMPANY} 的色彩方案
@ -3380,6 +3384,7 @@ STR_SAVE_PRESET_SAVE :{BLACK}保存
STR_SAVE_PRESET_SAVE_TOOLTIP :{BLACK}以当前选定的名称保存预设值
# NewGRF parameters window
STR_BASEGRF_PARAMETERS_CAPTION :{WHITE}改变基本图形组参数
STR_NEWGRF_PARAMETERS_CAPTION :{WHITE}调整 NewGRF 参数
STR_NEWGRF_PARAMETERS_CLOSE :{BLACK}关闭
STR_NEWGRF_PARAMETERS_RESET :{BLACK}重置

View File

@ -129,7 +129,7 @@ public:
this->smallest_x = this->head->smallest_x + this->tail->smallest_x; // First and last are always shown, rest not
}
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override
{
assert(given_width >= this->smallest_x && given_height >= this->smallest_y);

View File

@ -1667,7 +1667,7 @@ public:
this->smallest_y = ComputeMaxSize(min_acs_height, this->smallest_y + this->resize_y - 1, this->resize_y);
}
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override
{
this->StoreSizePosition(sizing, x, y, given_width, given_height);

View File

@ -1740,7 +1740,7 @@ public:
this->resize_y = std::min(display->resize_y, bar->resize_y);
}
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override
{
this->pos_x = x;
this->pos_y = y;

View File

@ -221,6 +221,10 @@ CommandCost CmdSetVehicleOnTime(DoCommandFlag flags, VehicleID veh, bool apply_t
Vehicle *v = Vehicle::GetIfValid(veh);
if (v == nullptr || !v->IsPrimaryVehicle() || v->orders == nullptr) return CMD_ERROR;
/* A vehicle can't be late if its timetable hasn't started.
* If we're setting all vehicles in the group, we handle that below. */
if (!apply_to_group && !HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) return CommandCost(STR_ERROR_TIMETABLE_NOT_STARTED);
CommandCost ret = CheckOwnership(v->owner);
if (ret.Failed()) return ret;
@ -228,12 +232,18 @@ CommandCost CmdSetVehicleOnTime(DoCommandFlag flags, VehicleID veh, bool apply_t
if (apply_to_group) {
int32_t most_late = 0;
for (Vehicle *u = v->FirstShared(); u != nullptr; u = u->NextShared()) {
/* A vehicle can't be late if its timetable hasn't started. */
if (!HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) continue;
if (u->lateness_counter > most_late) {
most_late = u->lateness_counter;
}
}
if (most_late > 0) {
for (Vehicle *u = v->FirstShared(); u != nullptr; u = u->NextShared()) {
/* A vehicle can't be late if its timetable hasn't started. */
if (!HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) continue;
u->lateness_counter -= most_late;
SetWindowDirty(WC_VEHICLE_TIMETABLE, u->index);
}

View File

@ -1424,7 +1424,7 @@ public:
_toolbar_width = nbuttons * this->smallest_x;
}
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override
{
assert(given_width >= this->smallest_x && given_height >= this->smallest_y);

View File

@ -1008,7 +1008,7 @@ NWidgetBase::NWidgetBase(WidgetType tp) : ZeroedMemoryAllocator()
*/
/**
* @fn void NWidgetBase::AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
* @fn void NWidgetBase::AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl)
* Assign size and position to the widget.
* @param sizing Type of resizing to perform.
* @param x Horizontal offset of the widget relative to the left edge of the window.
@ -1163,7 +1163,7 @@ bool NWidgetResizeBase::UpdateVerticalSize(uint min_y)
return true;
}
void NWidgetResizeBase::AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool)
void NWidgetResizeBase::AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool)
{
this->StoreSizePosition(sizing, x, y, given_width, given_height);
}
@ -1400,7 +1400,7 @@ void NWidgetStacked::SetupSmallestSize(Window *w, bool init_array)
}
}
void NWidgetStacked::AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
void NWidgetStacked::AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl)
{
assert(given_width >= this->smallest_x && given_height >= this->smallest_y);
this->StoreSizePosition(sizing, x, y, given_width, given_height);
@ -1570,7 +1570,7 @@ void NWidgetHorizontal::SetupSmallestSize(Window *w, bool init_array)
this->pip_pre = this->pip_inter = this->pip_post = 0;
}
void NWidgetHorizontal::AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
void NWidgetHorizontal::AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl)
{
assert(given_width >= this->smallest_x && given_height >= this->smallest_y);
@ -1678,7 +1678,7 @@ NWidgetHorizontalLTR::NWidgetHorizontalLTR(NWidContainerFlags flags) : NWidgetHo
this->type = NWID_HORIZONTAL_LTR;
}
void NWidgetHorizontalLTR::AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool)
void NWidgetHorizontalLTR::AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool)
{
NWidgetHorizontal::AssignSizePosition(sizing, x, y, given_width, given_height, false);
}
@ -1755,7 +1755,7 @@ void NWidgetVertical::SetupSmallestSize(Window *w, bool init_array)
this->pip_pre = this->pip_inter = this->pip_post = 0;
}
void NWidgetVertical::AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
void NWidgetVertical::AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl)
{
assert(given_width >= this->smallest_x && given_height >= this->smallest_y);
@ -1981,7 +1981,7 @@ void NWidgetMatrix::SetupSmallestSize(Window *w, bool init_array)
this->resize_y = resize.height;
}
void NWidgetMatrix::AssignSizePosition(SizingType, uint x, uint y, uint given_width, uint given_height, bool)
void NWidgetMatrix::AssignSizePosition(SizingType, int x, int y, uint given_width, uint given_height, bool)
{
assert(given_width >= this->smallest_x && given_height >= this->smallest_y);
@ -2249,7 +2249,7 @@ void NWidgetBackground::SetupSmallestSize(Window *w, bool init_array)
}
}
void NWidgetBackground::AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
void NWidgetBackground::AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl)
{
this->StoreSizePosition(sizing, x, y, given_width, given_height);

View File

@ -127,7 +127,7 @@ public:
virtual void AdjustPaddingForZoom();
virtual void SetupSmallestSize(Window *w, bool init_array) = 0;
virtual void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) = 0;
virtual void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) = 0;
virtual void FillNestedArray(NWidgetBase **array, uint length) = 0;
@ -204,7 +204,7 @@ public:
RectPadding uz_padding; ///< Unscaled padding, for resize calculation.
protected:
inline void StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height);
inline void StoreSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height);
};
/**
@ -233,7 +233,7 @@ inline uint NWidgetBase::GetVerticalStepSize(SizingType sizing) const
* @param given_width Width allocated to the widget.
* @param given_height Height allocated to the widget.
*/
inline void NWidgetBase::StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height)
inline void NWidgetBase::StoreSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height)
{
this->pos_x = x;
this->pos_y = y;
@ -263,7 +263,7 @@ public:
bool UpdateVerticalSize(uint min_y);
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
uint min_x; ///< Minimal horizontal size of only this widget.
uint min_y; ///< Minimal vertical size of only this widget.
@ -452,7 +452,7 @@ public:
void AdjustPaddingForZoom() override;
void SetupSmallestSize(Window *w, bool init_array) override;
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
void FillNestedArray(NWidgetBase **array, uint length) override;
void Draw(const Window *w) override;
@ -503,7 +503,7 @@ public:
NWidgetHorizontal(NWidContainerFlags flags = NC_NONE);
void SetupSmallestSize(Window *w, bool init_array) override;
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
};
/**
@ -514,7 +514,7 @@ class NWidgetHorizontalLTR : public NWidgetHorizontal {
public:
NWidgetHorizontalLTR(NWidContainerFlags flags = NC_NONE);
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
};
/**
@ -526,7 +526,7 @@ public:
NWidgetVertical(NWidContainerFlags flags = NC_NONE);
void SetupSmallestSize(Window *w, bool init_array) override;
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
};
/**
@ -548,7 +548,7 @@ public:
void SetScrollbar(Scrollbar *sb);
void SetupSmallestSize(Window *w, bool init_array) override;
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
void FillNestedArray(NWidgetBase **array, uint length) override;
NWidgetCore *GetWidgetFromPos(int x, int y) override;
@ -599,7 +599,7 @@ public:
void AdjustPaddingForZoom() override;
void SetupSmallestSize(Window *w, bool init_array) override;
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
void FillNestedArray(NWidgetBase **array, uint length) override;

View File

@ -438,9 +438,9 @@ void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button,
if ((nwi->type & WWT_MASK) == NWID_BUTTON_DROPDOWN) {
nwi->disp_flags |= ND_DROPDOWN_ACTIVE;
} else {
w->LowerWidget(button);
nwi->SetLowered(true);
}
w->SetWidgetDirty(button);
nwi->SetDirty(w);
if (width != 0) {
if (_current_text_dir == TD_RTL) {

View File

@ -228,7 +228,7 @@ void Window::DisableAllWidgetHighlight()
if (nwid->IsHighlighted()) {
nwid->SetHighlighted(TC_INVALID);
this->SetWidgetDirty(i);
nwid->SetDirty(this);
}
}
@ -248,7 +248,7 @@ void Window::SetWidgetHighlight(byte widget_index, TextColour highlighted_colour
if (nwid == nullptr) return;
nwid->SetHighlighted(highlighted_colour);
this->SetWidgetDirty(widget_index);
nwid->SetDirty(this);
if (highlighted_colour != TC_INVALID) {
/* If we set a highlight, the window has a highlight */