char* szName[] ={"诈了没","斗你妹","全下了没","VIP有特权哟","奖励领了没","大乐透中奖了","邀个好友","换牌了没","玩下竞技场","加点魅力","扔个牛屎","踢个贱人"};
int nSelName[] = {-1,-1,-1,-1};
for (int i =1; i<=4; i++)
{
if (arc4random()%6<=3)
{//随机人数及名称 尽量不重复
int nName=arc4random()%16;
for (int j =0; j<i; j++)
{
if (nName == nSelName[j])
{
nName=arc4random()%16;
break;
}
}
nSelName [i] = nName;
AndroidUser* pItem =new AndroidUser(i,DANJI_DEF_USERID+i,szName[nName]);
androidAry->addObject((CCObject*)pItem);
// pItem->IsLogEanble(true);
pItem->UserCome();
pItem->release();
}
}
打印日志:
(char *[16]) szName = {
[0] = 0x00000000
[1] = 0x00930042 "\xd5\xa9\xc1\xcb\xc3\xbb"
[2] = 0x00930049 "\xb0\xd9\xc8\xcb\xc5\xa3\xc5\xa3"
[3] = 0x00930052 "\xd5\xa8\xbd\xf0\xbb\xa8"
[4] = 0x00930059 "\xb6\xb7\xc4\xe3\xc3\xc3"
[5] = 0x00930060 "\xb0\xd9\xc1\xe9\xb0\xd9\xc1\xe9"
[6] = 0x00930069 "\xc8\xab\xcf\xc2\xc1\xcb\xc3\xbb"
[7] = 0x00930072 "VIP\xd3\xd0\xcc\xd8\xc8\xa8\xd3\xb4"
[8] = 0x0093007e "\xbd\xb1\xc0\xf8\xc1\xec\xc1\xcb\xc3\xbb"
[9] = 0x00930089 "\xb4\xf3\xc0\xd6\xcd\xb8\xd6\xd0\xbd\xb1\xc1\xcb"
[10] = 0x00930096 "\xd1\xfb\xb8\xf6\xba\xc3\xd3\xd1"
[11] = 0x0093009f "\xbb\xbb\xc5\xc6\xc1\xcb\xc3\xbb"
[12] = 0x009300a8 "\xcd\xe6\xcf\xc2\xbe\xba\xbc\xbc\xb3\xa1"
[13] = 0x009300b3 "\xbc\xd3\xb5\xe3\xf7\xc8\xc1\xa6"
[14] = 0x009300bc "\xc8\xd3\xb8\xf6\xc5\xa3\xca\xba"
[15] = 0x009300c5 "\xcc\xdf\xb8\xf6\xbc\xfa\xc8\xcb"
}
第一个竟然变成NULL了,不知道为什么变成NULL,难道是越界修改待查。