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; }
void CollisionList::clearCollisionList() { ListIterator<collision> cleaner = *ListIterator<collision>(collList).SetFirst(); while(!cleaner.IsEmpty()) { delete cleaner.GetCurrent()->collisionSpot; cleaner.Remove(); } }
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; }
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; }