CAI_Squad *CAI_SquadManager::FindSquad( string_t squadName ) { CAI_Squad* pSquad = m_pSquads; while (pSquad) { if (FStrEq(STRING(squadName),pSquad->GetName())) { return pSquad; } pSquad = pSquad->m_pNextSquad; } return NULL; }
void Save( ISave *pSave ) { pSave->StartBlock( "Squads" ); short nSquads = (short)g_AI_SquadManager.NumSquads(); pSave->WriteShort( &nSquads ); AISquadsIter_t iter; string_t squadName; CAI_Squad* pSquad = g_AI_SquadManager.GetFirstSquad( &iter ); while (pSquad) { squadName = MAKE_STRING( pSquad->GetName() ); pSave->WriteString( "", &squadName ); // Strings require a header to be read properly pSave->WriteAll( pSquad ); pSquad = g_AI_SquadManager.GetNextSquad( &iter ); } pSave->EndBlock(); //--------------------------------- pSave->StartBlock( "Enemies" ); short nMemories = 0; CAI_BaseNPC **ppAIs = g_AI_Manager.AccessAIs(); int i; for ( i = 0; i < g_AI_Manager.NumAIs(); i++ ) { if ( ppAIs[i]->GetEnemies() ) nMemories++; } pSave->WriteShort( &nMemories ); for ( i = 0; i < g_AI_Manager.NumAIs(); i++ ) { if ( ppAIs[i]->GetEnemies() ) { CBaseEntity *p = ppAIs[i]; pSave->WriteEntityPtr( &p ); pSave->WriteAll( ppAIs[i]->GetEnemies() ); } } pSave->EndBlock(); }