mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Add conditional order sub-mode for vehicle dispatch slot
This commit is contained in:
parent
a2b6363584
commit
3003f8796e
@ -900,10 +900,13 @@ STR_TRACE_RESTRICT_TIME_DAY_ITEM_SHORT :den
|
||||
STR_TRACE_RESTRICT_TIME_MONTH_ITEM_SHORT :měsíc
|
||||
STR_TRACE_RESTRICT_TIMETABLE_LATENESS :zpoždění
|
||||
STR_TRACE_RESTRICT_TIMETABLE_EARLINESS :náskok
|
||||
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_NEXT :následující výpravní pořadí
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_LAST :poslední výpravní pořadí
|
||||
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_NEXT :další
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_LAST :poslední
|
||||
|
||||
STR_TRACE_RESTRICT_VALUE_CAPTION :{WHITE}Hodnota
|
||||
STR_TRACE_RESTRICT_CAPTION :{WHITE}Omezení směrování
|
||||
STR_TRACE_RESTRICT_CAPTION_SHARED :{WHITE}Omezení směrování - sdíleno {COMMA} návěstidly
|
||||
@ -1966,6 +1969,7 @@ STR_ERROR_CAN_T_RENAME_SCHEDULE :{WHITE}Nelze po
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_PAST :{BLACK}Poslední odjezd v {TT_TIME}.
|
||||
STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_FUTURE :{BLACK}Poslední pořadí ještě neodjelo, odjede v {TT_TIME}.
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_L1 :{BLACK}Tento rozvrh vyžaduje {COMMA} vozid{P lo la el}.
|
||||
STR_SCHDISPATCH_SUMMARY_L2 :{BLACK}Tento rozvrh se opakuje každých {STRING}.
|
||||
STR_SCHDISPATCH_SUMMARY_L3 :{BLACK}Tento rozvrh začal v {TT_TIME} a skončí v {TT_TIME}.
|
||||
|
@ -1068,10 +1068,17 @@ STR_TRACE_RESTRICT_TIME_DAY_ITEM_SHORT :day
|
||||
STR_TRACE_RESTRICT_TIME_MONTH_ITEM_SHORT :month
|
||||
STR_TRACE_RESTRICT_TIMETABLE_LATENESS :lateness
|
||||
STR_TRACE_RESTRICT_TIMETABLE_EARLINESS :earliness
|
||||
|
||||
###length 3
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_NEXT :next departure slot
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_LAST :last departure slot
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_VEH :vehicle's departure slot
|
||||
|
||||
###length 3
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_NEXT :next
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_LAST :last
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_VEH :vehicle
|
||||
|
||||
STR_TRACE_RESTRICT_VALUE_CAPTION :{WHITE}Value
|
||||
STR_TRACE_RESTRICT_CAPTION :{WHITE}Routefinding restriction
|
||||
STR_TRACE_RESTRICT_CAPTION_SHARED :{WHITE}Routefinding restriction - shared by {COMMA} signals
|
||||
|
@ -1016,10 +1016,13 @@ STR_TRACE_RESTRICT_TIME_DAY_ITEM_SHORT :día
|
||||
STR_TRACE_RESTRICT_TIME_MONTH_ITEM_SHORT :mes
|
||||
STR_TRACE_RESTRICT_TIMETABLE_LATENESS :atraso
|
||||
STR_TRACE_RESTRICT_TIMETABLE_EARLINESS :adianto
|
||||
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_NEXT :seguinte slot de saída
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_LAST :último slot de saída
|
||||
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_NEXT :seguinte
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_LAST :último
|
||||
|
||||
STR_TRACE_RESTRICT_VALUE_CAPTION :{WHITE}Valor
|
||||
STR_TRACE_RESTRICT_CAPTION :{WHITE}Restrición de busca de rutas
|
||||
STR_TRACE_RESTRICT_CAPTION_SHARED :{WHITE}Restrición de busca de rutas - compartida por {COMMA} sinais
|
||||
@ -2178,8 +2181,10 @@ STR_SCHDISPATCH_SLOT_TOOLTIP_TAG :{}Etiqueta {NUM
|
||||
STR_SCHDISPATCH_SLOT_TOOLTIP_TAG_NAMED :{}Etiqueta {NUM}: {STRING}
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_NO_LAST_DEPARTURE :{BLACK}Sen saídas previas.
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_PAST :{BLACK}Última saída ás {TT_TIME}.
|
||||
STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_FUTURE :{BLACK}A última saída aínda non saíu, sairá ás {TT_TIME}.
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_L1 :{BLACK}Este programa require {COMMA} vehículo{P "" s}.
|
||||
STR_SCHDISPATCH_SUMMARY_L2 :{BLACK}Este programa repítese cada {STRING}.
|
||||
STR_SCHDISPATCH_SUMMARY_L3 :{BLACK}Este programa comezou ás {TT_TIME}, e remata ás {TT_TIME}.
|
||||
|
@ -810,10 +810,13 @@ STR_TRACE_RESTRICT_TIME_DAY_ITEM_SHORT :Tag
|
||||
STR_TRACE_RESTRICT_TIME_MONTH_ITEM_SHORT :Monat
|
||||
STR_TRACE_RESTRICT_TIMETABLE_LATENESS :Verspätet
|
||||
STR_TRACE_RESTRICT_TIMETABLE_EARLINESS :Verfrüht
|
||||
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_NEXT :nächste Abreisezeit
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_LAST :letzte Abreisezeit
|
||||
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_NEXT :nächster
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_LAST :letzter
|
||||
|
||||
STR_TRACE_RESTRICT_VALUE_CAPTION :{WHITE}Wert
|
||||
STR_TRACE_RESTRICT_CAPTION :{WHITE}Routing-Beschränkungen
|
||||
STR_TRACE_RESTRICT_CAPTION_SHARED :{WHITE}Routing-Beschränkungen - geteilt durch {COMMA} Signale
|
||||
@ -1720,6 +1723,7 @@ STR_SCHDISPATCH_SCHEDULE_ID :{BLACK}Zeitplan
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_PAST :{BLACK}Letzte Abfahrt am {TT_TIME}.
|
||||
STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_FUTURE :{BLACK}Letzte Abfahrt hat den Bahnhof noch nicht verlassen; Abfahrt am {TT_TIME}.
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_L1 :{BLACK}Dieser Fahrplan erfordert {COMMA} Fahrzeug{P "" e}.
|
||||
STR_SCHDISPATCH_SUMMARY_L2 :{BLACK}Dieser Fahrplan wiederholt sich alle {STRING}.
|
||||
STR_SCHDISPATCH_SUMMARY_L3 :{BLACK}Dieser Fahrplan begann am {TT_TIME} und endet am {TT_TIME}.
|
||||
|
@ -1019,10 +1019,13 @@ STR_TRACE_RESTRICT_TIME_DAY_ITEM_SHORT :일
|
||||
STR_TRACE_RESTRICT_TIME_MONTH_ITEM_SHORT :월
|
||||
STR_TRACE_RESTRICT_TIMETABLE_LATENESS :지연
|
||||
STR_TRACE_RESTRICT_TIMETABLE_EARLINESS :조착
|
||||
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_NEXT :다음 출발 슬롯
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_LAST :마지막 출발 슬롯
|
||||
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_NEXT :다음
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_LAST :마지막
|
||||
|
||||
STR_TRACE_RESTRICT_VALUE_CAPTION :{WHITE}값
|
||||
STR_TRACE_RESTRICT_CAPTION :{WHITE}경로 탐색 제한
|
||||
STR_TRACE_RESTRICT_CAPTION_SHARED :{WHITE}경로 탐색 제한 - {COMMA}개의 신호기와 공유
|
||||
@ -2183,8 +2186,10 @@ STR_SCHDISPATCH_SLOT_TOOLTIP_TAG :{}태그 {NUM}
|
||||
STR_SCHDISPATCH_SLOT_TOOLTIP_TAG_NAMED :{}태그 {NUM}: {STRING}
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_NO_LAST_DEPARTURE :{BLACK}이전 출발이 없습니다.
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_PAST :{BLACK}최근 출발: {TT_TIME}
|
||||
STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_FUTURE :{BLACK}최근 배차된 열차가 아직 출발하지 않았습니다. {TT_TIME}에 출발할 예정입니다.
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_L1 :{BLACK}이 일정에는 {COMMA}대의 열차가 필요합니다.
|
||||
STR_SCHDISPATCH_SUMMARY_L2 :{BLACK}이 일정은 {STRING}마다 반복됩니다.
|
||||
STR_SCHDISPATCH_SUMMARY_L3 :{BLACK}이 일정은 {TT_TIME}에 시작되어서 {TT_TIME}에 끝납니다.
|
||||
|
@ -1019,10 +1019,13 @@ STR_TRACE_RESTRICT_TIME_DAY_ITEM_SHORT :день
|
||||
STR_TRACE_RESTRICT_TIME_MONTH_ITEM_SHORT :месяц
|
||||
STR_TRACE_RESTRICT_TIMETABLE_LATENESS :опоздание
|
||||
STR_TRACE_RESTRICT_TIMETABLE_EARLINESS :ранность
|
||||
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_NEXT :следующий слот отправления
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_LAST :последний слот отправления
|
||||
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_NEXT :следующий
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_LAST :последний
|
||||
|
||||
STR_TRACE_RESTRICT_VALUE_CAPTION :{WHITE}Значение
|
||||
STR_TRACE_RESTRICT_CAPTION :{WHITE}Ограничение на прокладку маршрута
|
||||
STR_TRACE_RESTRICT_CAPTION_SHARED :{WHITE}Ограничение на прокладку маршрута - всего {COMMA} сигналов
|
||||
@ -2184,8 +2187,10 @@ STR_SCHDISPATCH_SLOT_TOOLTIP_TAG :{}Метка {N
|
||||
STR_SCHDISPATCH_SLOT_TOOLTIP_TAG_NAMED :{}Метка {NUM}: {STRING}
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_NO_LAST_DEPARTURE :{BLACK}Предыдущих отправлений нет.
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_PAST :{BLACK}Последнее отправление в {TT_TIME}.
|
||||
STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_FUTURE :{BLACK}Последнее отправление ещё не ушло, оно будет отбывать в {TT_TIME}.
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_L1 :{BLACK}По оценкам, для выполнения этого расписания потребуется не менее {COMMA} транспорт{P "" а ов}.
|
||||
STR_SCHDISPATCH_SUMMARY_L2 :{BLACK}Это расписание повторяется каждый {STRING}.
|
||||
STR_SCHDISPATCH_SUMMARY_L3 :{BLACK}Это расписание началось в {TT_TIME}, и закончится в {TT_TIME}.
|
||||
|
@ -919,10 +919,13 @@ STR_TRACE_RESTRICT_TIME_DAY_ITEM_SHORT :日
|
||||
STR_TRACE_RESTRICT_TIME_MONTH_ITEM_SHORT :月
|
||||
STR_TRACE_RESTRICT_TIMETABLE_LATENESS :延误
|
||||
STR_TRACE_RESTRICT_TIMETABLE_EARLINESS :提前
|
||||
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_NEXT :下个出发条目
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_LAST :上个出发条目
|
||||
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_NEXT :下个
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_LAST :上个
|
||||
|
||||
STR_TRACE_RESTRICT_VALUE_CAPTION :{WHITE}值
|
||||
STR_TRACE_RESTRICT_CAPTION :{WHITE}寻路限制
|
||||
STR_TRACE_RESTRICT_CAPTION_SHARED :{WHITE}寻路限制——由{COMMA}个信号共降
|
||||
@ -2003,6 +2006,7 @@ STR_SCHDISPATCH_MOVE_SCHEDULE :{BLACK}更改
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_PAST :{BLACK}最新的出发条目在 {TT_TIME}.
|
||||
STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_FUTURE :{BLACK}最新的出发条目还没有离开,它将在{TT_TIME}离开
|
||||
|
||||
STR_SCHDISPATCH_SUMMARY_L1 :{BLACK}这个计划调度需要{COMMA}辆车
|
||||
STR_SCHDISPATCH_SUMMARY_L2 :{BLACK}这个计划调度每{STRING}重复一次
|
||||
STR_SCHDISPATCH_SUMMARY_L3 :{BLACK}这个计划调度开始在{TT_TIME},结束在{TT_TIME}
|
||||
|
@ -2334,7 +2334,7 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
|
||||
break;
|
||||
case OCV_DISPATCH_SLOT:
|
||||
if (occ != OCC_IS_TRUE && occ != OCC_IS_FALSE) order->SetConditionComparator(OCC_IS_TRUE);
|
||||
order->SetConditionValue(0);
|
||||
order->SetConditionValue(ODCS_VEH << ODCB_SRC_START);
|
||||
order->GetXDataRef() = UINT16_MAX;
|
||||
break;
|
||||
|
||||
@ -3200,33 +3200,75 @@ static uint16_t GetFreeStationPlatforms(StationID st_id)
|
||||
return counter;
|
||||
}
|
||||
|
||||
bool EvaluateDispatchSlotConditionalOrderVehicleRecord(const Order *order, const LastDispatchRecord &record)
|
||||
{
|
||||
bool value = false;
|
||||
switch ((OrderDispatchConditionModes)GB(order->GetConditionValue(), ODCB_MODE_START, ODCB_MODE_COUNT)) {
|
||||
case ODCM_FIRST_LAST:
|
||||
if (HasBit(order->GetConditionValue(), ODFLCB_LAST_SLOT)) {
|
||||
value = HasBit(record.record_flags, LastDispatchRecord::RF_LAST_SLOT);
|
||||
} else {
|
||||
value = HasBit(record.record_flags, LastDispatchRecord::RF_FIRST_SLOT);
|
||||
}
|
||||
break;
|
||||
|
||||
case OCDM_TAG: {
|
||||
uint8_t tag = (uint8_t)GB(order->GetConditionValue(), ODFLCB_TAG_START, ODFLCB_TAG_COUNT);
|
||||
value = HasBit(record.slot_flags, DispatchSlot::SDSF_FIRST_TAG + tag);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return OrderConditionCompare(order->GetConditionComparator(), value ? 1 : 0, 0);
|
||||
}
|
||||
|
||||
bool EvaluateDispatchSlotConditionalOrder(const Order *order, const Vehicle *v, StateTicks state_ticks, bool *predicted)
|
||||
{
|
||||
uint schedule_index = GB(order->GetXData(), 0, 16);
|
||||
uint16_t schedule_index = static_cast<uint16_t>(GB(order->GetXData(), 0, 16));
|
||||
if (schedule_index >= v->orders->GetScheduledDispatchScheduleCount()) return false;
|
||||
const DispatchSchedule &sched = v->orders->GetDispatchScheduleByIndex(schedule_index);
|
||||
if (sched.GetScheduledDispatch().size() == 0) return false;
|
||||
|
||||
const OrderDispatchConditionSources src = (OrderDispatchConditionSources)GB(order->GetConditionValue(), ODCB_SRC_START, ODCB_SRC_COUNT);
|
||||
if (src == ODCS_VEH) {
|
||||
if (predicted != nullptr) *predicted = true;
|
||||
|
||||
auto iter = v->dispatch_records.find(schedule_index);
|
||||
if (iter == v->dispatch_records.end()) return OrderConditionCompare(order->GetConditionComparator(), 0, 0);
|
||||
|
||||
return EvaluateDispatchSlotConditionalOrderVehicleRecord(order, iter->second);
|
||||
}
|
||||
|
||||
if (sched.GetScheduledDispatch().empty()) return false;
|
||||
|
||||
if (predicted != nullptr) *predicted = true;
|
||||
|
||||
int32_t offset;
|
||||
if (HasBit(order->GetConditionValue(), ODCB_LAST_DISPATCHED)) {
|
||||
int32_t last = sched.GetScheduledDispatchLastDispatch();
|
||||
if (last == INVALID_SCHEDULED_DISPATCH_OFFSET) {
|
||||
/* No last dispatched */
|
||||
return OrderConditionCompare(order->GetConditionComparator(), 0, 0);
|
||||
switch (src) {
|
||||
case ODCS_LAST: {
|
||||
int32_t last = sched.GetScheduledDispatchLastDispatch();
|
||||
if (last == INVALID_SCHEDULED_DISPATCH_OFFSET) {
|
||||
/* No last dispatched */
|
||||
return OrderConditionCompare(order->GetConditionComparator(), 0, 0);
|
||||
}
|
||||
if (last < 0) {
|
||||
last += sched.GetScheduledDispatchDuration() * (1 + (-last / sched.GetScheduledDispatchDuration()));
|
||||
}
|
||||
offset = last % sched.GetScheduledDispatchDuration();
|
||||
break;
|
||||
}
|
||||
if (last < 0) {
|
||||
last += sched.GetScheduledDispatchDuration() * (1 + (-last / sched.GetScheduledDispatchDuration()));
|
||||
|
||||
case ODCS_NEXT: {
|
||||
StateTicks slot = GetScheduledDispatchTime(sched, state_ticks).first;
|
||||
if (slot == INVALID_STATE_TICKS) {
|
||||
/* No next dispatch */
|
||||
return OrderConditionCompare(order->GetConditionComparator(), 0, 0);
|
||||
}
|
||||
offset = (slot - sched.GetScheduledDispatchStartTick()).base() % sched.GetScheduledDispatchDuration();
|
||||
break;
|
||||
}
|
||||
offset = last % sched.GetScheduledDispatchDuration();
|
||||
} else {
|
||||
StateTicks slot = GetScheduledDispatchTime(sched, state_ticks).first;
|
||||
if (slot == INVALID_STATE_TICKS) {
|
||||
/* No next dispatch */
|
||||
return OrderConditionCompare(order->GetConditionComparator(), 0, 0);
|
||||
}
|
||||
offset = (slot - sched.GetScheduledDispatchStartTick()).base() % sched.GetScheduledDispatchDuration();
|
||||
|
||||
default:
|
||||
NOT_REACHED();
|
||||
}
|
||||
|
||||
bool value = false;
|
||||
|
@ -816,12 +816,6 @@ static const StringID _order_timetable_dropdown[] = {
|
||||
INVALID_STRING_ID
|
||||
};
|
||||
|
||||
static const StringID _order_dispatch_slot_dropdown[] = {
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_NEXT,
|
||||
STR_TRACE_RESTRICT_DISPATCH_SLOT_LAST,
|
||||
INVALID_STRING_ID
|
||||
};
|
||||
|
||||
StringID OrderStringForVariable(const Vehicle *v, OrderConditionVariable ocv)
|
||||
{
|
||||
if (ocv == OCV_VEH_IN_SLOT && v->type != VEH_TRAIN) return STR_ORDER_CONDITIONAL_VEHICLE_IN_SLOT;
|
||||
@ -1143,7 +1137,7 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
|
||||
}
|
||||
|
||||
const uint16_t value = order->GetConditionValue();
|
||||
SetDParam(3, HasBit(value, ODCB_LAST_DISPATCHED) ? STR_TRACE_RESTRICT_DISPATCH_SLOT_LAST : STR_TRACE_RESTRICT_DISPATCH_SLOT_NEXT);
|
||||
SetDParam(3, STR_TRACE_RESTRICT_DISPATCH_SLOT_NEXT + GB(value, ODCB_SRC_START, ODCB_SRC_COUNT));
|
||||
|
||||
switch ((OrderDispatchConditionModes)GB(value, ODCB_MODE_START, ODCB_MODE_COUNT)) {
|
||||
case ODCM_FIRST_LAST:
|
||||
@ -2378,7 +2372,7 @@ public:
|
||||
if (ocv == OCV_CARGO_WAITING_AMOUNT) {
|
||||
aux2_sel->SetDisplayedPlane(DP_COND_AUX2_VIA);
|
||||
} else if (is_sched_dispatch) {
|
||||
this->GetWidget<NWidgetCore>(WID_O_COND_SCHED_TEST)->widget_data = HasBit(order->GetConditionValue(), ODCB_LAST_DISPATCHED) ? STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_LAST : STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_NEXT;
|
||||
this->GetWidget<NWidgetCore>(WID_O_COND_SCHED_TEST)->widget_data = STR_TRACE_RESTRICT_DISPATCH_SLOT_SHORT_NEXT + GB(order->GetConditionValue(), ODCB_SRC_START, ODCB_SRC_COUNT);
|
||||
aux2_sel->SetDisplayedPlane(DP_COND_AUX2_SCHED_TEST);
|
||||
} else {
|
||||
aux2_sel->SetDisplayedPlane(SZSP_NONE);
|
||||
@ -3120,7 +3114,11 @@ public:
|
||||
|
||||
case WID_O_COND_SCHED_TEST: {
|
||||
uint16_t value = this->vehicle->GetOrder(this->OrderGetSel())->GetConditionValue();
|
||||
ShowDropDownMenu(this, _order_dispatch_slot_dropdown, HasBit(value, ODCB_LAST_DISPATCHED) ? 1 : 0, WID_O_COND_SCHED_TEST, 0, 0, 0, DDSF_SHARED);
|
||||
DropDownList list;
|
||||
list.push_back(MakeDropDownListStringItem(STR_TRACE_RESTRICT_DISPATCH_SLOT_VEH, ODCS_VEH, false));
|
||||
list.push_back(MakeDropDownListStringItem(STR_TRACE_RESTRICT_DISPATCH_SLOT_NEXT, ODCS_NEXT, false));
|
||||
list.push_back(MakeDropDownListStringItem(STR_TRACE_RESTRICT_DISPATCH_SLOT_LAST, ODCS_LAST, false));
|
||||
ShowDropDownList(this, std::move(list), GB(value, ODCB_SRC_START, ODCB_SRC_COUNT), WID_O_COND_SCHED_TEST, 0, DDMF_NONE, DDSF_SHARED);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3235,7 +3233,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
int selected = (((int)o->GetConditionComparator()) << 16) | (o->GetConditionValue() & ~GetBitMaskSC<uint16_t>(ODCB_LAST_DISPATCHED, 1));
|
||||
int selected = (((int)o->GetConditionComparator()) << 16) | (o->GetConditionValue() & ~GetBitMaskSC<uint16_t>(ODCB_SRC_START, ODCB_SRC_COUNT));
|
||||
ShowDropDownList(this, std::move(list), selected, WID_O_COND_COMPARATOR, 0, DDMF_NONE, DDSF_SHARED);
|
||||
break;
|
||||
}
|
||||
@ -3469,7 +3467,7 @@ public:
|
||||
if (o == nullptr) return;
|
||||
if (o->GetConditionVariable() == OCV_DISPATCH_SLOT) {
|
||||
this->ModifyOrder(this->OrderGetSel(), MOF_COND_COMPARATOR | (index >> 16) << 8);
|
||||
this->ModifyOrder(this->OrderGetSel(), MOF_COND_VALUE | ((o->GetConditionValue() & GetBitMaskSC<uint16_t>(ODCB_LAST_DISPATCHED, 1)) | (index & 0xFFFF)) << 8);
|
||||
this->ModifyOrder(this->OrderGetSel(), MOF_COND_VALUE | ((o->GetConditionValue() & GetBitMaskSC<uint16_t>(ODCB_SRC_START, ODCB_SRC_COUNT)) | (index & 0xFFFF)) << 8);
|
||||
} else {
|
||||
this->ModifyOrder(this->OrderGetSel(), MOF_COND_COMPARATOR | index << 8);
|
||||
}
|
||||
@ -3507,9 +3505,10 @@ public:
|
||||
case WID_O_COND_SCHED_TEST: {
|
||||
const Order *o = this->vehicle->GetOrder(this->OrderGetSel());
|
||||
if (o == nullptr) return;
|
||||
const uint16_t last = GetBitMaskSC<uint16_t>(ODCB_LAST_DISPATCHED, 1);
|
||||
index = (index != 0 ? last : 0) | (o->GetConditionValue() & ~last);
|
||||
this->ModifyOrder(this->OrderGetSel(), MOF_COND_VALUE | index << 8);
|
||||
const uint16_t mask = GetBitMaskSC<uint16_t>(ODCB_SRC_START, ODCB_SRC_COUNT);
|
||||
uint16_t value = (o->GetConditionValue() & ~mask);
|
||||
SB(value, ODCB_SRC_START, ODCB_SRC_COUNT, index);
|
||||
this->ModifyOrder(this->OrderGetSel(), MOF_COND_VALUE | value << 8);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -270,12 +270,49 @@ enum OrderTimetableConditionMode {
|
||||
OTCM_END
|
||||
};
|
||||
|
||||
/**
|
||||
* Condition value field for OCV_DISPATCH_SLOT
|
||||
* 0 1
|
||||
* 0 1 2 3 4 5 6 7 8 9 0
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | |Src| |Mode |
|
||||
* | | | | |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+
|
||||
*
|
||||
* Mode = ODCM_FIRST_LAST
|
||||
* 0 1
|
||||
* 0 1 2 3 4 5 6 7 8 9 0
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+
|
||||
* |X|Src| |Mode |
|
||||
* | | | | |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+
|
||||
* |
|
||||
* First/last slot bit
|
||||
*
|
||||
* Mode = OCDM_TAG
|
||||
* 0 1
|
||||
* 0 1 2 3 4 5 6 7 8 9 0
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | |Src| |Tag| |Mode |
|
||||
* | | | | | | |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+
|
||||
* |
|
||||
* Slot tag
|
||||
*/
|
||||
|
||||
enum OrderDispatchConditionBits {
|
||||
ODCB_LAST_DISPATCHED = 1,
|
||||
ODCB_SRC_START = 1,
|
||||
ODCB_SRC_COUNT = 2,
|
||||
ODCB_MODE_START = 8,
|
||||
ODCB_MODE_COUNT = 3,
|
||||
};
|
||||
|
||||
enum OrderDispatchConditionSources : uint8_t {
|
||||
ODCS_NEXT = 0,
|
||||
ODCS_LAST = 1,
|
||||
ODCS_VEH = 2,
|
||||
};
|
||||
|
||||
enum OrderDispatchConditionModes : uint8_t {
|
||||
ODCM_FIRST_LAST = 0,
|
||||
OCDM_TAG = 1,
|
||||
|
@ -105,7 +105,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
||||
{ XSLFI_INFRA_SHARING, XSCF_NULL, 2, 2, "infra_sharing", nullptr, nullptr, "CPDP" },
|
||||
{ XSLFI_VARIABLE_DAY_LENGTH, XSCF_NULL, 7, 7, "variable_day_length", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_ORDER_OCCUPANCY, XSCF_NULL, 2, 2, "order_occupancy", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_MORE_COND_ORDERS, XSCF_NULL, 17, 17, "more_cond_orders", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_MORE_COND_ORDERS, XSCF_NULL, 18, 18, "more_cond_orders", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_EXTRA_LARGE_MAP, XSCF_NULL, 0, 1, "extra_large_map", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_REVERSE_AT_WAYPOINT, XSCF_NULL, 1, 1, "reverse_at_waypoint", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_VEH_LIFETIME_PROFIT, XSCF_NULL, 1, 1, "veh_lifetime_profit", nullptr, nullptr, nullptr },
|
||||
|
Loading…
Reference in New Issue
Block a user