mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Revert "Put taglists in LevelPool memory"
This reverts commit aab0465fab.
This commit is contained in:
parent
804dab2a3f
commit
6cffe744e6
1 changed files with 2 additions and 15 deletions
|
|
@ -31,18 +31,9 @@ taggroup_t* tags_lines[MAXTAGS + 1];
|
||||||
/// \warning This does not rebuild the global taggroups, which are used for iteration.
|
/// \warning This does not rebuild the global taggroups, which are used for iteration.
|
||||||
void Tag_Add (taglist_t* list, const mtag_t tag)
|
void Tag_Add (taglist_t* list, const mtag_t tag)
|
||||||
{
|
{
|
||||||
mtag_t *oldlist;
|
|
||||||
mtag_t *newlist;
|
|
||||||
if (Tag_Find(list, tag))
|
if (Tag_Find(list, tag))
|
||||||
return;
|
return;
|
||||||
oldlist = list->tags;
|
list->tags = Z_Realloc(list->tags, (list->count + 1) * sizeof(mtag_t), PU_LEVEL, NULL);
|
||||||
newlist = Z_LevelPoolMalloc((list->count + 1) * sizeof(mtag_t));
|
|
||||||
if (oldlist)
|
|
||||||
{
|
|
||||||
memcpy(newlist, oldlist, list->count * sizeof(mtag_t));
|
|
||||||
Z_LevelPoolFree(oldlist, list->count * sizeof(mtag_t));
|
|
||||||
}
|
|
||||||
list->tags = newlist;
|
|
||||||
list->tags[list->count++] = tag;
|
list->tags[list->count++] = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,17 +45,13 @@ void Tag_Remove(taglist_t* list, const mtag_t tag)
|
||||||
|
|
||||||
for (i = 0; i < list->count; i++)
|
for (i = 0; i < list->count; i++)
|
||||||
{
|
{
|
||||||
mtag_t *newlist;
|
|
||||||
if (list->tags[i] != tag)
|
if (list->tags[i] != tag)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (; i+1 < list->count; i++)
|
for (; i+1 < list->count; i++)
|
||||||
list->tags[i] = list->tags[i+1];
|
list->tags[i] = list->tags[i+1];
|
||||||
|
|
||||||
newlist = Z_LevelPoolMalloc((list->count - 1) * sizeof(mtag_t));
|
list->tags = Z_Realloc(list->tags, (list->count - 1) * sizeof(mtag_t), PU_LEVEL, NULL);
|
||||||
memcpy(newlist, list->tags, (list->count) * sizeof(mtag_t));
|
|
||||||
Z_LevelPoolFree(list->tags, (list->count) * sizeof(mtag_t));
|
|
||||||
list->tags = newlist;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue