예제 #1
0
iterlist_t *P_GetSectorIterListForTag(int tag, boolean createNewList)
{
    // Do we have an existing list for this tag?
    for(uint i = 0; i < numSectorTagLists; ++i)
    {
        if(sectorTagLists[i].tag == tag)
            return sectorTagLists[i].list;
    }

    if(!createNewList)
        return 0;

    // Nope, we need to allocate another.
    numSectorTagLists++;
    sectorTagLists = (TagList *)realloc(sectorTagLists, sizeof(TagList) * numSectorTagLists);
    TagList *tagList = &sectorTagLists[numSectorTagLists - 1];
    tagList->tag = tag;

    return (tagList->list = IterList_New());
}
예제 #2
0
iterlist_t* P_GetLineIterListForTag(int tag, boolean createNewList)
{
    taglist_t* tagList;
    uint i;

    // Do we have an existing list for this tag?
    for(i = 0; i < numLineTagLists; ++i)
        if(lineTagLists[i].tag == tag)
            return lineTagLists[i].list;

    if(!createNewList)
        return NULL;

    // Nope, we need to allocate another.
    numLineTagLists++;
    lineTagLists = realloc(lineTagLists, sizeof(taglist_t) * numLineTagLists);
    tagList = &lineTagLists[numLineTagLists - 1];
    tagList->tag = tag;

    return (tagList->list = IterList_New());
}