mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 23:33:00 +00:00
- fixed: Searching for tag 0 was no longer possible.
The new tag manager considers tag 0 'untagged' and won't create entries in its tag list for it, so the normal search algorithm can not find any such sector. It now uses a linear search over all sectors instead, if tag 0 is looked for.
This commit is contained in:
parent
c75a762e7e
commit
6f0caee4ba
2 changed files with 13 additions and 2 deletions
|
@ -309,13 +309,24 @@ int FSectorTagIterator::Next()
|
||||||
ret = start;
|
ret = start;
|
||||||
start = -1;
|
start = -1;
|
||||||
}
|
}
|
||||||
else
|
else if (searchtag != 0)
|
||||||
{
|
{
|
||||||
while (start >= 0 && tagManager.allTags[start].tag != searchtag) start = tagManager.allTags[start].nexttag;
|
while (start >= 0 && tagManager.allTags[start].tag != searchtag) start = tagManager.allTags[start].nexttag;
|
||||||
if (start == -1) return -1;
|
if (start == -1) return -1;
|
||||||
ret = tagManager.allTags[start].target;
|
ret = tagManager.allTags[start].target;
|
||||||
start = tagManager.allTags[start].nexttag;
|
start = tagManager.allTags[start].nexttag;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// with the tag manager, searching for tag 0 has to be different, because it won't create entries for untagged sectors.
|
||||||
|
while (start < numsectors && tagManager.SectorHasTags(start))
|
||||||
|
{
|
||||||
|
start++;
|
||||||
|
}
|
||||||
|
if (start == numsectors) return -1;
|
||||||
|
ret = start;
|
||||||
|
start++;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
FSectorTagIterator(int tag)
|
FSectorTagIterator(int tag)
|
||||||
{
|
{
|
||||||
searchtag = tag;
|
searchtag = tag;
|
||||||
start = tagManager.TagHashFirst[((unsigned int)tag) % FTagManager::TAG_HASH_SIZE];
|
start = tag == 0 ? 0 : tagManager.TagHashFirst[((unsigned int)tag) % FTagManager::TAG_HASH_SIZE];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special constructor for actions that treat tag 0 as 'back of activation line'
|
// Special constructor for actions that treat tag 0 as 'back of activation line'
|
||||||
|
|
Loading…
Reference in a new issue