TBTR: Adjust config buttons/text in main window

Clarify refit and depot options
Adjust layout
This commit is contained in:
Jonathan G Rennison 2023-08-26 23:59:22 +01:00
parent 8dc635b516
commit 3b8d8aeb6a
11 changed files with 89 additions and 69 deletions

View File

@ -215,7 +215,7 @@ CommandProc CmdSetAutoReplace;
CommandProc CmdToggleReuseDepotVehicles;
CommandProc CmdToggleKeepRemainingVehicles;
CommandProc CmdToggleRefitAsTemplate;
CommandProc CmdSetRefitAsTemplate;
CommandProc CmdToggleTemplateReplaceOldOnly;
CommandProc CmdRenameTemplateReplace;
@ -477,7 +477,7 @@ static const Command _command_proc_table[] = {
DEF_CMD(CmdToggleReuseDepotVehicles, CMD_ALL_TILES, CMDT_VEHICLE_MANAGEMENT ), // CMD_TOGGLE_REUSE_DEPOT_VEHICLES
DEF_CMD(CmdToggleKeepRemainingVehicles, CMD_ALL_TILES, CMDT_VEHICLE_MANAGEMENT ), // CMD_TOGGLE_KEEP_REMAINING_VEHICLES
DEF_CMD(CmdToggleRefitAsTemplate, CMD_ALL_TILES, CMDT_VEHICLE_MANAGEMENT ), // CMD_TOGGLE_REFIT_AS_TEMPLATE
DEF_CMD(CmdSetRefitAsTemplate, CMD_ALL_TILES, CMDT_VEHICLE_MANAGEMENT ), // CMD_SET_REFIT_AS_TEMPLATE
DEF_CMD(CmdToggleTemplateReplaceOldOnly, CMD_ALL_TILES, CMDT_VEHICLE_MANAGEMENT ), // CMD_TOGGLE_TMPL_REPLACE_OLD_ONLY
DEF_CMD(CmdRenameTemplateReplace, CMD_ALL_TILES, CMDT_VEHICLE_MANAGEMENT ), // CMD_RENAME_TMPL_REPLACE

View File

@ -443,7 +443,7 @@ enum Commands {
CMD_TOGGLE_REUSE_DEPOT_VEHICLES, ///< toggle 'reuse depot vehicles' on template
CMD_TOGGLE_KEEP_REMAINING_VEHICLES, ///< toggle 'keep remaining vehicles' on template
CMD_TOGGLE_REFIT_AS_TEMPLATE, ///< toggle 'refit as template' on template
CMD_SET_REFIT_AS_TEMPLATE, ///< set/unset 'refit as template' on template
CMD_TOGGLE_TMPL_REPLACE_OLD_ONLY, ///< toggle 'replace old vehicles only' on template
CMD_RENAME_TMPL_REPLACE, ///< rename a template

View File

@ -1912,14 +1912,11 @@ STR_TMPL_SET_USEDEPOT :{BLACK}Použít
STR_TMPL_SET_USEDEPOT_TIP :{BLACK}Použije vozila, která stojí v nečinném stavu bez příkazů v depu, na sestavení souprav při nahrazování podle šablon, aby byly sníženy pořizovací náklady
STR_TMPL_SET_KEEPREMAINDERS :{BLACK}Zachovat zbytky
STR_TMPL_SET_KEEPREMAINDERS_TIP :{BLACK}Po dokončení šablonového nahrazování zachová všechna zbvýající vozidla z původní soupravy v nečinném stavu bez příkazů pro pozdější využití
STR_TMPL_SET_REFIT :{BLACK}Přestavět
STR_TMPL_SET_REFIT_TIP :{BLACK}Je-li nastaveno, vlak bude přestavěn přesně na náklad stanovený šablonou. Není-li nastaveno, každé vozidlo, které má být nově zakoupeno nebo vyňato z depa, se *pokusí* přestavět tak, aby odpovídalo původnímu. Pokud to nebude možné, vozidlo se přestaví na výchozí náklad.
STR_TMPL_SET_OLD_ONLY :{BLACK}Pouze zastaralé
STR_TMPL_SET_OLD_ONLY_TIP :{BLACK}Je-li nastaveno, budou se nahrazovat pouze zastaralá a na automatické nahrazení zralá vozidla
STR_TMPL_CONFIG_USEDEPOT :užij depo
STR_TMPL_CONFIG_KEEPREMAINDERS :nech zbyt
STR_TMPL_CONFIG_REFIT :přestav
STR_TMPL_CONFIG_OLD_ONLY :jen staré
STR_TMPL_NUM_TRAINS_NEED_RPL :# vlaků k nahrazení:

View File

@ -1969,20 +1969,27 @@ STR_TMPL_ADD_VEHICLE_REFIT :{BLACK}Add and
STR_TMPL_ADD_TOOLTIP :{BLACK}Add the highlighted vehicle to the template.
STR_TMPL_ADD_REFIT_TOOLTIP :{BLACK}Add and refit the highlighted vehicle to the template.
STR_TMPL_SET_USEDEPOT :{BLACK}Use vehicles in depot
STR_TMPL_SET_USEDEPOT_TIP :{BLACK}Use vehicles inside the depot that are in a neutral and idle state to compose trains on template replacement in order to reduce buying costs
STR_TMPL_SET_USEDEPOT :{BLACK}Use depot vehicles
STR_TMPL_SET_USEDEPOT_TIP :{BLACK}Use available vehicles in the depot during template replacement in order to reduce buying costs.{}Available vehicles must be stopped in the depot. Locomotives must have no orders, no group and not share orders with another vehicle.
STR_TMPL_SET_KEEPREMAINDERS :{BLACK}Keep remainders
STR_TMPL_SET_KEEPREMAINDERS_TIP :{BLACK}After finishing template replacement keep all remaining vehicles from the old train in a neutral and idle state for later use
STR_TMPL_SET_REFIT :{BLACK}Use Refit
STR_TMPL_SET_REFIT_TIP :{BLACK}If set, the train will use exactly the cargo refit specified by the template. If not every wagon that is to be newly bought or retrieved from the depot, will *attempt* to be refitted as the old one was. Standard refit if this is impossible.
STR_TMPL_SET_KEEPREMAINDERS_TIP :{BLACK}After finishing template replacement, leave any remaining vehicles from the old train in the depot for later use
STR_TMPL_SET_REFIT_AS_TEMPLATE :{BLACK}As template
STR_TMPL_SET_REFIT_AS_TEMPLATE_TIP :{BLACK}The train will be refitted to exactly match the template
STR_TMPL_SET_REFIT_AS_INCOMING :{BLACK}As incoming
STR_TMPL_SET_REFIT_AS_INCOMING_TIP :{BLACK}Each part of the new train will be refitted to the first cargo in the old train. Standard refit if this is not possible.
STR_TMPL_SET_OLD_ONLY :{BLACK}Old Only
STR_TMPL_SET_OLD_ONLY_TIP :{BLACK}If set, only vehicles which are old and due for automatic replacement will be replaced
STR_TMPL_CONFIG_REFIT_AS_TEMPLATE :{GREEN}refit: template
STR_TMPL_CONFIG_REFIT_AS_INCOMING :{GOLD}refit: incoming
STR_TMPL_CONFIG_USEDEPOT :use depot
STR_TMPL_CONFIG_KEEPREMAINDERS :keep rem
STR_TMPL_CONFIG_REFIT :refit
STR_TMPL_CONFIG_OLD_ONLY :old only
STR_TMPL_SECTION_REFIT :{BLACK}Refit
STR_TMPL_SECTION_DEPOT_VEHICLES :{BLACK}Depot vehicles
STR_TMPL_SECTION_WHEN :{BLACK}When
STR_TMPL_NUM_TRAINS_NEED_RPL :# trains to replace:
STR_TMPL_CARGO_SUMMARY :{CARGO_LONG}

View File

@ -1918,14 +1918,11 @@ STR_TMPL_SET_USEDEPOT :{BLACK}Usar veh
STR_TMPL_SET_USEDEPOT_TIP :{BLACK}Usar vehículos no interior do depósito que están nun estado neutral e inactivos para compoñer trens no reemprazo do modelo para reducir os costes de compra.
STR_TMPL_SET_KEEPREMAINDERS :{BLACK}Conservar os restos
STR_TMPL_SET_KEEPREMAINDERS_TIP :{BLACK}Despois de rematar a substitución de modelos manter todos os vehículos restantes do anitog tren nun estado neutral e inactivo para un posterior uso
STR_TMPL_SET_REFIT :{BLACK}Usar reaxuste
STR_TMPL_SET_REFIT_TIP :{BLACK}Se se establece, o tren utilizará exactamente o reaxuste de cargamento especificado polo modelo. Se non cada vagón que se compre novo ou se obterá do depósito, intentará reaxustarse ao antigo. Reaxuste estándar se isto non é posible.
STR_TMPL_SET_OLD_ONLY :{BLACK}Só o vello
STR_TMPL_SET_OLD_ONLY_TIP :{BLACK}Se se establece, só os vehículos que son vellos e debido a substitución automática serán reemplazados.
STR_TMPL_CONFIG_USEDEPOT :usar depósito
STR_TMPL_CONFIG_KEEPREMAINDERS :conservar restos
STR_TMPL_CONFIG_REFIT :reaxustar
STR_TMPL_CONFIG_OLD_ONLY :só o vello
STR_TMPL_NUM_TRAINS_NEED_RPL :# trenes a reemplazar:

View File

@ -1673,14 +1673,11 @@ STR_TMPL_SET_USEDEPOT :{BLACK}Benutze
STR_TMPL_SET_USEDEPOT_TIP :{BLACK}Benutze zur Zusammenstellung Fahrzeuge, welche innerhalb des Depots in einem neutralen und unbenutzten Zustand zur Verfügung stehen, um die Anschaffungskosten zu reduzieren.
STR_TMPL_SET_KEEPREMAINDERS :{BLACK}Bereithaltung verbleibender Fahrzeuge
STR_TMPL_SET_KEEPREMAINDERS_TIP :{BLACK}Behalte nach erfolgreicher Ersetzung alle verbleibenden Fahrzeuge des alten Zugs in einem neutralen und unbenutzen Zustand für spätere eine Benutzung bereit.
STR_TMPL_SET_REFIT :{BLACK}Benutze Umrüstungen
STR_TMPL_SET_REFIT_TIP :{BLACK}Benutze die exakten Umrüstungen, die in der Vorlage angegeben sind. Wenn nicht jedes Fahrzeug, das neu angeschafft oder aus dem Depot geholt wurde, umgerüstet werden kann, wird für jedes Fahrzeug zumindest *versucht* die Umrüstung durchzuführen. Bei nicht möglicher Umrüstung eines Fahrzeugs wird dessen Standardfracht benutzt.
STR_TMPL_SET_OLD_ONLY :{BLACK}Nur alte Fahrzeuge
STR_TMPL_SET_OLD_ONLY_TIP :{BLACK}Ersetze nur Fahrzeuge, welche alt und fällig für die automatische Erneuerung sind
STR_TMPL_CONFIG_USEDEPOT :Depotnutzung
STR_TMPL_CONFIG_KEEPREMAINDERS :Bereithaltung
STR_TMPL_CONFIG_REFIT :Umrüstungen
STR_TMPL_CONFIG_OLD_ONLY :Nur alte
STR_TMPL_NUM_TRAINS_NEED_RPL :# Züge zu ersetzen:

View File

@ -1919,14 +1919,11 @@ STR_TMPL_SET_USEDEPOT :{BLACK}차량
STR_TMPL_SET_USEDEPOT_TIP :{BLACK}구입 비용을 줄이기 위해 차량을 기지 안에 놔 둡니다.
STR_TMPL_SET_KEEPREMAINDERS :{BLACK}재고로 놔두기
STR_TMPL_SET_KEEPREMAINDERS_TIP :{BLACK}템플릿 교체가 끝난 후 오래된 열차로부터 남은 차량을 나중을 위해 놔 둡니다.
STR_TMPL_SET_REFIT :{BLACK}개조하기
STR_TMPL_SET_REFIT_TIP :{BLACK}설정되면 열차는 템플릿에 지정된 화물을 실을 수 있도록 개조될 것입니다. 만약 모든 객차/화물차가 새로 구입됐거나 기지에 있는 것을 되찾아 온 것이 아닐 경우, 오래된 것을 교체하려고 "시도"할 것입니다. 만약 불가능하면 일반 상태로 개조합니다.
STR_TMPL_SET_OLD_ONLY :{BLACK}낡은 차량만
STR_TMPL_SET_OLD_ONLY_TIP :{BLACK}설정되면 낡은 차량과 자동 교체에 의해 교체되는 차량만이 교체됩니다.
STR_TMPL_CONFIG_USEDEPOT :기지 사용
STR_TMPL_CONFIG_KEEPREMAINDERS :놔두기
STR_TMPL_CONFIG_REFIT :개조
STR_TMPL_CONFIG_OLD_ONLY :낡은 차량만
STR_TMPL_NUM_TRAINS_NEED_RPL :교체할 열차 수:

View File

@ -1808,14 +1808,11 @@ STR_TMPL_SET_USEDEPOT :{BLACK}使用
STR_TMPL_SET_USEDEPOT_TIP :{BLACK}使用库内闲置车辆构成模板替换用列车,这能降低购买成本
STR_TMPL_SET_KEEPREMAINDERS :{BLACK}保持原样
STR_TMPL_SET_KEEPREMAINDERS_TIP :{BLACK}在完成模板更新之后保留所有剩下来的从老火车上卸下来的车厢并把它们设置成闲置状态以供之后的使用
STR_TMPL_SET_REFIT :{BLACK}使用改装
STR_TMPL_SET_REFIT_TIP :{BLACK}如果设置了,火车将完全使用模板所指定的货物改装。如果没设置,每辆新买的或从仓库取回的车厢,都将*尝试*按照旧的车厢进行改装。如果不能改装,则采用标准改装。
STR_TMPL_SET_OLD_ONLY :{BLACK}只换老的
STR_TMPL_SET_OLD_ONLY_TIP :{BLACK}如果设置了的话,只有那些老旧的、应被更换的的车厢才会被更换。
STR_TMPL_CONFIG_USEDEPOT :使用闲置
STR_TMPL_CONFIG_KEEPREMAINDERS :保持原样
STR_TMPL_CONFIG_REFIT :改装车厢
STR_TMPL_CONFIG_OLD_ONLY :只换老的
STR_TMPL_NUM_TRAINS_NEED_RPL :# 要被替换的火车:

View File

@ -65,11 +65,12 @@ enum TemplateReplaceWindowWidgets {
TRW_WIDGET_TMPL_INFO_INSET,
TRW_WIDGET_TMPL_INFO_PANEL,
TRW_WIDGET_TMPL_PRE_BUTTON_FLUFF,
TRW_WIDGET_TMPL_CONFIG_HEADER,
TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_TEMPLATE,
TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_INCOMING,
TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REUSE,
TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_KEEP,
TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT,
TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_OLD_ONLY,
TRW_WIDGET_TMPL_BUTTONS_CONFIG_RIGHTPANEL,
@ -138,36 +139,42 @@ static const NWidgetPart _widgets[] = {
EndContainer(),
EndContainer(),
// Control Area
NWidget(NWID_VERTICAL),
// Spacing
NWidget(WWT_INSET, COLOUR_GREY, TRW_WIDGET_TMPL_PRE_BUTTON_FLUFF), SetMinimalSize(139, 12), SetResize(1,0), EndContainer(),
// Config buttons
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REUSE), SetMinimalSize(150,12), SetResize(0,0), SetDataTip(STR_TMPL_SET_USEDEPOT, STR_TMPL_SET_USEDEPOT_TIP),
NWidget(WWT_TEXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_KEEP), SetMinimalSize(150,12), SetResize(0,0), SetDataTip(STR_TMPL_SET_KEEPREMAINDERS, STR_TMPL_SET_KEEPREMAINDERS_TIP),
NWidget(WWT_TEXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT), SetMinimalSize(150,12), SetResize(0,0), SetDataTip(STR_TMPL_SET_REFIT, STR_TMPL_SET_REFIT_TIP),
NWidget(WWT_TEXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_OLD_ONLY), SetMinimalSize(150,12), SetResize(0,0), SetDataTip(STR_TMPL_SET_OLD_ONLY, STR_TMPL_SET_OLD_ONLY_TIP),
NWidget(WWT_PANEL, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_CONFIG_RIGHTPANEL), SetMinimalSize(12,12), SetResize(1,0), EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(NWID_VERTICAL),
// Config header
NWidget(WWT_PANEL, COLOUR_GREY, TRW_WIDGET_TMPL_CONFIG_HEADER), SetMinimalSize(0, 12), SetFill(1, 0), SetResize(1, 0), EndContainer(),
// Config buttons
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_TEMPLATE), SetMinimalSize(100, 12), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TMPL_SET_REFIT_AS_TEMPLATE, STR_TMPL_SET_REFIT_AS_TEMPLATE_TIP),
NWidget(WWT_TEXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_INCOMING), SetMinimalSize(100, 12), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TMPL_SET_REFIT_AS_INCOMING, STR_TMPL_SET_REFIT_AS_INCOMING_TIP),
NWidget(NWID_SPACER), SetFill(0, 0), SetMinimalSize(2, 0), SetResize(0, 0),
NWidget(WWT_TEXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REUSE), SetMinimalSize(100, 12), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TMPL_SET_USEDEPOT, STR_TMPL_SET_USEDEPOT_TIP),
NWidget(WWT_TEXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_KEEP), SetMinimalSize(100, 12), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TMPL_SET_KEEPREMAINDERS, STR_TMPL_SET_KEEPREMAINDERS_TIP),
NWidget(NWID_SPACER), SetFill(0, 0), SetMinimalSize(2, 0), SetResize(0, 0),
NWidget(WWT_TEXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_OLD_ONLY), SetMinimalSize(100, 12), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TMPL_SET_OLD_ONLY, STR_TMPL_SET_OLD_ONLY_TIP),
NWidget(WWT_PANEL, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_CONFIG_RIGHTPANEL), SetMinimalSize(12, 12), SetFill(0, 0), SetResize(0, 0), EndContainer(),
EndContainer(),
NWidget(NWID_SPACER), SetFill(1, 0), SetMinimalSize(0, 2), SetResize(1, 0),
// Edit buttons
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_DEFINE), SetMinimalSize(75, 12), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TMPL_DEFINE_TEMPLATE, STR_TMPL_DEFINE_TEMPLATE),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_EDIT), SetMinimalSize(75, 12), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TMPL_EDIT_TEMPLATE, STR_TMPL_EDIT_TEMPLATE),
NWidget(WWT_TEXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_CLONE), SetMinimalSize(75, 12), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TMPL_CREATE_CLONE_VEH, STR_TMPL_CREATE_CLONE_VEH),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_DELETE), SetMinimalSize(75, 12), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_TMPL_DELETE_TEMPLATE, STR_TMPL_DELETE_TEMPLATE),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_RENAME), SetMinimalSize(75, 12), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_BUTTON_RENAME, STR_TMPL_RENAME_TEMPLATE),
NWidget(WWT_PANEL, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_EDIT_RIGHTPANEL), SetMinimalSize(12, 12), SetFill(0, 0), SetResize(0, 0), EndContainer(),
EndContainer(),
EndContainer(),
// Edit buttons
// Start/Stop buttons
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_DEFINE), SetMinimalSize(75,12), SetResize(0,0), SetDataTip(STR_TMPL_DEFINE_TEMPLATE, STR_TMPL_DEFINE_TEMPLATE),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_EDIT), SetMinimalSize(75,12), SetResize(0,0), SetDataTip(STR_TMPL_EDIT_TEMPLATE, STR_TMPL_EDIT_TEMPLATE),
NWidget(WWT_TEXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_CLONE), SetMinimalSize(75,12), SetResize(0,0), SetDataTip(STR_TMPL_CREATE_CLONE_VEH, STR_TMPL_CREATE_CLONE_VEH),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_DELETE), SetMinimalSize(75,12), SetResize(0,0), SetDataTip(STR_TMPL_DELETE_TEMPLATE, STR_TMPL_DELETE_TEMPLATE),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_RENAME), SetMinimalSize(75,12), SetResize(0,0), SetDataTip(STR_BUTTON_RENAME, STR_TMPL_RENAME_TEMPLATE),
NWidget(WWT_PANEL, COLOUR_GREY, TRW_WIDGET_TMPL_BUTTONS_EDIT_RIGHTPANEL), SetMinimalSize(50,12), SetResize(1,0), EndContainer(),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TRW_WIDGET_START), SetMinimalSize(150, 12), SetDataTip(STR_TMPL_RPL_START, STR_TMPL_RPL_START_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, TRW_WIDGET_TRAIN_FLUFF_LEFT), SetMinimalSize(15, 12), EndContainer(),
NWidget(WWT_DROPDOWN, COLOUR_GREY, TRW_WIDGET_TRAIN_RAILTYPE_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(0x0, STR_REPLACE_HELP_RAILTYPE), SetResize(1, 0),
NWidget(WWT_PANEL, COLOUR_GREY, TRW_WIDGET_TRAIN_FLUFF_RIGHT), SetMinimalSize(16, 12), EndContainer(),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TRW_WIDGET_STOP), SetMinimalSize(150, 12), SetDataTip(STR_TMPL_RPL_STOP, STR_TMPL_RPL_STOP_TOOLTIP),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
EndContainer(),
// Start/Stop buttons
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TRW_WIDGET_START), SetMinimalSize(150, 12), SetDataTip(STR_TMPL_RPL_START, STR_TMPL_RPL_START_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, TRW_WIDGET_TRAIN_FLUFF_LEFT), SetMinimalSize(15, 12), EndContainer(),
NWidget(WWT_DROPDOWN, COLOUR_GREY, TRW_WIDGET_TRAIN_RAILTYPE_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(0x0, STR_REPLACE_HELP_RAILTYPE), SetResize(1, 0),
NWidget(WWT_PANEL, COLOUR_GREY, TRW_WIDGET_TRAIN_FLUFF_RIGHT), SetMinimalSize(16, 12), EndContainer(),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TRW_WIDGET_STOP), SetMinimalSize(150, 12), SetDataTip(STR_TMPL_RPL_STOP, STR_TMPL_RPL_STOP_TOOLTIP),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
};
static WindowDesc _replace_rail_vehicle_desc(
@ -267,6 +274,13 @@ public:
*size = maxdim(*size, d);
break;
}
case TRW_WIDGET_TMPL_CONFIG_HEADER:
size->height = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.framerect.Vertical();
break;
case TRW_WIDGET_TMPL_BUTTONS_CONFIG_RIGHTPANEL:
case TRW_WIDGET_TMPL_BUTTONS_EDIT_RIGHTPANEL:
size->width = std::max(size->width, NWidgetLeaf::GetResizeBoxDimension().width);
break;
}
}
@ -294,6 +308,17 @@ public:
DrawTemplateInfo(r);
break;
}
case TRW_WIDGET_TMPL_CONFIG_HEADER: {
auto draw_label = [&](int widget_1, int widget_2, StringID str) {
Rect lr = this->GetWidget<NWidgetBase>(widget_1)->GetCurrentRect();
if (widget_2 != 0) lr = BoundingRect(lr, this->GetWidget<NWidgetBase>(widget_2)->GetCurrentRect());
DrawString(lr.left, lr.right, r.top + WidgetDimensions::scaled.framerect.top, str, TC_FROMSTRING, SA_CENTER);
};
draw_label(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_TEMPLATE, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_INCOMING, STR_TMPL_SECTION_REFIT);
draw_label(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REUSE, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_KEEP, STR_TMPL_SECTION_DEPOT_VEHICLES);
draw_label(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_OLD_ONLY, 0, STR_TMPL_SECTION_WHEN);
break;
}
}
}
@ -312,8 +337,9 @@ public:
if ((this->selected_template_index < 0) || (this->selected_template_index >= (int)this->templates.size())) {
this->vscroll[2]->SetCount(24);
this->SetWidgetsLoweredState(false,
TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_TEMPLATE, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_INCOMING,
TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REUSE, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_KEEP,
TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_OLD_ONLY, WIDGET_LIST_END);
TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_OLD_ONLY, WIDGET_LIST_END);
} else {
const TemplateVehicle *tmp = this->templates[this->selected_template_index];
uint height = ScaleGUITrad(8) + (3 * FONT_HEIGHT_NORMAL);
@ -340,9 +366,10 @@ public:
this->vscroll[2]->SetCount(height);
this->SetWidgetLoweredState(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_TEMPLATE, tmp->IsSetRefitAsTemplate());
this->SetWidgetLoweredState(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_INCOMING, !tmp->IsSetRefitAsTemplate());
this->SetWidgetLoweredState(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REUSE, tmp->IsSetReuseDepotVehicles());
this->SetWidgetLoweredState(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_KEEP, tmp->IsSetKeepRemainingVehicles());
this->SetWidgetLoweredState(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT, tmp->IsSetRefitAsTemplate());
this->SetWidgetLoweredState(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_OLD_ONLY, tmp->IsReplaceOldOnly());
}
@ -373,11 +400,12 @@ public:
}
break;
}
case TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT: {
case TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_TEMPLATE:
case TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_INCOMING: {
if ((this->selected_template_index >= 0) && (this->selected_template_index < (int)this->templates.size())) {
uint32 template_index = ((this->templates)[selected_template_index])->index;
DoCommandP(0, template_index, 0, CMD_TOGGLE_REFIT_AS_TEMPLATE, nullptr);
DoCommandP(0, template_index, (widget == TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_TEMPLATE) ? 1 : 0, CMD_SET_REFIT_AS_TEMPLATE, nullptr);
}
break;
}
@ -742,19 +770,18 @@ public:
}
/* Draw information about template configuration settings */
TextColour color;
DrawString(right - ScaleGUITrad(300), right, bottom_edge, v->IsSetRefitAsTemplate() ? STR_TMPL_CONFIG_REFIT_AS_TEMPLATE : STR_TMPL_CONFIG_REFIT_AS_INCOMING, TC_FROMSTRING, SA_LEFT);
TextColour color;
color = v->IsSetReuseDepotVehicles() ? TC_LIGHT_BLUE : TC_GREY;
DrawString(right - ScaleGUITrad(300), right, bottom_edge, STR_TMPL_CONFIG_USEDEPOT, color, SA_LEFT);
DrawString(right - ScaleGUITrad(210), right, bottom_edge, STR_TMPL_CONFIG_USEDEPOT, color, SA_LEFT);
color = v->IsSetKeepRemainingVehicles() ? TC_LIGHT_BLUE : TC_GREY;
DrawString(right - ScaleGUITrad(225), right, bottom_edge, STR_TMPL_CONFIG_KEEPREMAINDERS, color, SA_LEFT);
color = v->IsSetRefitAsTemplate() ? TC_LIGHT_BLUE : TC_GREY;
DrawString(right - ScaleGUITrad(150), right, bottom_edge, STR_TMPL_CONFIG_REFIT, color, SA_LEFT);
DrawString(right - ScaleGUITrad(140), right, bottom_edge, STR_TMPL_CONFIG_KEEPREMAINDERS, color, SA_LEFT);
color = v->IsReplaceOldOnly() ? TC_LIGHT_BLUE : TC_GREY;
DrawString(right - ScaleGUITrad(75), right, bottom_edge, STR_TMPL_CONFIG_OLD_ONLY, color, SA_LEFT);
DrawString(right - ScaleGUITrad(70), right, bottom_edge, STR_TMPL_CONFIG_OLD_ONLY, color, SA_LEFT);
y += this->bottom_matrix_item_size;
}
@ -857,9 +884,10 @@ public:
this->SetWidgetDisabledState(TRW_WIDGET_TMPL_BUTTONS_EDIT, disable_selection_buttons);
this->SetWidgetDisabledState(TRW_WIDGET_TMPL_BUTTONS_DELETE, disable_selection_buttons);
this->SetWidgetDisabledState(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_TEMPLATE, disable_selection_buttons);
this->SetWidgetDisabledState(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_INCOMING, disable_selection_buttons);
this->SetWidgetDisabledState(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REUSE, disable_selection_buttons);
this->SetWidgetDisabledState(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_KEEP, disable_selection_buttons);
this->SetWidgetDisabledState(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT, disable_selection_buttons);
this->SetWidgetDisabledState(TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_OLD_ONLY, disable_selection_buttons);
this->SetWidgetDisabledState(TRW_WIDGET_START, this->editInProgress || !(selected_ok && group_ok && FindTemplateIndex(tid) != this->selected_template_index));

