void FileReaderThread::RemoveReader (const FileThreadVariables* inItem) { if (mNumReaders > 0) { CAGuard::Locker fileReadLock (mGuard); for (FileData::iterator iter = mFileData.begin(); iter != mFileData.end(); ++iter) { if ((*iter) == inItem) { mFileData.erase (iter); } } if (--mNumReaders == 0) { mThreadShouldDie = true; mGuard.Notify(); } } }
VisualAppearance::VisualAppearance( std::string visualAppearanceId, std::string animationsDescriptionFile ) { this->visualAppearanceId_ = visualAppearanceId; FileData* dataFromFile = b2WorldAndVisualWorld.globalGameObjectManager_->parseFileData( &animationsDescriptionFile, 5 ); FileData::iterator itData; for( itData = dataFromFile->begin(); itData < dataFromFile->end(); itData++ ) { FileEntry::iterator itEntry; FileEntry tmp = (*itData); itEntry = tmp.begin(); std::string animationId = (*itEntry); itEntry++; std::string animationFileName = (*itEntry); itEntry++; sf::Vector2i rowsAndCollumns; rowsAndCollumns.x = atoi((*itEntry).c_str()); itEntry++; rowsAndCollumns.y = atoi((*itEntry).c_str()); itEntry++; int delayPerFrame = atoi((*itEntry).c_str()); Animation* temporaryAnimation = new Animation( animationId, animationFileName, rowsAndCollumns, delayPerFrame ); if( temporaryAnimation != NULL ) { this->possibleAnimations_.push_back( temporaryAnimation ); } } if(possibleAnimations_.empty()) { exit(1); } }