此文件代码如下:将如何做修改,请各位大侠指出,谢谢
#include "stdafx.h"
extern struct OBJECT_INFO object_info[MAX_NUM_OBJ]; // 全局控制,所有用户信息
extern struct LUMP_INFO Lump_info[MAX_NUM_USER];
extern struct TEAM_INFO Team_info[MAX_NUM_USER];
// 判断这个这个帐号的玩家是否在线
BOOL checklogin(char *id, char *char_name)
{
int i;
for(i=0; i<MAX_NUM_USER;i++)
{
if ((strcmp(object_info[i].id, id) == 0) &&
(object_info[i].status))
{
return FALSE;
}
}
return TRUE;
}
// 查找服务器现在的军团
int find_lump(char *name)
{
int i;
for(i=0;i<MAX_NUM_USER;i++)
{
if (strcmp(Lump_info[i].name, name) == 0) return i;
}
return MAX_NUM_USER;
}
struct DOUBLE_NUMBER find_lump_member(char *name, char *member)
{
int i, j;
struct DOUBLE_NUMBER number;
for(i=0;i<MAX_NUM_USER;i++)
{
if (strcmp(Lump_info[i].name, name) == 0)
{
for(j=0;j<MAX_NUM_LUMP_MEMBER;j++)
{
if (strcmp(Lump_info[i].member[j], member) == 0)
{
number.n1 = i;
number.n2 = j;
return number;
}
}
}
}
number.n1 = MAX_NUM_USER;
number.n2 = MAX_NUM_LUMP_MEMBER;
return number;
}
// 添加新军团
BOOL add_obj_lump(struct LUMP_INFO info)
{
int i;
for(i=0;i<MAX_NUM_USER;i++)
{
if (strcmp(Lump_info[i].name, "\\") == 0)
{
Lump_info[i] = info; return TRUE;
}
}
return FALSE;
}
// 删除军团
BOOL sub_obj_lump(char *head, char *name)
{
int i, j;
for(i=0;i<MAX_NUM_USER;i++)
{
if (strcmp(object_info[i].team, name) == 0) return FALSE;
}
for(i=0;i<MAX_NUM_USER;i++)
{
if (strcmp(Lump_info[i].name, name) == 0)
{
strcpy(Lump_info[i].name, "\\");
strcpy(Lump_info[i].head1, "\\");
strcpy(Lump_info[i].head2, "\\");
Lump_info[i].number = 0;
Lump_info[i].lump_ID = 0xFFFF;
for(j=0;j<MAX_NUM_LUMP_MEMBER;j++)
{
strcpy(Lump_info[i].member[j], "\\");
}
return TRUE;
}
}
return FALSE;
}
// 加入一个新的成员
BOOL add_obj_lump_member(char *head1, char *head2, char *name, char *member)
{
int i, j;
for(i=0;i<MAX_NUM_USER;i++)
{
if (strcmp(Lump_info[i].name, name) == 0)
{
for(j=0;j<MAX_NUM_USER;j++)
{
if ((strcmp(Lump_info[i].member[j], "\\") == 0) &&
((strcmp(Lump_info[i].head1, head1) == 0) || (strcmp(Lump_info[i].head2, head2) == 0)))
{
strcpy(Lump_info[i].member[j], member); return TRUE;
}
}
}
}
return FALSE;
}
// 一个成员退出
BOOL sub_obj_lump_member(char *head, char *name, char *member)
{
int i, j;
for(i=0;i<MAX_NUM_USER;i++)
{
if (strcmp(Lump_info[i].name, name) == 0)
{
for(j=0;j<MAX_NUM_USER;j++)
{
if ((strcmp(Lump_info[i].member[j], member) == 0) &&
(strcmp(Lump_info[i].head1, head) == 0))
{
strcpy(Lump_info[i].member[j], "\\"); return TRUE;
}
}
}
}
return FALSE;
}
struct OBJECT_INFO add_obj(SOCKET s, HANDLE handle, struct OBJECT_INFO info)
{
int i, j, z;
unsigned long count;
struct OBJECT_INFO tempinfo;
struct DOOR_INFO door_info[30];
for(i=0;i<MAX_NUM_USER;i++)
{
if(!object_info[i].status)
{
// memcpy(&object_info[i], &info, sizeof(OBJECT_INFO));
if (info.level > MAX_LEVEL) info.level = MAX_LEVEL;
if (info.level <= 0) info.level = 1;
object_info[i] = info;
object_info[i].ServerID = i;
object_info[i].s = s;
object_info[i].handle = handle;
strcpy(object_info[i].chainbuf, "");
object_info[i].chainlen = 0;
count = GetTickCount();
object_info[i].time1 = count;
object_info[i].time2 = count;
object_info[i].time3 = 0;
object_info[i].time4 = count;
object_info[i].time5 = count;
object_info[i].time6 = count;
object_info[i].time7 = count;
object_info[i].time8 = count;
object_info[i].time9 = count;
object_info[i].life_time = count;
object_info[i].mental_time = count;
object_info[i].brawn_time = count;
object_info[i].speed_number = count;
object_info[i].net_time = count;
object_info[i].attack_other = 0;
if (object_info[i].job == 0)
{
object_info[i].life_recovery = 30;
object_info[i].brawn_recovery = 30;
object_info[i].mental_recovery = 30;
}
else if (object_info[i].job == 1)
{
object_info[i].life_recovery = 30;
object_info[i].brawn_recovery = 30;
object_info[i].mental_recovery = 30;
}
else if (object_info[i].job == 2)
{
object_info[i].life_recovery = 30;
object_info[i].brawn_recovery = 30;
object_info[i].mental_recovery = 30;
}
else if (object_info[i].job == 3)
{
object_info[i].life_recovery = 30;
object_info[i].brawn_recovery = 30;
object_info[i].mental_recovery = 30;
}
if(loaddoor(object_info[i].name, door_info))
{
for(j=0;j<30;j++)
{
object_info[i].door_info[j] = door_info[j];
}
}
else
{
for(j=0;j<30;j++)
{
object_info[i].door_info[j].Code1 = 0x00;
object_info[i].door_info[j].Code2 = 0x00;
object_info[i].door_info[j].x = 0;
object_info[i].door_info[j].y = 0;
object_info[i].door_info[j].have = FALSE;
strcpy(object_info[i].door_info[j].name, "\\");
}
}
for(j=0;j<7;j++)
{
for(z=0;z<8;z++)
{
object_info[i].shop[j][z] = 0x00;
}
}
Sleep(500);
object_info[i].privatewarehousemoney = loadprivatewarehouse(object_info[i].name, object_info[i].privatewarehouse);
if(object_info[i].privatewarehousemoney < 0)
{
for(j=0;j<48;j++)
{
for(z=0;z<17;z++)
{
if (z==2 || z==3)
object_info[i].privatewarehouse[j].code[z] = 0xFF;
else
object_info[i].privatewarehouse[j].code[z] = 0x00;
}
}
object_info[i].privatewarehousemoney = 0;
}
Sleep(500);
object_info[i].publicwarehousemoney = loadpublicwarehouse(object_info[i].id, object_info[i].publicwarehouse);
if (object_info[i].publicwarehousemoney < 0)
{
for(j=0;j<50;j++)
{
for(z=0;z<17;z++)
{
if (z==2 || z==3)
object_info[i].publicwarehouse[j].code[z] = 0xFF;
else
object_info[i].publicwarehouse[j].code[z] = 0x00;
}
}
object_info[i].publicwarehousemoney = 0;
}
// sprintf(tmp, "%d", object_info[i].publicwarehousemoney);
// MessageBox(NULL, tmp, "",0);
// for (j=0;j<11;j++)
// object_info[i].spell_[i] = 0xFF;
object_info[i].teamid = 0xFFFF;
object_info[i].lumpid = 0xFFFF;
strcpy(object_info[i].shop_name, "\\");
object_info[i].died = FALSE;
object_info[i].status = TRUE;
return object_info[i];
}
}
tempinfo.status = FALSE;
return tempinfo;
}
void del_obj(SOCKET s)
{
int i;
for(i=0;i<MAX_NUM_USER;i++)
{
if((object_info[i].status) &&
(object_info[i].s == s))
{
object_info[i].status = FALSE;
object_info[i].s = -1;
return;
}
}
}
int find_obj(SOCKET s)
{
int i;
for(i=0;i<MAX_NUM_USER;i++)
{
if((object_info[i].status) &&
(object_info[i].s == s))
{
return i;
}
}
return MAX_NUM_USER;
}
int find_char(char *name)
{
int i;
for(i=0;i<MAX_NUM_USER;i++)
{
if((strcmp(object_info[i].name, name) == 0) &&
(object_info[i].status))
{
return i;
}
}
return MAX_NUM_USER;
}
int find_id(int id)
{
int i;
for(i=0;i<MAX_NUM_USER;i++)
{
if((object_info[i].ServerID == id) &&
(object_info[i].status))
{
return i;
}
}
return MAX_NUM_USER;
}
// 证明这个ID 合法性
BOOL check_obj(int id)
{
if (object_info[id].status)
{
return TRUE;
}
return FALSE;
}
int add_team_obj(int n1, int n2)
{
int i, j;
for (i=0;i<MAX_NUM_USER;i++)
{
for;
}
}