From: BJ H. <par...@us...> - 2004-06-10 14:11:00
|
Log Message: ----------- screw you whoever added that if..else in get_Server!!! Modified Files: -------------- /cvsroot/decaldev/source/DecalFilters: CharacterStats.cpp Revision Data ------------- Index: CharacterStats.cpp =================================================================== RCS file: /cvsroot/decaldev/source/DecalFilters/CharacterStats.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- CharacterStats.cpp 14 Apr 2004 15:30:41 -0000 1.50 +++ CharacterStats.cpp 10 Jun 2004 14:10:51 -0000 1.51 @@ -751,7 +751,8 @@ pMessage->get_Member (_variant_t ("records"), &vRecords); _ASSERTE (vRecords.vt == VT_DISPATCH); - std::map< DWORD, cAllegianceInfo * > AllegMap; + //std::map< DWORD, cAllegianceInfo * > AllegMap; + std::vector<cAllegianceInfo *> AllegInfo; for(int i = 0; i < (vRecordCount.bVal); i++) { @@ -792,23 +793,45 @@ tpai->Leadership = vLeader.iVal; tpai->Unknown = vUnknown.dblVal; strncpy( tpai->Name, OLE2A( vName.bstrVal ), sizeof( tpai->Name ) ); - - AllegMap.insert( std::make_pair( vGUID.lVal, tpai ) ); + + //AllegMap.insert( std::make_pair( vGUID.lVal, tpai ) ); + AllegInfo.push_back(tpai); } - std::map< DWORD, cAllegianceInfo * >::iterator i = AllegMap.find( GUID ); + //std::map< DWORD, cAllegianceInfo * >::iterator i = AllegMap.find( GUID ); // Solo player, get outta here - if( i == AllegMap.end() ) + //if( i == AllegMap.end() ) + if ( AllegInfo.size() == 0 ) break; - //the player - cAllegianceInfo *p = i->second; - memcpy( &MyAlleg, p, sizeof( cAllegianceInfo ) ); - delete p; - AllegMap.erase( GUID ); + //we now 'know' that the monarch is the first entry, always + //std::map< DWORD, cAllegianceInfo * >::iterator i2 = AllegMap.begin(); + std::vector<cAllegianceInfo *>::iterator j = AllegInfo.begin(); + if ( (*j)->GUID != GUID ) //i'm not the monarch, so find out who is + { + if ( (*(j + 1))->GUID != GUID ) //i'm not a direct either + { + memcpy(&Monarch, *j, sizeof(cAllegianceInfo)); + //OutputDebugString(Monarch.Name); + delete *j; + j = AllegInfo.erase( j ); // this is my patron now + } + memcpy( &Patron, *j, sizeof( cAllegianceInfo ) ); + //OutputDebugString(Patron.Name); + delete *j; + j = AllegInfo.erase( j ); + } + // we've taken care of any possible patron & monarch, + // so i'm all that's left + memcpy(&MyAlleg, *j, sizeof(cAllegianceInfo)); + //OutputDebugString(MyAlleg.Name); + delete *j; + j = AllegInfo.erase( j ); + //check for patron + /* i = AllegMap.find( MyAlleg.TreeParent ); if ( i != AllegMap.end() ) { @@ -828,17 +851,19 @@ AllegMap.erase( i ); } } + */ //The remainder *should* all be vassals - //while( AllegMap.size() > 0 ) - //{ - for( i = AllegMap.begin(); i != AllegMap.end(); ++i ) - { + while( AllegInfo.size() > 0 ) + { + //for( i = AllegInfo.begin(); i != AllegInfo.end(); ++i ) + //{ // Patron /* if( i->second->GUID == MyAlleg.TreeParent ) { memcpy( &Patron, i->second, sizeof( cAllegianceInfo ) ); + OutputDebugString("Got Patron\n"); delete i->second; i = AllegMap.erase( i ); @@ -849,18 +874,19 @@ //Vassal //just leaving the sanity check in place here - if (i->second->TreeParent == GUID) - { - memcpy( &Vassals[VassalCount], i->second, sizeof( cAllegianceInfo ) ); + //if ((*i)->TreeParent == GUID) + //{ + memcpy( &Vassals[VassalCount], *j, sizeof( cAllegianceInfo ) ); + //OutputDebugString(Vassals[VassalCount].Name); VassalCount++; - delete i->second; - i = AllegMap.erase( i ); + delete *j; + j = AllegInfo.erase( j ); - continue; - } - } - //} + //continue; + //} + //} + } // only remnant should be monarch //p = AllegMap.begin()->second; @@ -1295,6 +1321,7 @@ if( !(*Server) ) return E_FAIL; + //DIE!! if( strncmp( Server, "DARKTIDE", 8 ) == 0 ) *pVal = T2BSTR( Server ); else if( stricmp( Server, "FROSTFELL" ) == 0 ) @@ -1311,6 +1338,8 @@ *pVal = T2BSTR( Server ); else if( stricmp( Server, "WINTERSEBB" ) == 0 ) *pVal = T2BSTR( Server ); + else if( stricmp( Server, "VERDANTINE" ) == 0 ) + *pVal = T2BSTR( Server ); else *pVal = T2BSTR("Unknown"); |