Void GameplayManager::_LoadGameDatabase( const GChar * strPath ) { // List everything in current path Bool bIsDirectory = false; GChar strFileName[FILENAME_LENGTH + 1]; Bool bContinue = SystemFn->ListDirectoryFirst( strPath, &bIsDirectory, strFileName, FILENAME_LENGTH ); while( bContinue ) { // Build sub path GChar strSubPath[PATHNAME_LENGTH + 1]; StringFn->Format( strSubPath, TEXT("%s/%s"), strPath, strFileName ); // Sub-directory case if ( bIsDirectory ) { // Recurse _LoadGameDatabase( strSubPath ); // Next file bContinue = SystemFn->ListDirectoryNext( &bIsDirectory, strFileName, FILENAME_LENGTH ); continue; } // File case, load XML XMLDocument * pMonsterFile = XMLDocument::CreateDocument( strSubPath ); Assert( pMonsterFile != NULL ); Assert( StringFn->Cmp(pMonsterFile->GetTagName(), TEXT("MonsterFile")) == 0 ); // Load skills const XMLNode * pSkillListNode = pMonsterFile->GetChildByTag( TEXT("SkillList"), 0 ); Assert( pSkillListNode != NULL ); UInt iCount = pSkillListNode->GetChildCount(); for ( UInt i = 0; i < iCount; ++i ) { const XMLNode * pSkillNode = pSkillListNode->GetChildByTag( TEXT("Skill"), i ); Assert( pSkillNode != NULL ); Skill * pSkill = Skill::StaticLoad( pSkillNode ); Bool bInserted = m_mapSkills.Insert( pSkill->GetID(), pSkill ); Assert( bInserted ); } // Load monsters const XMLNode * pMonsterListNode = pMonsterFile->GetChildByTag( TEXT("MonsterList"), 0 ); Assert( pMonsterListNode != NULL ); iCount = pMonsterListNode->GetChildCount(); for( UInt i = 0; i < iCount; ++i ) { XMLNode * pMonsterNode = pMonsterListNode->GetChildByTag( TEXT("Monster"), i ); Assert( pMonsterNode != NULL ); Monster hMonster; hMonster.Load( pMonsterNode ); Bool bInserted = m_mapMonsters.Insert( hMonster.GetID(), hMonster ); Assert( bInserted ); } // Done with this one XMLDocument::DestroyDocument( pMonsterFile ); pMonsterFile = NULL; // Next file bContinue = SystemFn->ListDirectoryNext( &bIsDirectory, strFileName, FILENAME_LENGTH ); } }