www.pudn.com > gamedata.rar > door.c


#include "stdafx.h" 
 
extern struct OBJECT_INFO object_info[MAX_NUM_OBJ]; 
extern struct optiondata option; 
 
// 是否含有传送门 
BOOL getdoorstatus(int n) 
{ 
	int i;  
	for(i=10;i<34;i++) 
	{ 
		if ((object_info[n].Novelity[i][2] == 0x78) && 
			(object_info[n].Novelity[i][3] == 0x02)) 
		{ 
			return TRUE; 
		} 
	} 
	return FALSE; 
} 
 
 
int conveydoor(SOCKET s) 
{ 
	int n, i; 
 
	struct DOOR_INFO door_info[30]; 
 
//	char *buf; 
 
	n = find_obj(s); 
 
	if (n == MAX_NUM_USER) return -1; 
 
//	if (object_info[n].died) return -1; 
 
	// 如果传送门存在的话 
	if (getdoorstatus(n)) 
	{ 
		for(i=0;i<30;i++) 
			door_info[i] = object_info[n].door_info[i]; 
 
		senddoorinfo(s, door_info); 
	} 
 
	return 0; 
} 
 
int senddoorinfo(SOCKET s, struct DOOR_INFO door_info[30]) 
{ 
	BYTE lpSource[4096]; 
 
	int i, j, a, m, len, len_site, ret; 
 
	m = 0; 
 
	len = 0; 
 
	for(i=0;i<30;i++) 
	{ 
		if ((door_info[i].have) && (strcmp(door_info[i].name, "") != 0) && (strcmp(door_info[i].name, "\\") != 0)) 
		{ 
			len = len + strlen(door_info[i].name) + 6; 
			m++; 
		} 
	} 
 
	memset(lpSource, 0x00, sizeof(lpSource)); 
 
	lpSource[0] = 0x00; 
	lpSource[1] = 0x00; 
	lpSource[2] = 0x00; 
	lpSource[3] = 0x00; 
	lpSource[4] = 0x9C; 
	lpSource[5] = (BYTE)m; 
 
	a = 0; 
 
	for(i=0;i<30;i++) 
	{ 
		if (door_info[i].have) 
		{ 
			len_site = strlen(door_info[i].name); 
			a ++; 
			lpSource[5 + a] = i; 
			a ++; 
			lpSource[5 + a] = len_site; 
			for(j=0;j=21) return -1; 
 
		if (strcmp(name, "\\") == 0) { sysmessage(s, 0x01, "含有非法字符", 0, FALSE); return -1; } 
 
		addconveydoor(s, name); 
	} 
	// 00 01 02 03 04 05 06 07 08 09  
	// 66 00 00 00 9D 02 08 0A 32 32 32 32 32 32 32 32 32 32 
	if (lpTarget[5] == 0x02) 
	{ 
		memset(name, 0x00, sizeof(name)); 
 
		for (i=0; i<(int)lpTarget[7]; i++) 
		{ 
			sprintf(tmp, "%c", (char)lpTarget[8 + i]);	 
			strcat(name, tmp); 
		} 
 
		if ((int)lpTarget[6]>=21) return -1; 
 
		if (strcmp(name, "\\") == 0) { sysmessage(s, 0x01, "含有非法字符", 0, FALSE); return -1; } 
 
		subconveydoor(s, name); 
	} 
 
	return 0; 
}