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


C++ idb_get函数代码示例

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


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

示例1: itemdb_search

/*==========================================
 * Loads an item from the db. If not found, it will return the dummy item.
 *------------------------------------------*/
struct item_data* itemdb_search(int nameid)
{
	struct item_data* id;
	if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb_array) )
		id = itemdb_array[nameid];
	else
		id = (struct item_data*)idb_get(itemdb_other, nameid);

	if( id == NULL )
	{
		ShowWarning("itemdb_search: Item ID %d does not exists in the item_db. Using dummy data.\n", nameid);
		id = &dummy_item;
		dummy_item.nameid = nameid;
	}
	return id;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:19,代码来源:itemdb.c

示例2: account_db_txt_load_num

/// retrieve data from db and store it in the provided data structure
static bool account_db_txt_load_num(AccountDB* self, struct mmo_account* acc, const int account_id)
{
	AccountDB_TXT* db = (AccountDB_TXT*)self;
	DBMap* accounts = db->accounts;

	// retrieve data
	struct mmo_account* tmp = idb_get(accounts, account_id);
	if( tmp == NULL )
	{// entry not found
		return false;
	}

	// store it
	memcpy(acc, tmp, sizeof(struct mmo_account));

	return true;
}
开发者ID:KimKyung-wook,项目名称:ilathena-project,代码行数:18,代码来源:account_txt.c

示例3: mapif_parse_BreakGuild

// ギルド解散要求
int mapif_parse_BreakGuild(int fd, int guild_id) {
	struct guild *g;

	g = idb_get(guild_db, guild_id);
	if(g == NULL)
		return 0;

	guild_db->foreach(guild_db, guild_break_sub, guild_id);
	inter_guild_storage_delete(guild_id);
	mapif_guild_broken(guild_id, 0);

	if(log_inter)
		inter_log("guild %s (id=%d) broken" RETCODE, g->name, guild_id);

	idb_remove(guild_db, guild_id);
	return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:18,代码来源:int_guild.c

示例4: mapif_parse_PartyChangeOption

// パ?ティ?設定?更要求
int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, int item) {
	struct party_data *p;
	int flag = 0;

	p = idb_get(party_db, party_id);
	if (p == NULL)
		return 0;

	p->party.exp = exp;
	if (exp>0 && !party_check_exp_share(p)) {
		flag |= 0x01;
		p->party.exp = 0;
	}
	p->party.item = item&0x3;
	mapif_party_optionchanged(fd, &p->party, account_id, flag);
	return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:18,代码来源:int_party.c

示例5: mapif_parse_GuildSkillUp

// ギルドスキルアップ要求
int mapif_parse_GuildSkillUp(int fd, int guild_id, int skill_num, int account_id) {
	struct guild *g = idb_get(guild_db, guild_id);
	int idx = skill_num - GD_SKILLBASE;

	if (g == NULL || idx < 0 || idx >= MAX_GUILDSKILL)
		return 0;

	if (g->skill_point > 0 && g->skill[idx].id > 0 && g->skill[idx].lv < 10) {
		g->skill[idx].lv++;
		g->skill_point--;
		if (guild_calcinfo(g) == 0)
			mapif_guild_info(-1, g);
		mapif_guild_skillupack(guild_id, skill_num, account_id);
	}

	return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:18,代码来源:int_guild.c

示例6: chlogif_parse_ackchangesex

int chlogif_parse_ackchangesex(int fd, struct char_session_data* sd)
{
	if (RFIFOREST(fd) < 7)
		return 0;
	else {
		unsigned char buf[7];
		int acc = RFIFOL(fd,2);
		int sex = RFIFOB(fd,6);
		RFIFOSKIP(fd,7);

		if (acc > 0) { // TODO: Is this even possible?
			unsigned char i;
			int char_id = 0, class_ = 0, guild_id = 0;
			DBMap* auth_db = char_get_authdb();
			struct auth_node* node = (struct auth_node*)idb_get(auth_db, acc);
			SqlStmt *stmt;

			if (node != NULL)
				node->sex = sex;

			// get characters
			stmt = SqlStmt_Malloc(sql_handle);
			if (SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `char_id`, `class`, `guild_id` FROM `%s` WHERE `account_id` = '%d'", schema_config.char_db, acc) || SqlStmt_Execute(stmt)) {
				SqlStmt_ShowDebug(stmt);
				SqlStmt_Free(stmt);
			}

			SqlStmt_BindColumn(stmt, 0, SQLDT_INT,   &char_id,  0, NULL, NULL);
			SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT, &class_,   0, NULL, NULL);
			SqlStmt_BindColumn(stmt, 2, SQLDT_INT,   &guild_id, 0, NULL, NULL);

			for (i = 0; i < MAX_CHARS && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i) {
				chlogif_parse_change_sex_sub(sex, acc, char_id, class_, guild_id);
			}
			SqlStmt_Free(stmt);
		}

		// notify all mapservers about this change
		WBUFW(buf,0) = 0x2b0d;
		WBUFL(buf,2) = acc;
		WBUFB(buf,6) = sex;
		chmapif_sendall(buf, 7);
	}
	return 1;
}
开发者ID:Atemo,项目名称:rathena,代码行数:45,代码来源:char_logif.cpp

示例7: mapif_parse_WisReply

// Wisp/page transmission result
int mapif_parse_WisReply(int fd)
{
	int id, flag;
	struct WisData *wd;

	id = RFIFOL(fd,2);
	flag = RFIFOB(fd,6);
	wd = (struct WisData*)idb_get(wis_db, id);
	if (wd == NULL)
		return 0;	// This wisp was probably suppress before, because it was timeout of because of target was found on another map-server

	if ((--wd->count) <= 0 || flag != 1) {
		mapif_wis_end(wd, flag); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
		idb_remove(wis_db, id);
	}

	return 0;
}
开发者ID:BlazingSpear,项目名称:Hercules,代码行数:19,代码来源:inter.c

示例8: check_ttl_wisdata

int check_ttl_wisdata(void) {
    unsigned long tick = gettick();
    int i;

    do {
        wis_delnum = 0;
        wis_db->foreach(wis_db, check_ttl_wisdata_sub, tick);
        for(i = 0; i < wis_delnum; i++) {
            struct WisData *wd = idb_get(wis_db, wis_dellist[i]);
            ShowWarning("inter: wis data id=%d time out : from %s to %s\n", wd->id, wd->src, wd->dst);
            // removed. not send information after a timeout. Just no answer for the player
            //mapif_wis_end(wd, 1); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
            idb_remove(wis_db, wd->id);
        }
    } while(wis_delnum >= WISDELLIST_MAX);

    return 0;
}
开发者ID:mleo1,项目名称:Ragnarok-OldTimes,代码行数:18,代码来源:inter.c

示例9: itemdb_load

/*==========================================
 * Loads (and creates if not found) an item from the db.
 *------------------------------------------*/
struct item_data* itemdb_load(int nameid)
{
	struct item_data *id;

	if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb_array) ) {
		id = itemdb_array[nameid];
		if( id == NULL || id == &dummy_item )
			id = itemdb_array[nameid] = create_item_data(nameid);
		return id;
	}

	id = (struct item_data*)idb_get(itemdb_other, nameid);
	if( id == NULL || id == &dummy_item ) {
		id = create_item_data(nameid);
		idb_put(itemdb_other, nameid, id);
	}
	return id;
}
开发者ID:icxbb-xx,项目名称:trunk,代码行数:21,代码来源:itemdb.c

