diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj index 105e1def8..d79dde766 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj +++ b/src/sdl/Srb2SDL-vc10.vcxproj @@ -245,6 +245,7 @@ + @@ -304,6 +305,7 @@ + @@ -415,6 +417,7 @@ + @@ -475,10 +478,12 @@ + + true diff --git a/src/sdl/Srb2SDL-vc10.vcxproj.filters b/src/sdl/Srb2SDL-vc10.vcxproj.filters index 404890397..4d2532ca4 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj.filters +++ b/src/sdl/Srb2SDL-vc10.vcxproj.filters @@ -135,6 +135,16 @@ D_Doom + + D_Doom + + + D_Doom + + + D_Doom + + D_Doom @@ -288,6 +298,9 @@ I_Interface + + I_Interface + I_Interface @@ -402,6 +415,9 @@ P_Play + + P_Play + R_Rend @@ -600,6 +616,16 @@ D_Doom + + D_Doom + + + D_Doom + + + D_Doom + + D_Doom @@ -747,6 +773,9 @@ LUA + + LUA + LUA @@ -792,6 +821,9 @@ M_Misc + + M_Misc + O_Other @@ -852,6 +884,9 @@ P_Play + + P_Play + P_Play diff --git a/src/taglist.c b/src/taglist.c index ad1b9dc4b..d08750f9b 100644 --- a/src/taglist.c +++ b/src/taglist.c @@ -191,6 +191,38 @@ void Taggroup_Add (taggroup_t *garray[], const mtag_t tag, size_t id) group->elements[i] = id; } +static void Taggroup_Add_Init(taggroup_t *garray[], const mtag_t tag, size_t id) +{ + taggroup_t *group; + + if (tag == MTAG_GLOBAL) + return; + + group = garray[(UINT16)tag]; + + if (! in_bit_array(tags_available, tag)) + { + num_tags++; + set_bit_array(tags_available, tag); + } + + // Create group if empty. + if (!group) + group = garray[(UINT16)tag] = Z_Calloc(sizeof(taggroup_t), PU_LEVEL, NULL); + else if (group->elements[group->count - 1] == id) + return; // Don't add duplicates + + group->count++; + + if (group->count > group->capacity) + { + group->capacity = 2 * group->count; + group->elements = Z_Realloc(group->elements, group->capacity * sizeof(size_t), PU_LEVEL, NULL); + } + + group->elements[group->count - 1] = id; +} + static size_t total_elements_with_tag (const mtag_t tag) { return @@ -250,17 +282,17 @@ void Taggroup_Remove (taggroup_t *garray[], const mtag_t tag, size_t id) static void Taglist_AddToSectors (const mtag_t tag, const size_t itemid) { - Taggroup_Add(tags_sectors, tag, itemid); + Taggroup_Add_Init(tags_sectors, tag, itemid); } static void Taglist_AddToLines (const mtag_t tag, const size_t itemid) { - Taggroup_Add(tags_lines, tag, itemid); + Taggroup_Add_Init(tags_lines, tag, itemid); } static void Taglist_AddToMapthings (const mtag_t tag, const size_t itemid) { - Taggroup_Add(tags_mapthings, tag, itemid); + Taggroup_Add_Init(tags_mapthings, tag, itemid); } /// After all taglists have been built for each element (sectors, lines, things), diff --git a/src/taglist.h b/src/taglist.h index d045eb827..ae1a81c89 100644 --- a/src/taglist.h +++ b/src/taglist.h @@ -41,6 +41,7 @@ typedef struct { size_t *elements; size_t count; + size_t capacity; } taggroup_t; extern bitarray_t tags_available[];