当前位置: 首页>>代码示例>>C++>>正文


C++ WFIFOHEAD函数代码示例

本文整理汇总了C++中WFIFOHEAD函数的典型用法代码示例。如果您正苦于以下问题:C++ WFIFOHEAD函数的具体用法?C++ WFIFOHEAD怎么用?C++ WFIFOHEAD使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了WFIFOHEAD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: chrif_searchcharid

/*==========================================
 * Search Char trough id on char serv
 *------------------------------------------*/
int chrif_searchcharid(int char_id) {
	
	if( !char_id )
		return -1;
	
	chrif_check(-1);

	WFIFOHEAD(char_fd,6);
	WFIFOW(char_fd,0) = 0x2b08;
	WFIFOL(char_fd,2) = char_id;
	WFIFOSET(char_fd,6);

	return 0;
}
开发者ID:Judasu,项目名称:rAthena-1,代码行数:17,代码来源:chrif.c

示例2: mapif_send_quests

void mapif_send_quests(int fd, int char_id, struct quest *tmp_questlog, int num_quests)
{
	WFIFOHEAD(fd,num_quests*sizeof(struct quest)+8);
	WFIFOW(fd,0) = 0x3860;
	WFIFOW(fd,2) = num_quests*sizeof(struct quest)+8;
	WFIFOL(fd,4) = char_id;

	if (num_quests > 0) {
		nullpo_retv(tmp_questlog);
		memcpy(WFIFOP(fd,8), tmp_questlog, sizeof(struct quest)*num_quests);
	}

	WFIFOSET(fd,num_quests*sizeof(struct quest)+8);
}
开发者ID:Asheraf,项目名称:Renewal,代码行数:14,代码来源:int_quest.c

示例3: mapif_Mail_sendinbox

/*==========================================
 * Client Inbox Request
 *------------------------------------------*/
static void mapif_Mail_sendinbox(int fd, int char_id, unsigned char flag)
{
	struct mail_data md;
	mail_fromsql(char_id, &md);

	//FIXME: dumping the whole structure like this is unsafe [ultramage]
	WFIFOHEAD(fd, sizeof(md) + 9);
	WFIFOW(fd,0) = 0x3848;
	WFIFOW(fd,2) = sizeof(md) + 9;
	WFIFOL(fd,4) = char_id;
	WFIFOB(fd,8) = flag;
	memcpy(WFIFOP(fd,9),&md,sizeof(md));
	WFIFOSET(fd,WFIFOW(fd,2));
}
开发者ID:dbrocom,项目名称:syncragnarok,代码行数:17,代码来源:int_mail.c

示例4: chmapif_send

/**
 * Packet send to all char-servers, except one. (wos: without our self)
 * @param fd: fd to send packet too
 * @param buf: packet to send in form of an array buffer
 * @param len: size of packet
 * @return : the number of map-serv the packet was sent to (O|1)
 */
int chmapif_send(int fd, unsigned char *buf, unsigned int len){
	if (fd >= 0) {
		int i;
		ARR_FIND( 0, ARRAYLENGTH(map_server), i, fd == map_server[i].fd );
		if( i < ARRAYLENGTH(map_server) )
		{
			WFIFOHEAD(fd,len);
			memcpy(WFIFOP(fd,0), buf, len);
			WFIFOSET(fd,len);
			return 1;
		}
	}
	return 0;
}
开发者ID:BatangKuneho,项目名称:rathena,代码行数:21,代码来源:char_mapif.c

示例5: chrif_sendmap

