This commit is contained in:
Christoph Oelckers 2015-05-04 10:54:07 +02:00
commit 9b331b1713
3 changed files with 19 additions and 11 deletions

View file

@ -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;
} }

View file

@ -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'

View file

@ -5895,8 +5895,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHigherOrLower)
// //
// A_SetRipperLevel(int level) // A_SetRipperLevel(int level)
// //
// Sets the ripper level/requirement of the calling actor. // Sets the ripper level of the calling actor.
// Also sets the minimum and maximum levels to rip through.
//=========================================================================== //===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipperLevel) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipperLevel)
{ {
@ -5909,26 +5908,24 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipperLevel)
// //
// A_SetRipMin(int min) // A_SetRipMin(int min)
// //
// Sets the ripper level/requirement of the calling actor. // Sets the minimum level a ripper must be in order to rip through this actor.
// Also sets the minimum and maximum levels to rip through.
//=========================================================================== //===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMin) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMin)
{ {
ACTION_PARAM_START(1); ACTION_PARAM_START(1);
ACTION_PARAM_INT(min, 1); ACTION_PARAM_INT(min, 0);
self->RipLevelMin = min; self->RipLevelMin = min;
} }
//=========================================================================== //===========================================================================
// //
// A_SetRipMin(int min) // A_SetRipMax(int max)
// //
// Sets the ripper level/requirement of the calling actor. // Sets the minimum level a ripper must be in order to rip through this actor.
// Also sets the minimum and maximum levels to rip through.
//=========================================================================== //===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax)
{ {
ACTION_PARAM_START(1); ACTION_PARAM_START(1);
ACTION_PARAM_INT(max, 1); ACTION_PARAM_INT(max, 0);
self->RipLevelMax = max; self->RipLevelMax = max;
} }