示例10: party_booking_update

void party_booking_update (struct map_session_data *sd, short *job)
{
	int i;
	struct party_booking_ad_info *pb_ad;
	pb_ad = (struct party_booking_ad_info *) idb_get (party_booking_db, sd->status.char_id);

	if (pb_ad == NULL)
		return;

	pb_ad->starttime = (int) time (NULL); // Update time.

	for (i = 0; i < PARTY_BOOKING_JOBS; i++)
		if (job[i] != 0xFF)
			pb_ad->p_detail.job[i] = job[i];
		else pb_ad->p_detail.job[i] = -1;

	clif_PartyBookingUpdateNotify (sd, pb_ad);
}
开发者ID:Celso1415,项目名称:Fusion,代码行数:18,代码来源:party.c

示例11: chmapif_parse_authok

/**
 * Player Requesting char-select from map_serv
 * @param fd: wich fd to parse from
 * @return : 0 not enough data received, 1 success
 */
int chmapif_parse_authok(int fd){
	if( RFIFOREST(fd) < 19 )
		return 0;
	else{
		uint32 account_id = RFIFOL(fd,2);
		uint32 login_id1 = RFIFOL(fd,6);
		uint32 login_id2 = RFIFOL(fd,10);
		uint32 ip = RFIFOL(fd,14);
		int version = RFIFOB(fd,18);
		RFIFOSKIP(fd,19);

		if( runflag != CHARSERVER_ST_RUNNING ){
			chmapif_charselres(fd,account_id,0);
		}else{
			struct auth_node* node;
			DBMap*  auth_db = char_get_authdb();
			DBMap* online_char_db = char_get_onlinedb();

			// create temporary auth entry
			CREATE(node, struct auth_node, 1);
			node->account_id = account_id;
			node->char_id = 0;
			node->login_id1 = login_id1;
			node->login_id2 = login_id2;
			//node->sex = 0;
			node->ip = ntohl(ip);
			node->version = version; //upd version for mapserv
			//node->expiration_time = 0; // unlimited/unknown time by default (not display in map-server)
			//node->gmlevel = 0;
			idb_put(auth_db, account_id, node);

			//Set char to "@ char select" in online db [Kevin]
			char_set_charselect(account_id);
			{
				struct online_char_data* character = (struct online_char_data*)idb_get(online_char_db, account_id);
				if( character != NULL ){
					character->pincode_success = true;
				}
			}
			chmapif_charselres(fd,account_id,1);
		}
	}
	return 1;
}
开发者ID:Insswer,项目名称:rathena,代码行数:49,代码来源:char_mapif.c

