diff --git a/src/p_tags.cpp b/src/p_tags.cpp index e773b691f..851c4ee94 100644 --- a/src/p_tags.cpp +++ b/src/p_tags.cpp @@ -309,13 +309,24 @@ int FSectorTagIterator::Next() ret = start; start = -1; } - else + else if (searchtag != 0) { while (start >= 0 && tagManager.allTags[start].tag != searchtag) start = tagManager.allTags[start].nexttag; if (start == -1) return -1; ret = tagManager.allTags[start].target; 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; } diff --git a/src/p_tags.h b/src/p_tags.h index 2195821c1..75d397d8d 100644 --- a/src/p_tags.h +++ b/src/p_tags.h @@ -79,7 +79,7 @@ public: FSectorTagIterator(int 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' diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 23a6f58cf..6ac0f115b 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5895,8 +5895,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHigherOrLower) // // A_SetRipperLevel(int level) // -// Sets the ripper level/requirement of the calling actor. -// Also sets the minimum and maximum levels to rip through. +// Sets the ripper level of the calling actor. //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipperLevel) { @@ -5909,26 +5908,24 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipperLevel) // // A_SetRipMin(int min) // -// Sets the ripper level/requirement of the calling actor. -// Also sets the minimum and maximum levels to rip through. +// Sets the minimum level a ripper must be in order to rip through this actor. //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMin) { ACTION_PARAM_START(1); - ACTION_PARAM_INT(min, 1); + ACTION_PARAM_INT(min, 0); self->RipLevelMin = min; } //=========================================================================== // -// A_SetRipMin(int min) +// A_SetRipMax(int max) // -// Sets the ripper level/requirement of the calling actor. -// Also sets the minimum and maximum levels to rip through. +// Sets the minimum level a ripper must be in order to rip through this actor. //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax) { ACTION_PARAM_START(1); - ACTION_PARAM_INT(max, 1); + ACTION_PARAM_INT(max, 0); self->RipLevelMax = max; }