我有一个问题,我做了基本的结构
struct TRADEBOT_ITEM
{
BYTE Slot;
BYTE Cat;
BYTE Id;
BYTE LVL;
};
struct TRADEBOT_BUFFS
{
short BUFFID;
short Duration;
};
struct TRADEBOT_INVENTORY
{
short itemId;
BYTE level;
BYTE opt;
BYTE opt2;
BYTE opt3;
BYTE NewOption;
BYTE Socket[5];
int Expiration;
};
struct TRADEBOT_REQ
{
short itemId;
BYTE level;
BYTE opt;
BYTE opt2;
BYTE opt3;
BYTE NewOption;
BYTE Socket[5];
};
struct TRADEBOT_MIX
{
TRADEBOT_INVENTORY m_Inventory[64];
TRADEBOT_REQ m_Req[64];
int ReqCnt;
};
struct TRADEBOT_DATA
{
BYTE ID;
BYTE Class;
BYTE SPAWN;
BYTE map;
BYTE X;
BYTE Y;
BYTE Dir;
BYTE Vip;
WORD Strength;
WORD Dexterity;
WORD Vitality;
WORD Energy;
WORD Leadership;
int ZEN;
char Name[10];
TRADEBOT_ITEM m_Item[9];
TRADEBOT_BUFFS m_Buffs[5];
TRADEBOT_MIX m_Mix[142];
};
后来用作
std::map<int, TRADEBOT_DATA> m_BotData;
然后我尝试从文件中读取信息并将来自 fil 的信息保存在结构中
this->m_BotData[ID].m_Mix[ID].m_Req[cntr].itemId = ITEMGET(cat,idx);
Token = GetToken();
this->m_BotData[ID].m_Mix[ID].m_Req[cntr].level = TokenNumber;
Token = GetToken();
this->m_BotData[ID].m_Mix[ID].m_Req[cntr].opt = TokenNumber;
Token = GetToken();
this->m_BotData[ID].m_Mix[ID].m_Req[cntr].opt2 = TokenNumber;
Token = GetToken();
this->m_BotData[ID].m_Mix[ID].m_Req[cntr].opt3 = TokenNumber;
Token = GetToken();
this->m_BotData[ID].m_Mix[ID].m_Req[cntr].NewOption = TokenNumber;
Token = GetToken();
this->m_BotData[ID].m_Mix[ID].m_Req[cntr].Socket[0] = TokenNumber;
Token = GetToken();
this->m_BotData[ID].m_Mix[ID].m_Req[cntr].Socket[1] = TokenNumber;
Token = GetToken();
this->m_BotData[ID].m_Mix[ID].m_Req[cntr].Socket[2] = TokenNumber;
Token = GetToken();
this->m_BotData[ID].m_Mix[ID].m_Req[cntr].Socket[3] = TokenNumber;
Token = GetToken();
this->m_BotData[ID].m_Mix[ID].m_Req[cntr].Socket[4] = TokenNumber;
this->m_BotData[ID].m_Mix[ID].ReqCnt++;
cntr++;
并且结构保持空白,没有信息写入它。我不知道为什么。
另外,如果我将值更改TRADEBOT_MIX m_Mix[142];
为TRADEBOT_MIX m_Mix[143];
应用程序崩溃,也不知道为什么。任何想法,将不胜感激。
我正在使用 Visual Studio 2010