View File

@ -160,7 +160,7 @@ public:
bool IsReplaceOldOnly() const { return this->replace_old_only; }
void ToggleReuseDepotVehicles() { this->reuse_depot_vehicles = !this->reuse_depot_vehicles; }
void ToggleKeepRemainingVehicles() { this->keep_remaining_vehicles = !this->keep_remaining_vehicles; }
void ToggleRefitAsTemplate() { this->refit_as_template = !this->refit_as_template; }
void SetRefitAsTemplate(bool as_template) { this->refit_as_template = as_template; }
void ToggleReplaceOldOnly() { this->replace_old_only = !this->replace_old_only; }
bool IsPrimaryVehicle() const { return this->IsFrontEngine(); }

View File

@ -942,15 +942,15 @@ CommandCost CmdToggleKeepRemainingVehicles(TileIndex tile, DoCommandFlag flags,
}
/**
* Toggles 'refit as template' on a template vehicle.
* Set/unset 'refit as template' on a template vehicle.
* @param tile unused
* @param flags type of operation
* @param p1 the template vehicle's index
* @param p2 unused
* @param p2 whether 'refit as template' should be set
* @param text unused
* @return the cost of this operation or an error
*/
CommandCost CmdToggleRefitAsTemplate(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
CommandCost CmdSetRefitAsTemplate(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
// Identify template to toggle
TemplateVehicle *template_vehicle = TemplateVehicle::GetIfValid(p1);
@ -962,7 +962,7 @@ CommandCost CmdToggleRefitAsTemplate(TileIndex tile, DoCommandFlag flags, uint32
bool should_execute = (flags & DC_EXEC) != 0;
if (should_execute) {
template_vehicle->ToggleRefitAsTemplate();
template_vehicle->SetRefitAsTemplate(p2 != 0);
MarkTrainsUsingTemplateAsPendingTemplateReplacement(template_vehicle);
InvalidateWindowClassesData(WC_TEMPLATEGUI_MAIN, 0);