Hi guys, I got problems with CUtlVector and it not storing information.

I have a script parsing class that parses a map file:
//--------------------------------------------------------------------------
// CGESPMapListDataParser - Handles parsing all the map data
//--------------------------------------------------------------------------
class CGESPMapListDataParser : public CScriptParser
{
public:
        DECLARE_CLASS_GAMEROOT( CGESPSaveList, CScriptParser );

        void Parse( KeyValues *pKeyValuesData, bool bWildcard, const char
*szFileWithoutEXT )
        {
                for (int x=0; x<128; x++)
                {
                        char szKeyName[128];
                        Q_snprintf(szKeyName,128,"mission_%d", x+1);

                        KeyValues *SubKey =
pKeyValuesData->FindKey(szKeyName);
                        if (SubKey)
                        {
                                int index = MapList->m_pInfo.AddToTail(new
mapdata);
                                MapList->m_pInfo[index]->m_iID = x;

                                Q_strncpy( MapList->m_pInfo[index]->m_szName
, SubKey->GetString("name", "\0" ), 128);
                                for (int y=0; y<16; y++)
                                {
                                        char szElName[128];
                                        Q_snprintf(szElName,128,"map_%d",
y+1);

                                        char temp[128];
                                        Q_strncpy( temp ,
SubKey->GetString(szElName, "\0" ), 128);

                                        if (strcmp(temp,"\0")!=0)

Q_strncpy(MapList->m_pInfo[index]->m_szList[y], temp, 128);
                                        else
                                                break;
                                }
                        }
                        else
                        {
                                break;
                        }
                }
        };
} CGESPMapListDataParser;


Now if I print out the CUtlVector in this function (MapList->m_pInfo) its
full of the data it should be. But if I print it out else where (i.e. in the
data storage class) there is no data at all.

This has happened to me before and I moved the code around and it worked. Am
I missing something?


Mark [lodle]

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to