Exemplo n.º 1
0
Arquivo: HASH32.C Projeto: LesInk/Test
T_void Hash32Destroy(T_hash32 hash)
{
    T_word16 i ;
    T_hash32Struct *p_hash ;
    T_hash32Item hashItem ;
    T_doubleLinkListElement element ;
    DebugRoutine("Hash32Destroy") ;

    /* Make sure this is a valid hash table type. */
    DebugCheck(hash != HASH32_BAD) ;
    if (hash != HASH32_BAD)  {
        /* Get a quick pointer to the header. */
        p_hash = (T_hash32Struct *)hash ;

        /* Make sure this is a pointer to a not already dead */
        /* hash table. */
        DebugCheck(p_hash->tag == HASH32_TAG) ;
        if (p_hash->tag == HASH32_TAG)  {
            /* Go through the list of items and remove them all. */
            element = DoubleLinkListGetFirst(p_hash->itemList) ;
            while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)   {
                hashItem =
                    (T_hash32Item)DoubleLinkListElementGetData(element) ;
                Hash32Remove(hashItem);
                element = DoubleLinkListGetFirst(p_hash->itemList) ;
            }

            /* Now destroy all the lists. */
            for (i=0; i<p_hash->indexSize; i++)
                DoubleLinkListDestroy(p_hash->p_index[i]) ;

            /* Free the list of link lists. */
            MemFree(p_hash->p_index) ;

            /* Now destroy the main list. */
            DoubleLinkListDestroy(p_hash->itemList) ;

            /* Tag this block as gone. */
            p_hash->tag = HASH32_DEAD_TAG ;

            /* Now get rid of the header. */
            MemFree(p_hash) ;

            /* Done. */
        }
    }

    DebugEnd() ;
}
Exemplo n.º 2
0
/**
 *  MouseFinish is called when you are done with the mouse module
 *  and no longer need it.  All hooks and variables are changed to non-
 *  active mode and you can consider it no longer being used.
 *
 *<!-----------------------------------------------------------------------*/
T_void MouseFinish(T_void)
{
    DebugRoutine("MouseFinish") ;
    DebugCheck(F_MouseIsInitialized == TRUE) ;
    DebugCheck(G_mouseShowLevel < 2) ;

    DebugCheck(G_eventStack != DOUBLE_LINK_LIST_BAD) ;
    DoubleLinkListDestroy(G_eventStack) ;

    /* Hide the mouse. */
    MouseHide() ;

    /* Turn off the event handler. */
    MouseSetEventHandler(NULL) ;

    /* Set the default options. */
    MouseSetEventOptions(MOUSE_EVENT_DEFAULT_OPTIONS) ;

    /* Allow the mouse to move all over the screen. */
    MouseReleaseBounds() ;

    /* Note that the mouse module is no longer in use. */
    F_MouseIsInitialized = FALSE ;

    /* Free up the mouse background screen. */
    GrScreenFree(G_mouseScreen) ;
#ifdef DOS32
    IMouseUninstallCallback() ;
#endif
    DebugEnd() ;
}
Exemplo n.º 3
0
/* routine cleans up all efx in progress */
T_void EfxFinish (T_void)
{
    T_doubleLinkListElement element ;
    DebugRoutine ("EfxFinish");

    /* clean up effects linked list */
    if (G_effectsInProgress != DOUBLE_LINK_LIST_BAD)
    {
        element = DoubleLinkListGetFirst(G_effectsInProgress) ;
        while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
        {
            EfxDestroy(element) ;
            element = DoubleLinkListGetFirst(G_effectsInProgress) ;
        }

        DoubleLinkListDestroy (G_effectsInProgress);
        G_effectsInProgress=DOUBLE_LINK_LIST_BAD;
    }

    G_numEfxObjectsInWorld=0;

    DebugEnd();
}
Exemplo n.º 4
0
/**
 *  DoubleLinkListFreeAndDestroy goes through a linked list and does a
 *  MemFree on each of the data elements and then calls Destroy on the
 *  whole list.
 *
 *  @param linkList -- Handle to link list to destroy
 *
 *<!-----------------------------------------------------------------------*/
