minor improvements

This commit is contained in:
Monica Moniot
2022-11-11 10:46:55 -05:00
parent 3d71275330
commit a0ac3d4d24
2 changed files with 86 additions and 77 deletions

View File

@@ -9,3 +9,9 @@ Date: 2022-11-10
Features:
- Removed provide-threshold
- Added ability to specify station type on a cybernetic combinator
---------------------------------------------------------------------------------------------------
Version: 0.2.1
Date: 2022-11-11
Features:
- Minor bugfixes and performance improvements

View File

@@ -257,27 +257,32 @@ local function tick_poll_station(map_data, mod_settings)
local all_p_stations = map_data.economy.all_p_stations
local all_names = map_data.economy.all_names
while true do
local station_id
local station
while true do--choose a station
tick_data.i = (tick_data.i or 0) + 1
if tick_data.i > #map_data.all_station_ids then
tick_data.i = nil
map_data.tick_state = STATE_DISPATCH
return true
end
local station_id = map_data.all_station_ids[tick_data.i]
local station = map_data.stations[station_id]
if station == nil then
table_remove(map_data.all_station_ids, tick_data.i)
tick_data.i = tick_data.i - 1
return false
end
station_id = map_data.all_station_ids[tick_data.i]
station = map_data.stations[station_id]
if station then
if station.display_update then
update_combinator_display(station.entity_comb1, station.display_failed_request)
station.display_update = station.display_failed_request
station.display_failed_request = nil
end
if station.network_name and station.deliveries_total < station.entity_stop.trains_limit then
break
end
else
--lazy delete removed stations
table_remove(map_data.all_station_ids, tick_data.i)
tick_data.i = tick_data.i - 1
end
end
station.r_threshold = mod_settings.r_threshold
station.priority = 0
station.locked_slots = 0
@@ -343,8 +348,6 @@ local function tick_poll_station(map_data, mod_settings)
end
return false
end
end
end
---@param map_data MapData
---@param mod_settings CybersynModSettings
local function tick_dispatch(map_data, mod_settings)