P07-01-WX: 仕上がった天候の機能の受入:自然天候・雨・嵐・世界樹と成人客のマナ霧・上部の表示と予報・保存と移行(マナ炉の産出 120 を除く。P07-01 の補助の作業。原単位への加算 0)
This commit is contained in:
@@ -1013,6 +1013,15 @@ func _process_arrival_boundary(minute: int) -> CommandResult:
|
||||
&"ARRIVAL_PLAN", minute, PHASE_CAPTURE, &"ARRIVAL_CAPTURE_INVALID"
|
||||
)
|
||||
var external_capacity := int(capacity_value)
|
||||
# A13: the arrival boundary reports the weather share of planned arrivals
|
||||
# (rain 50, otherwise 100). Absent means 100 for callers without weather.
|
||||
var percent_value: Variant = capture.get(&"arrival_percent", 100)
|
||||
if not _is_integral_value(percent_value) or int(percent_value) < 0 or int(percent_value) > 100:
|
||||
return _failed_boundary_after_capture(
|
||||
_arrival_boundary, capture_payload, token,
|
||||
&"ARRIVAL_PLAN", minute, PHASE_CAPTURE, &"ARRIVAL_CAPTURE_INVALID"
|
||||
)
|
||||
var arrival_percent := int(percent_value)
|
||||
var remaining := mini(
|
||||
mini(local_capacity, external_capacity),
|
||||
int(_config[&"max_arrivals_per_interval"])
|
||||
@@ -1022,6 +1031,8 @@ func _process_arrival_boundary(minute: int) -> CommandResult:
|
||||
var plans: Array[Dictionary] = []
|
||||
var total_count := 0
|
||||
var capped_rows: Array[Dictionary] = []
|
||||
var accepted_by_row: Array[int] = []
|
||||
var planned_total := 0
|
||||
for row: Dictionary in intent_rows:
|
||||
var accepted := mini(int(row[&"desired_count"]), remaining)
|
||||
var key: String = row[&"key"]
|
||||
@@ -1034,6 +1045,21 @@ func _process_arrival_boundary(minute: int) -> CommandResult:
|
||||
&"guest_class": String(row[&"guest_class"]),
|
||||
&"discarded_numerator": retained - capped_retained,
|
||||
})
|
||||
accepted_by_row.append(accepted)
|
||||
planned_total += accepted
|
||||
remaining -= accepted
|
||||
# Rain keeps floor(planned * percent / 100) arrivals; the dropped arrivals
|
||||
# are lost to the weather and are not carried to the next boundary.
|
||||
var dropped := planned_total - planned_total * arrival_percent / 100
|
||||
var drop_index := accepted_by_row.size() - 1
|
||||
while dropped > 0 and drop_index >= 0:
|
||||
var cut := mini(dropped, accepted_by_row[drop_index])
|
||||
accepted_by_row[drop_index] -= cut
|
||||
dropped -= cut
|
||||
drop_index -= 1
|
||||
for row_index in intent_rows.size():
|
||||
var row: Dictionary = intent_rows[row_index]
|
||||
var accepted := accepted_by_row[row_index]
|
||||
if accepted <= 0:
|
||||
continue
|
||||
if plan_sequence > MAX_SEQUENCE_VALUE \
|
||||
@@ -1058,7 +1084,6 @@ func _process_arrival_boundary(minute: int) -> CommandResult:
|
||||
})
|
||||
plan_sequence += 1
|
||||
total_count += accepted
|
||||
remaining -= accepted
|
||||
|
||||
var payload := capture_payload.duplicate(true)
|
||||
payload[&"plans"] = plans
|
||||
|
||||
Reference in New Issue
Block a user