// sends maps to char-server
int chrif_sendmap(int fd)
{
	int i;
	ShowStatus("Sending maps to char server...\n");
	// Sending normal maps, not instances
	WFIFOHEAD(fd, 4 + instance_start * 4);
	WFIFOW(fd,0) = 0x2afa;
	for(i = 0; i < instance_start; i++)
		WFIFOW(fd,4+i*4) = map[i].index;
	WFIFOW(fd,2) = 4 + i * 4;
	WFIFOSET(fd,WFIFOW(fd,2));

	return 0;
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:15,代码来源:chrif.c

示例6: chrif_connect

// connects to char-server (plaintext)
int chrif_connect(int fd)
{
	ShowStatus("Logging in to char server...\n", char_fd);
	WFIFOHEAD(fd,60);
	WFIFOW(fd,0) = 0x2af8;
	memcpy(WFIFOP(fd,2), userid, NAME_LENGTH);
	memcpy(WFIFOP(fd,26), passwd, NAME_LENGTH);
	WFIFOL(fd,50) = 0;
	WFIFOL(fd,54) = htonl(clif_getip());
	WFIFOW(fd,58) = htons(clif_getport());
	WFIFOSET(fd,60);

	return 0;
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:15,代码来源:chrif.c

示例7: chrif_update_ip

void chrif_update_ip(int fd)
{
	uint32 new_ip;
	WFIFOHEAD(fd,6);
	new_ip = host2ip(char_ip_str);
	if (new_ip && new_ip != char_ip)
		char_ip = new_ip; //Update char_ip

	new_ip = clif_refresh_ip();
	if (!new_ip) return; //No change
	WFIFOW(fd,0) = 0x2736;
	WFIFOL(fd,2) = htonl(new_ip);
	WFIFOSET(fd,6);
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:14,代码来源:chrif.c

示例8: chrif_scdata_request

/*==========================================
 * Request sc_data from charserver [Skotlex]
 *------------------------------------------*/
int chrif_scdata_request(int account_id, int char_id) {
	
#ifdef ENABLE_SC_SAVING
	chrif_check(-1);

	WFIFOHEAD(char_fd,10);
	WFIFOW(char_fd,0) = 0x2afc;
	WFIFOL(char_fd,2) = account_id;
	WFIFOL(char_fd,6) = char_id;
	WFIFOSET(char_fd,10);
#endif
	
	return 0;
}
开发者ID:Judasu,项目名称:rAthena-1,代码行数:17,代码来源:chrif.c

示例9: chmapif_parse_askscdata

/**
 * Map-serv requesting to send the list of sc_data the player has saved
 * @author [Skotlex]
 * @param fd: wich fd to parse from
 * @return : 0 not enough data received, 1 success
 */
int chmapif_parse_askscdata(int fd){
	if (RFIFOREST(fd) < 10)
		return 0;
	{
#ifdef ENABLE_SC_SAVING
		int aid, cid;
		aid = RFIFOL(fd,2);
		cid = RFIFOL(fd,6);
		if( SQL_ERROR == Sql_Query(sql_handle, "SELECT type, tick, val1, val2, val3, val4 from `%s` WHERE `account_id` = '%d' AND `char_id`='%d'",
			schema_config.scdata_db, aid, cid) )
		{
			Sql_ShowDebug(sql_handle);
			return 1;
		}
		if( Sql_NumRows(sql_handle) > 0 )
		{
			struct status_change_data scdata;
			int count;
			char* data;

			WFIFOHEAD(fd,14+50*sizeof(struct status_change_data));
			WFIFOW(fd,0) = 0x2b1d;
			WFIFOL(fd,4) = aid;
			WFIFOL(fd,8) = cid;
			for( count = 0; count < 50 && SQL_SUCCESS == Sql_NextRow(sql_handle); ++count )
			{
				Sql_GetData(sql_handle, 0, &data, NULL); scdata.type = atoi(data);
				Sql_GetData(sql_handle, 1, &data, NULL); scdata.tick = atoi(data);
				Sql_GetData(sql_handle, 2, &data, NULL); scdata.val1 = atoi(data);
				Sql_GetData(sql_handle, 3, &data, NULL); scdata.val2 = atoi(data);
				Sql_GetData(sql_handle, 4, &data, NULL); scdata.val3 = atoi(data);
				Sql_GetData(sql_handle, 5, &data, NULL); scdata.val4 = atoi(data);
				memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data));
			}
			if (count >= 50)
				ShowWarning("Too many status changes for %d:%d, some of them were not loaded.\n", aid, cid);
			if (count > 0)
			{
				WFIFOW(fd,2) = 14 + count*sizeof(struct status_change_data);
				WFIFOW(fd,12) = count;
				WFIFOSET(fd,WFIFOW(fd,2));
			}
		}
		Sql_FreeResult(sql_handle);
#endif
		RFIFOSKIP(fd, 10);
	}
	return 1;
}
开发者ID:Oranji-Aka,项目名称:rathena,代码行数:55,代码来源:char_mapif.c

示例10: chrif_sendmap

// sends maps to char-server
int chrif_sendmap(int fd) {
	int i;
	
	ShowStatus("Enviando mapas para o servidor de personagens...\n");
	
	// Sending normal maps, not instances
	WFIFOHEAD(fd, 4 + instance_start * 4);
	WFIFOW(fd,0) = 0x2afa;
	for(i = 0; i < instance_start; i++)
		WFIFOW(fd,4+i*4) = map[i].index;
	WFIFOW(fd,2) = 4 + i * 4;
	WFIFOSET(fd,WFIFOW(fd,2));

	return 0;
}
开发者ID:Apocalipse,项目名称:Cronus,代码行数:16,代码来源:chrif.c

示例11: mapif_Mail_delete

/*==========================================
 * Delete Mail
 *------------------------------------------*/
static void mapif_Mail_delete(int fd, int char_id, int mail_id)
{
	bool failed = false;
	if(SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", mail_db, mail_id)) {
		Sql_ShowDebug(sql_handle);
		failed = true;
	}

	WFIFOHEAD(fd,11);
	WFIFOW(fd,0) = 0x384b;
	WFIFOL(fd,2) = char_id;
	WFIFOL(fd,6) = mail_id;
	WFIFOB(fd,10) = failed;
	WFIFOSET(fd,11);
}
开发者ID:Chocolate31,项目名称:eamod,代码行数:18,代码来源:int_mail.c

示例12: mapif_homunculus_loaded

static void mapif_homunculus_loaded(int fd, int account_id, struct s_homunculus *hd)
{
	WFIFOHEAD(fd, sizeof(struct s_homunculus)+9);
	WFIFOW(fd,0) = 0x3891;
	WFIFOW(fd,2) = sizeof(struct s_homunculus)+9;
	WFIFOL(fd,4) = account_id;
	if(hd != NULL) {
		WFIFOB(fd,8) = 1; // success
		memcpy(WFIFOP(fd,9), hd, sizeof(struct s_homunculus));
	} else {
		WFIFOB(fd,8) = 0; // not found.
		memset(WFIFOP(fd,9), 0, sizeof(struct s_homunculus));
	}
	WFIFOSET(fd, sizeof(struct s_homunculus)+9);
}
开发者ID:afpatucci,项目名称:brAthena,代码行数:15,代码来源:int_homun.c

示例13: mapif_Mail_sendinbox

/*==========================================
 * Client Inbox Request
 *------------------------------------------*/
void mapif_Mail_sendinbox(int fd, uint32 char_id, unsigned char flag, enum mail_inbox_type type)
{
	struct mail_data md;
	mail_fromsql(char_id, &md);

	//FIXME: dumping the whole structure like this is unsafe [ultramage]
	WFIFOHEAD(fd, sizeof(md) + 10);
	WFIFOW(fd,0) = 0x3848;
	WFIFOW(fd,2) = sizeof(md) + 10;
	WFIFOL(fd,4) = char_id;
	WFIFOB(fd,8) = flag;
	WFIFOB(fd,9) = type;
	memcpy(WFIFOP(fd,10),&md,sizeof(md));
	WFIFOSET(fd,WFIFOW(fd,2));
}
开发者ID:AlmasB,项目名称:rathena,代码行数:18,代码来源:int_mail.cpp

示例14: mapif_itembound_store2gstorage

/**
 * IZ 0x3857 <size>.W <count>.W <guild_id>.W { <item>.?B }.*MAX_INVENTORY
 * Send the retrieved guild bound items to map-server, store them to guild storage.
 * By using this method, stackable items will looks how it should be, and overflowed
 * item's stack won't disturbs the guild storage table and the leftover items (when
 * storage is full) will be discarded.
 * @param fd
 * @param guild_id
 * @param items[]
 * @param count
 * @author [Cydh]
 */
void mapif_itembound_store2gstorage(int fd, int guild_id, struct item items[], unsigned short count) {
	int size = 8 + sizeof(struct item) * MAX_INVENTORY, i;

	WFIFOHEAD(fd, size);
	WFIFOW(fd, 0) = 0x3857;
	WFIFOW(fd, 2) = size;
	WFIFOW(fd, 6) = guild_id;
	for (i = 0; i < count && i < MAX_INVENTORY; i++) {
		if (!&items[i])
			continue;
		memcpy(WFIFOP(fd, 8 + (i * sizeof(struct item))), &items[i], sizeof(struct item));
	}
	WFIFOW(fd, 4) = i;
	WFIFOSET(fd, size);
}
开发者ID:jrcollado1987,项目名称:rathena,代码行数:27,代码来源:int_storage.cpp

示例15: mapif_rodex_checkname

/*------------------------------------------
 * Check Player
 *------------------------------------------*/
void mapif_rodex_checkname(int fd, int reqchar_id, int target_char_id, short target_class, int target_level, char *name)
{
	nullpo_retv(name);
	Assert_retv(reqchar_id > 0);
	Assert_retv(target_char_id >= 0);

	WFIFOHEAD(fd, 16 + NAME_LENGTH);
	WFIFOW(fd, 0) = 0x3898;
	WFIFOL(fd, 2) = reqchar_id;
	WFIFOL(fd, 6) = target_char_id;
	WFIFOW(fd, 10) = target_class;
	WFIFOL(fd, 12) = target_level;
	safestrncpy(WFIFOP(fd, 16), name, NAME_LENGTH);
	WFIFOSET(fd, 16 + NAME_LENGTH);
}
开发者ID:OmarAcero,项目名称:Hercules,代码行数:18,代码来源:int_rodex.c


注:本文中的WFIFOHEAD函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。