所以我调试了我的应用程序,这是调试器告诉我的:
在线:
if(p_IS_TRUE(playerid,CHECK_INACTIVITY))
其定义为:
#define p_IS_TRUE(playerid,check) (p_CheckForStuff[playerid] & check)
所以这是重要的代码:
//global
#define CHECK_SPAWNKILL (128) // 0000 0000 0000 0000 0000 0000 1000 0000
#define CHECK_INACTIVITY (256) // 0000 0000 0000 0000 0000 0001 0000 0000
#define CHECK_TELEPORT (512) // 0000 0000 0000 0000 0000 0010 0000 0000
#define CHECK_AIRBREAK (1024) // 0000 0000 0000 0000 0000 0100 0000 0000
unsigned long p_CheckForStuff[MAX_PLAYERS];
#define p_IS_TRUE(playerid,check) (p_CheckForStuff[playerid] & check)
list<int> PlayerLoopList;
//When a player connects
PlayerLoopList.push_back(playerid);
p_CheckForStuff[playerid] =-1;//enable all checks
//When a player disconnects
PlayerLoopList.remove(playerid);
//ProcessTick
int playerid = 0;
int ProcessTicksize = 0;
int ProcessTickindex = 0;
for (list <int>::iterator i = PlayerLoopList.begin(); i != PlayerLoopList.end(); ++i)
{
playerid = *i;
int playerstate = GetPlayerState(playerid);
int vid = GetPlayerVehicleID(playerid);
if(g_IS_TRUE(CHECK_INACTIVITY))
{
if(p_IS_TRUE(playerid,CHECK_INACTIVITY))
{
if(p_AcivityInfo[playerid].Reported == false)
{
它可以复制如下:
1)加入服务器 2)退出/被踢?3) 再次加入 4) 崩溃
有谁知道为什么会这样?代码对我来说看起来很完美..