Example #1
0
bool Level::refreshBackgroundMusic(vector playerPos)
{
    if(bgmusicActivated)
    {
        if(actualBackgroundMusic != NULL && vectorInCube(playerPos, actualBackgroundMusic->location))
            return false;

        if(backgroundMusics->IsEmpty())
            return false;

        ListIterator<locationMusic> i = ListIterator<locationMusic>(backgroundMusics);
        i.SetFirst();

        do
        {
            if(vectorInCube(playerPos, i.GetCurrent()->location))
            {
                actualBackgroundMusic = i.GetCurrent();
                bgmusic->selectMusic(actualBackgroundMusic->musicname, -1);
                bgmusic->toggle();
                return true;
            }

            i.Next();
        }while(!i.IsLast());

        if(actualBackgroundMusic != NULL)
                bgmusic->toggle();

        actualBackgroundMusic = NULL;
    }

    return false;
}
Example #2
0
ObjectType *ObjectTypeCache::searchObjectType(const char *objtypename)
{
    ObjectType *result = NULL;

    ListIterator<ObjectType> i = ListIterator<ObjectType>(cachedObjectTypes);
    i.SetFirst();

    while(!(i.IsLast()))
    {
        result = i.GetCurrent();

        if(!strncmp(result->objectTypeName, objtypename, MAX_STRING_LENGTH))
            break;
        else
            result = NULL;

        i.Next();
    }

    return result;
}
Example #3
0
bool ObjectTypeCache::unloadObjectType(const char *objtypename)
{
    ObjectType *objTypeToDelete = NULL;

    ListIterator<ObjectType> i = ListIterator<ObjectType>(cachedObjectTypes);
    i.SetFirst();

    while(!(i.IsLast()))
    {
        objTypeToDelete = i.GetCurrent();

        if(!strncmp(objTypeToDelete->objectTypeName, objtypename, MAX_STRING_LENGTH))
        {
            i.Remove();
            return true;
        }

        i.Next();
    }

    return false;
}