示例12: check_ttl_wisdata

int check_ttl_wisdata(void)
{
	int64 tick = gettick();
	int i;

	do {
		wis_delnum = 0;
		wis_db->foreach(wis_db, check_ttl_wisdata_sub, tick);
		for(i = 0; i < wis_delnum; i++) {
			struct WisData *wd = (struct WisData *)idb_get(wis_db, wis_dellist[i]);
			ShowWarning(read_message("Source.char.inter_checkttlwisdata"), wd->id, wd->src, wd->dst);
			// removed. not send information after a timeout. Just no answer for the player
			//mapif_wis_end(wd, 1); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
			idb_remove(wis_db, wd->id);
		}
	} while(wis_delnum >= WISDELLIST_MAX);

	return 0;
}
开发者ID:TidusBR,项目名称:brAthena-Old,代码行数:19,代码来源:inter.c

示例13: mapif_parse_PartyLeaderChange

int mapif_parse_PartyLeaderChange(int fd,int party_id,int account_id,int char_id)
{
	struct party_data *p;
	int i;

	p = idb_get(party_db, party_id);
	if (p == NULL)
		return 0;

	for (i = 0; i < MAX_PARTY; i++)
	{
		if(p->party.member[i].leader) 
			p->party.member[i].leader = 0;
		if(p->party.member[i].account_id == account_id &&
			p->party.member[i].char_id == char_id)
			p->party.member[i].leader = 1;
	}
	return 1;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:19,代码来源:int_party.c

示例14: mapif_parse_GuildLeave

// Delete member from guild
int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes)
{
	int i, j;

	struct guild* g = (struct guild*)idb_get(guild_db, guild_id);
	if( g == NULL )
	{
		//TODO
		return 0;
	}

	// Find the member
	ARR_FIND( 0, g->max_member, i, g->member[i].account_id == account_id && g->member[i].char_id == char_id );
	if( i == g->max_member )
	{
		//TODO
		return 0;
	}

	if( flag )
	{	// 追放の場合追放リストに入れる
		ARR_FIND( 0, MAX_GUILDEXPULSION, j, g->expulsion[j].account_id == 0 );
		if (j == MAX_GUILDEXPULSION)
		{	// 一杯なので古いのを消す
			for(j = 0; j < MAX_GUILDEXPULSION - 1; j++)
				g->expulsion[j] = g->expulsion[j+1];
			j = MAX_GUILDEXPULSION - 1;
		}
		// Save the expulsion entry
		g->expulsion[j].account_id = account_id;
		safestrncpy(g->expulsion[j].name, g->member[i].name, NAME_LENGTH);
		safestrncpy(g->expulsion[j].mes, mes, 40);
	}

	mapif_guild_withdraw(guild_id, account_id, char_id, flag, g->member[i].name, mes);

	memset(&g->member[i], 0, sizeof(struct guild_member));

	if (guild_check_empty(g) == 0)
		mapif_guild_info(-1,g);// まだ人がいるのでデ??送信

	return 0;
}
开发者ID:KimKyung-wook,项目名称:ilathena-project,代码行数:44,代码来源:int_guild.c

示例15: mapif_load_pet

int mapif_load_pet(int fd,int account_id,int char_id,int pet_id)
{
	struct s_pet *p;
	p = (struct s_pet*)idb_get(pet_db,pet_id);
	if(p!=NULL) {
		if(p->incuvate == 1) {
			p->account_id = p->char_id = 0;
			mapif_pet_info(fd,account_id,p);
		}
		else if(account_id == p->account_id && char_id == p->char_id)
			mapif_pet_info(fd,account_id,p);
		else
			mapif_pet_noinfo(fd,account_id);
	}
	else
		mapif_pet_noinfo(fd,account_id);

	return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:19,代码来源:int_pet.c


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