Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
Update storage index on empty storage
Browse files Browse the repository at this point in the history
  • Loading branch information
Ukendio committed Dec 24, 2023
1 parent 234d8d9 commit d65ac20
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/query.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ end
local function nextItem(query)
local world = query.world
local currentCompatibleArchetype = query.currentCompatibleArchetype
local storageIndex = query.storageIndex
local seenEntities = query.seenEntities
local compatibleArchetypes = query.compatibleArchetypes

local entityId, entityData

local storages = world._storages
repeat
local nextStorage = storages[storageIndex]
local nextStorage = storages[query.storageIndex]
local currently = nextStorage[currentCompatibleArchetype]
if currently then
entityId, entityData = next(currently, query.lastEntityId)
Expand All @@ -51,9 +50,9 @@ local function nextItem(query)
currentCompatibleArchetype = next(compatibleArchetypes, currentCompatibleArchetype)

if currentCompatibleArchetype == nil then
storageIndex += 1
query.storageIndex += 1

nextStorage = storages[storageIndex]
nextStorage = storages[query.storageIndex]

if nextStorage == nil or next(nextStorage) == nil then
return
Expand Down

0 comments on commit d65ac20

Please sign in to comment.