cleared compilation errors

This commit is contained in:
mamoniot
2022-12-23 10:53:12 -05:00
parent 13eefd8f16
commit eb2feeaa3e
2 changed files with 13 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
--By Mami --By Mami
--<goto p_continue> at line 310 jumps into the scope of local 'p_flag'
require("scripts.constants") require("scripts.constants")
require("scripts.global") require("scripts.global")
require("scripts.factorio-api") require("scripts.factorio-api")

View File

@@ -304,15 +304,17 @@ local function tick_dispatch(map_data, mod_settings)
---@type uint ---@type uint
local j = 1 local j = 1
while j <= #p_stations do while j <= #p_stations do
local p_flag, r_flag, netand, slot_threshold, best_p_train_id, best_t_prior, best_t_to_p_dist, effective_count, override_threshold, p_prior, best_p_dist
local p_station_id = p_stations[j] local p_station_id = p_stations[j]
local p_station = stations[p_station_id] local p_station = stations[p_station_id]
if not p_station or p_station.deliveries_total >= p_station.entity_stop.trains_limit then if not p_station or p_station.deliveries_total >= p_station.entity_stop.trains_limit then
goto p_continue goto p_continue
end end
local p_flag = p_station.network_name == NETWORK_EVERY and (p_station.network_flag[item_name] or 0) or p_station.network_flag p_flag = p_station.network_name == NETWORK_EVERY and (p_station.network_flag[item_name] or 0) or p_station.network_flag
local r_flag = r_station.network_name == NETWORK_EVERY and (r_station.network_flag[item_name] or 0) or r_station.network_flag r_flag = r_station.network_name == NETWORK_EVERY and (r_station.network_flag[item_name] or 0) or r_station.network_flag
local netand = band(p_flag, r_flag) netand = band(p_flag, r_flag)
if netand == 0 then if netand == 0 then
goto p_continue goto p_continue
end end
@@ -323,7 +325,6 @@ local function tick_dispatch(map_data, mod_settings)
---------------------------------------------------------------- ----------------------------------------------------------------
-- check for valid train -- check for valid train
---------------------------------------------------------------- ----------------------------------------------------------------
local slot_threshold
if r_station.is_stack and item_type == "item" then if r_station.is_stack and item_type == "item" then
slot_threshold = r_threshold slot_threshold = r_threshold
r_threshold = r_threshold*get_stack_size(map_data, item_name) r_threshold = r_threshold*get_stack_size(map_data, item_name)
@@ -332,9 +333,9 @@ local function tick_dispatch(map_data, mod_settings)
end end
---@type uint? ---@type uint?
local best_p_train_id = nil best_p_train_id = nil
local best_t_prior = -INF best_t_prior = -INF
local best_t_to_p_dist = INF best_t_to_p_dist = INF
if trains then if trains then
for train_id, _ in pairs(trains) do for train_id, _ in pairs(trains) do
local train = map_data.trains[train_id] local train = map_data.trains[train_id]
@@ -395,8 +396,8 @@ local function tick_dispatch(map_data, mod_settings)
goto p_continue goto p_continue
end end
local effective_count = p_station.item_p_counts[item_name] effective_count = p_station.item_p_counts[item_name]
local override_threshold = p_station.item_thresholds and p_station.item_thresholds[item_name] override_threshold = p_station.item_thresholds and p_station.item_thresholds[item_name]
if override_threshold and p_station.is_stack and item_type == "item" then if override_threshold and p_station.is_stack and item_type == "item" then
override_threshold = override_threshold*get_stack_size(map_data, item_name) override_threshold = override_threshold*get_stack_size(map_data, item_name)
end end
@@ -407,7 +408,7 @@ local function tick_dispatch(map_data, mod_settings)
goto p_continue_remove goto p_continue_remove
end end
local p_prior = p_station.priority p_prior = p_station.priority
if override_threshold and p_station.item_priority then if override_threshold and p_station.item_priority then
p_prior = p_station.item_priority--[[@as int]] p_prior = p_station.item_priority--[[@as int]]
end end
@@ -415,7 +416,7 @@ local function tick_dispatch(map_data, mod_settings)
goto p_continue goto p_continue
end end
local best_p_dist = best_t_to_p_dist + get_stop_dist(p_station.entity_stop, r_station.entity_stop) best_p_dist = best_t_to_p_dist + get_stop_dist(p_station.entity_stop, r_station.entity_stop)
if p_prior == best_p_prior and best_p_dist > best_dist then if p_prior == best_p_prior and best_p_dist > best_dist then
goto p_continue goto p_continue
end end