T_void DoubleLinkListFreeAndDestroy(T_doubleLinkList *linkList)
{
    T_doubleLinkListStruct *p_head ;
    T_doubleLinkListStruct *p_at ;
    T_doubleLinkListStruct *p_next ;

    DebugRoutine("DoubleLinkListFreeAndDestroy") ;
    DebugCheck(linkList != DOUBLE_LINK_LIST_BAD) ;

#ifdef COMPILE_OPTION_DOUBLE_LINK_OUTPUT
printf("!F 1 list_%s\n", DebugGetCallerName()) ;
#endif
    /* Get a quick pointer. */
    p_head = (T_doubleLinkListStruct *)(*linkList) ;
    DebugCheck(p_head->tag == DOUBLE_LINK_LIST_TAG) ;

    /* Remove all items in the list.  Hopefully */
    /* all attached data is not allocated memory or is being */
    /* managed by someone else. */
    if (p_head)  {
        p_at = p_head->p_next ;
        while ((p_at != p_head) && (p_at != DOUBLE_LINK_LIST_ELEMENT_BAD))  {
            p_next = p_at->p_next ;
            if (p_at->countOrData.p_data != NULL)  {
                MemFree(p_at->countOrData.p_data) ;
                p_at->countOrData.p_data = NULL ;
            }
            p_at = p_next ;
        }
    }

    DoubleLinkListDestroy(*linkList) ;
    linkList = DOUBLE_LINK_LIST_BAD ;

    DebugEnd() ;
}
Exemplo n.º 5
0
T_void GuildUIEnd    (T_void)
{
    T_word16 i;
    T_mapDescriptionStruct *p_map;
    T_doubleLinkListElement element,nextElement;
    DebugRoutine ("GuildUIEnd");

    /* destroy ui objects */
    GraphicDelete (G_backgroundPic);
    G_backgroundPic=NULL;

    for (i=0;i<4;i++)
    {
        ButtonDelete(G_upButtons[i]);
        G_upButtons[i]=NULL;
        ButtonDelete(G_dnButtons[i]);
        G_dnButtons[i]=NULL;
        TxtboxDelete (G_displayBoxes[i]);
        GraphicDelete (G_scrollBars[i]);
        G_scrollBars[i]=NULL;
    }

    ButtonDelete (G_joinButton);
    ButtonDelete (G_createButton);
    G_joinButton=NULL;
    G_createButton=NULL;

    /* free up maps data */
    element=DoubleLinkListGetFirst(G_mapList);
    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        nextElement=DoubleLinkListElementGetNext(element);
        p_map=(T_mapDescriptionStruct *)DoubleLinkListElementGetData(element);
        MemFree (p_map->name);
        MemFree (p_map->description);
        MemFree (p_map);
        element=nextElement;
    }
    DoubleLinkListDestroy (G_mapList);
    G_mapList=DOUBLE_LINK_LIST_BAD;

    /* free up game list data */
    DoubleLinkListFreeAndDestroy(&G_gameList) ;
#if 0
    element=DoubleLinkListGetFirst(G_gameList);
    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        nextElement=DoubleLinkListElementGetNext(element);
        p_game=(T_gameDescriptionStruct *)DoubleLinkListElementGetData(element);
        MemFree(p_game);
        element=nextElement;
    }
    DoubleLinkListDestroy (G_gameList);
    G_gameList=DOUBLE_LINK_LIST_BAD;
#endif

    /* free up player list data */
//    GuildUIClearPlayers();
    DoubleLinkListFreeAndDestroy (&G_playerList);
//    G_playerList=DOUBLE_LINK_LIST_BAD;

    DebugEnd();
}
Exemplo n.º 6
0
Arquivo: FORM.C Projeto: LesInk/Test
T_void FormPop(T_void)
{
    T_formObjectID *p_formObjs;
    T_doubleLinkListElement element;
    T_void *p_state;
    T_formVariousValues *p_values;

    DebugRoutine("FormPop");

    /* Recover the form callback */
    element = DoubleLinkListGetFirst(G_formStack);
    p_values = (T_formVariousValues *)DoubleLinkListElementGetData(element);
    formcallback = p_values->callback;
    G_formHasTextBoxes = p_values->hasText;
    G_formHasButtons = p_values->hasButtons;
    MemFree(p_values);
    DoubleLinkListRemoveElement(element);

    /* Recover the list of text boxes */
    element = DoubleLinkListGetFirst(G_formStack);
    p_state = DoubleLinkListElementGetData(element);
    TxtboxSetStateBlock(p_state);
    MemFree(p_state);
    DoubleLinkListRemoveElement(element);

    /* Recover the list of sliders */
    element = DoubleLinkListGetFirst(G_formStack);
    p_state = DoubleLinkListElementGetData(element);
    SliderSetStateBlock(p_state);
    MemFree(p_state);
    DoubleLinkListRemoveElement(element);

    /* Recover the list of graphics */
    element = DoubleLinkListGetFirst(G_formStack);
    p_state = DoubleLinkListElementGetData(element);
    GraphicSetStateBlock(p_state);
    MemFree(p_state);
    DoubleLinkListRemoveElement(element);

    /* Recover the list of buttons */
    element = DoubleLinkListGetFirst(G_formStack);
    p_state = DoubleLinkListElementGetData(element);
    ButtonSetStateBlock(p_state);
    MemFree(p_state);
    DoubleLinkListRemoveElement(element);

    /* Recover the list of form objects */
    element = DoubleLinkListGetFirst(G_formStack);
    p_formObjs = DoubleLinkListElementGetData(element);
    memcpy(G_formObjectArray, p_formObjs, sizeof(G_formObjectArray));
    MemFree(p_formObjs);
    DoubleLinkListRemoveElement(element);

    /* If the list is empty, destroy it. */
    if (DoubleLinkListGetNumberElements(G_formStack) == 0) {
        DoubleLinkListDestroy(G_formStack);
        G_formStack = DOUBLE_LINK_LIST_BAD;
    }

    DebugEnd();
}