예제 #1
0
/* displays information about an open game */
static T_void GuildDisplayGameInfo (T_TxtboxID TxtboxID)
{
    T_sword16 selection;
    T_doubleLinkListElement element;
    T_gameDescriptionStruct *p_game;
    T_mapDescriptionStruct *p_map;
    T_gameDescriptionStruct blank = { 0, 0 } ;

    DebugRoutine ("GuildDisplayGameInfo");

    selection=TxtboxGetSelectionNumber(TxtboxID);
    element=DoubleLinkListGetFirst (G_gameList);

    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        /* compare this game entry to the selection number */
        if (selection==0)
        {
            /* this is the one - */
            p_game=(T_gameDescriptionStruct *)DoubleLinkListElementGetData(element);
            /* find map */
            element=DoubleLinkListGetFirst (G_mapList);
            while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
            {
                p_map=(T_mapDescriptionStruct *)DoubleLinkListElementGetData(element);
                if (p_map->mapIndex==p_game->mapNumber)
                {
                    /* display this one */
                    TxtboxCursSetRow (G_displayBoxes[GUILD_MAPS_LIST],selection);
                    TxtboxSetData (G_displayBoxes[GUILD_MAPS_DESC],p_map->description);
                    break;
                }
                element=DoubleLinkListElementGetNext(element);
                selection++;
            }
            break;
        }
        element=DoubleLinkListElementGetNext(element);
        selection--;
    }

   /* request player list for this game from server here */
    if (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
        GuildUIRequestPlayerListForOpenGame(p_game);
    else
        GuildUIRequestPlayerListForOpenGame(&blank) ;

    DebugEnd();
}
예제 #2
0
T_void GuildUIGetSelectedGame(
                  T_word16 *p_mapNumber,
                  T_gameGroupID *p_groupID,
				  T_word16 *p_quest)
{
    T_word16 i, index ;
    T_gameDescriptionStruct *p_game ;
    T_doubleLinkListElement element ;

    DebugRoutine("GuildUIGetSelectedGame") ;

    /* Just the appropriate text line on the list. */
    index = TxtboxGetSelectionNumber(G_displayBoxes[GUILD_GAME_LIST]) ;

    element = DoubleLinkListGetFirst(G_gameList) ;
    for (i=0; i<index; i++)  {
        element = DoubleLinkListElementGetNext(element) ;
    }
    if (element != DOUBLE_LINK_LIST_ELEMENT_BAD)  {
        p_game = (T_gameDescriptionStruct *)
                    DoubleLinkListElementGetData(element) ;
        *p_mapNumber = p_game->mapNumber ;
        *p_groupID = p_game->groupID ;
		*p_quest = p_game->questNumber;
    } else {
        /* Element not found?  Return zero. */
        *p_mapNumber = 0 ;
        *p_groupID = *DirectTalkGetNullBlankUniqueAddress() ;
		*p_quest = 0 ;
    }

    DebugEnd() ;
}
예제 #3
0
/* information block about an adventure */
static T_void GuildDisplayMapInfo (T_TxtboxID TxtboxID)
{
    T_word16 selection;
    T_mapDescriptionStruct *p_map;
    T_doubleLinkListElement element;

    DebugRoutine ("GuildDisplayMapInfo");

    selection=TxtboxGetSelectionNumber(TxtboxID);
    element=DoubleLinkListGetFirst(G_mapList);

    /* Record that adventure as the selected adventure. */
    StatsSetCurrentQuestNumber(selection);

    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        if (selection==0)
        {

            /* display this map information */
            p_map=DoubleLinkListElementGetData(element);
            TxtboxSetData (G_displayBoxes[GUILD_MAPS_DESC],p_map->description);
            break;
        }

        selection-=1;
        element=DoubleLinkListElementGetNext(element);
    }


    DebugEnd();
}
예제 #4
0
/* removes a player name from the list of players for the selected game */
T_void GuildUIRemovePlayer (T_byte8 *playerName)
{
    T_doubleLinkListElement element;
    T_byte8 *name;
    T_word32 size;
    DebugRoutine ("GuildUIRemovePlayer");

    size=TxtboxCanFit(G_displayBoxes[GUILD_GAME_DESC],playerName);
    element=DoubleLinkListGetFirst(G_playerList);

    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        name=(T_byte8 *)DoubleLinkListElementGetData(element);
        if (strncmp(name,playerName,size)==0)
        {
            /* remove element */
            MemFree(name);
            DoubleLinkListRemoveElement(element);
            break;
        }
        element=DoubleLinkListElementGetNext(element);
    }

    GuildUIDrawPlayerList();

    DebugEnd();
}
예제 #5
0
파일: HASH32.C 프로젝트: LesInk/Test
T_hash32Item Hash32ItemGetNext(T_hash32Item hashItem)
{
    T_hash32ItemStruct *p_item ;
    T_hash32ItemStruct *p_next ;
    T_doubleLinkListElement element ;

    DebugRoutine("Hash32ItemGetNext") ;

    /* Check to see if the item is bad. */
    DebugCheck(hashItem != HASH32_ITEM_BAD) ;
    if (hashItem != HASH32_ITEM_BAD)  {
        /* Get a quick pointer. */
        p_item = (T_hash32ItemStruct *)hashItem ;

        /* See if the tag is correct. */
        DebugCheck(p_item->tag == HASH32_ITEM_TAG) ;
        if (p_item->tag == HASH32_ITEM_TAG)  {
            /* Item is good.  Look up the next item. */
            element = DoubleLinkListElementGetNext(p_item->elementInBigList) ;
            if (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
                p_next = DoubleLinkListElementGetData(element) ;
            else
                p_next = HASH32_ITEM_BAD ;
        }
    }

    DebugEnd() ;

    return ((T_hash32Item) p_next) ;
}
예제 #6
0
static T_word16 GuildUIGetSelectedAdventure(T_void)
{
    T_word16 adventure ;
    T_word16 i, index ;
    T_mapDescriptionStruct *p_map ;
    T_doubleLinkListElement element ;

    DebugRoutine("GuildUIGetSelectedAdventure") ;

    /* Just the appropriate text line on the list. */
    index = TxtboxGetSelectionNumber(G_displayBoxes[GUILD_MAPS_LIST]) ;
    StatsSetCurrentQuestNumber(index);

    element = DoubleLinkListGetFirst(G_mapList) ;
    for (i=0; i<index; i++)  {
        element = DoubleLinkListElementGetNext(element) ;
    }
    if (element != DOUBLE_LINK_LIST_ELEMENT_BAD)  {
        p_map = (T_mapDescriptionStruct *)
                    DoubleLinkListElementGetData(element) ;
        adventure = p_map->mapIndex ;
    } else {
        /* Element not found? */
        DebugCheck(FALSE) ;
        adventure = 0 ;
    }

    DebugEnd() ;

    return adventure ;
}
예제 #7
0
파일: HASH32.C 프로젝트: LesInk/Test
T_hash32Item Hash32GetFirstItem(T_hash32 hash)
{
    T_hash32Struct *p_hash ;
    T_hash32ItemStruct *p_item = HASH32_ITEM_BAD ;
    T_doubleLinkListElement element ;

    DebugRoutine("Hash32GetFirstItem") ;

    /* 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)  {
            /* See if there is anything in that list. */
            element = DoubleLinkListGetFirst(p_hash->itemList) ;
            if (element != DOUBLE_LINK_LIST_ELEMENT_BAD)  {
                /* Found something.  Get the hash item. */
                p_item = DoubleLinkListElementGetData(element) ;
            }
        }
    }

    DebugEnd() ;

    return ((T_hash32Item)p_item) ;
}
예제 #8
0
/* removes a game from the list of active 'open' games */
T_void GuildUIRemoveGame (T_word16 mapNumber, T_gameGroupID groupID)
{
    T_gameDescriptionStruct *p_game;
    T_doubleLinkListElement element,nextElement;
    DebugRoutine ("GuildUIRemoveGame");

    element=DoubleLinkListGetFirst(G_gameList);

    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        nextElement=DoubleLinkListElementGetNext(element);
        p_game=(T_gameDescriptionStruct *)DoubleLinkListElementGetData(element);

        if ((p_game->mapNumber==mapNumber) &&
            (CompareGameGroupIDs(p_game->groupID, groupID)))
        {
            /* remove this one */
            MemFree(p_game);
            DoubleLinkListRemoveElement(element);
            break;
        }

        element=nextElement;
    }

    /* Only redraw the list if we are not joining or creating a game. */
    if (PeopleHereGetOurState() == 0)
        GuildUIDrawGameList();

    DebugEnd();
}
예제 #9
0
/* to our current player */
static E_Boolean GuildUIPlayerCanVisitMap (T_word16 which)
{
    T_doubleLinkListElement element;
    E_Boolean canGo=FALSE;
    T_word16 count=0;
    T_mapDescriptionStruct *p_mapDesc;

    DebugRoutine ("GuildUIPlayerCanVisitMap");
    element=DoubleLinkListGetFirst (G_mapList);
    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        if (count==which)
        {
            /* check this map */
            p_mapDesc=(T_mapDescriptionStruct *)DoubleLinkListElementGetData(element);
            if (p_mapDesc->mapKey==0) canGo=TRUE;
            else if (StatsPlayerHasNotePage(p_mapDesc->mapKey)) canGo=TRUE;
            break;
        }
        count++;
        element=DoubleLinkListElementGetNext(element);
    }

    DebugEnd();
    return (canGo);
}
예제 #10
0
/* redraws the list of open games */
static T_void GuildUIDrawGameList(T_void)
{
    T_doubleLinkListElement element;
    T_gameDescriptionStruct *p_game=NULL;
    T_mapDescriptionStruct *p_map=NULL;
    T_byte8 *listData=NULL;
    T_byte8 *temp=NULL;
    T_byte8 stmp[64];
    T_word16 count=0;
    T_word32 size=0;

    DebugRoutine ("GuildUIDrawGameList");
    element=DoubleLinkListGetFirst (G_gameList);
    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        /* get this element's data */
        p_game=(T_gameDescriptionStruct *)DoubleLinkListElementGetData(element);

        /* find corresponding map information structure */
        p_map=GuildUIGetMapDescription(p_game->mapNumber);

        /* make this data line */
        sprintf (stmp,"%s\r",p_map->name);

        /* add to list */
        if (listData != NULL) size=strlen(listData);
        else size=0;
        size+=strlen(stmp);
        temp=MemAlloc(size+2);
        if (listData != NULL) sprintf (temp,"%s%s",listData,stmp);
        else strcpy (temp,stmp);
        if (listData != NULL) MemFree(listData);

        listData=temp;
        temp=NULL;

        element=DoubleLinkListElementGetNext(element);
    }

    if (listData != NULL)
    {
        /* get rid of last '\r' */
        listData[strlen(listData)-1]='\0';
        TxtboxSetData(G_displayBoxes[GUILD_GAME_LIST],listData);
        MemFree(listData);
    }
    else
    {
        TxtboxSetData(G_displayBoxes[GUILD_GAME_LIST],"");
    }
    DebugEnd();
}
예제 #11
0
파일: HASH32.C 프로젝트: 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() ;
}
예제 #12
0
파일: HASH32.C 프로젝트: LesInk/Test
T_hash32Item Hash32Find(T_hash32 hash, T_word32 key)
{
    T_hash32Struct *p_hash ;
    T_hash32ItemStruct *p_item = HASH32_ITEM_BAD ;
    T_doubleLinkListElement element ;
    T_doubleLinkList list ;
    T_hash32ItemStruct *p_itemSearch ;

    DebugRoutine("Hash32Find") ;

    /* 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)  {
            /* Find the list that the element is definitely in. */
            list = p_hash->p_index[key & p_hash->keyMask] ;

            /* Search the list for a matching key. */
            element = DoubleLinkListGetFirst(list) ;
            while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)  {
                /* Get the item in this list. */
                p_itemSearch = (T_hash32ItemStruct *)
                    DoubleLinkListElementGetData(element) ;

                /* See if the keys match */
                if (p_itemSearch->key == key)  {
                    /* Grab it and break out of this linear search. */
                    p_item = p_itemSearch ;
                    break ;
                }

                /* Find the next element. */
                element = DoubleLinkListElementGetNext(element) ;
            }
        }
    }

    DebugEnd() ;

    /* Return what we found. */
    return ((T_hash32Item)p_item) ;
}
예제 #13
0
/* returns a pointer to a map information structure for map mapIndex */
static T_mapDescriptionStruct* GuildUIGetMapDescription (T_word16 mapIndex)
{
    T_mapDescriptionStruct *mapInfo;
    T_doubleLinkListElement element;
    DebugRoutine ("GuildUIGetMapDescription");

    element=DoubleLinkListGetFirst (G_mapList);

    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        mapInfo=(T_mapDescriptionStruct *)DoubleLinkListElementGetData(element);
        if (mapInfo->mapIndex==mapIndex) break;
        else mapInfo=NULL;

        element=DoubleLinkListElementGetNext(element);
    }
    DebugCheck (mapInfo != NULL);

    DebugEnd();
    return (mapInfo);
}
예제 #14
0
/**
 *  MousePopEventHandler restores the last handler on the stack
 *  (if there is one).
 *
 *<!-----------------------------------------------------------------------*/
T_void MousePopEventHandler(T_void)
{
    T_doubleLinkListElement first ;
    T_mouseEventHandler handler ;

    DebugRoutine("MousePopEventHandler") ;

    /* Get the old event handler. */
    first = DoubleLinkListGetFirst(G_eventStack) ;
    DebugCheck(first != DOUBLE_LINK_LIST_ELEMENT_BAD) ;

    if (first != DOUBLE_LINK_LIST_ELEMENT_BAD)  {
        handler = (T_mouseEventHandler)
                      DoubleLinkListElementGetData(first) ;

        MouseSetEventHandler(handler) ;
        DoubleLinkListRemoveElement(first) ;
    }

    DebugEnd() ;
}
예제 #15
0
/* clears all player names from the player list box */
T_void GuildUIClearPlayers (T_void)
{
    T_doubleLinkListElement element,nextElement;
    T_byte8 *p_name;
    T_byte8 *test;
    DebugRoutine ("GuildUIClearPlayers");

    element=DoubleLinkListGetFirst(G_playerList);
    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        nextElement=DoubleLinkListElementGetNext(element);
        p_name=(T_byte8 *)DoubleLinkListElementGetData(element);
        MemFree(p_name);
        DoubleLinkListRemoveElement(element);
        element=nextElement;
    }

    test=TxtboxGetData(G_displayBoxes[GUILD_GAME_DESC]);
    if (test != NULL) TxtboxSetData(G_displayBoxes[GUILD_GAME_DESC],"");

    DebugEnd();
}
예제 #16
0
/* draws current player list (G_playerList) */
static T_void GuildUIDrawPlayerList (T_void)
{
    T_doubleLinkListElement element;
    T_byte8* listData=NULL;
    T_byte8* temp=NULL;
    T_byte8* name=NULL;
    T_word16 size=0;

    DebugRoutine ("GuildUIDrawPlayerList");
    element=DoubleLinkListGetFirst (G_playerList);

    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        /* get this element's data */
        name=(T_byte8*)DoubleLinkListElementGetData(element);
        /* find corresponding map information structure */
        /* add to list */
        if (listData != NULL) size=strlen(listData);
        else size=0;
        size+=strlen(name);
        temp=MemAlloc(size+2);
        if (listData != NULL) sprintf (temp,"%s%s\r",listData,name);
        else sprintf (temp,"%s\r",name);

        if (listData != NULL) MemFree(listData);

        listData=temp;
        temp=NULL;

        element=DoubleLinkListElementGetNext(element);
    }

    TxtboxSetData(G_displayBoxes[GUILD_GAME_DESC],listData);
    if (listData != NULL) MemFree(listData);

    DebugEnd();
}
예제 #17
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();
}
예제 #18
0
파일: FORM.C 프로젝트: 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();
}