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


C++ dbi_exists函数代码示例

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


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

示例1: channel_delete

/**
 * Deletes a chat channel.
 *
 * @param chan The channel to delete
 */
void channel_delete(struct channel_data *chan)
{
	nullpo_retv(chan);

	if (db_size(chan->users) && !channel->config->closing) {
		struct map_session_data *sd;
		struct DBIterator *iter = db_iterator(chan->users);
		for (sd = dbi_first(iter); dbi_exists(iter); sd = dbi_next(iter)) {
			channel->leave_sub(chan, sd);
		}
		dbi_destroy(iter);
	}
	if (chan->banned) {
		db_destroy(chan->banned);
		chan->banned = NULL;
	}
	db_destroy(chan->users);
	if (chan->m) {
		map->list[chan->m].channel = NULL;
		aFree(chan);
	} else if (chan->type == HCS_TYPE_ALLY) {
		aFree(chan);
	} else if (!channel->config->closing) {
		strdb_remove(channel->db, chan->name);
	}
}
开发者ID:xdgimf,项目名称:Renewal,代码行数:31,代码来源:channel.c

示例2: party_booking_search

void party_booking_search(struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount)
{
	struct party_booking_ad_info *pb_ad;
	int i, count = 0;
	struct party_booking_ad_info *result_list[PARTY_BOOKING_RESULTS];
	bool more_result = false;
	DBIterator *iter = db_iterator(party_booking_db);

	memset(result_list, 0, sizeof(result_list));

	for (pb_ad = dbi_first(iter); dbi_exists(iter); pb_ad = dbi_next(iter)) {
		if (pb_ad->index < lastindex || (level && (pb_ad->p_detail.level < level - 15 || pb_ad->p_detail.level > level)))
			continue;
		if (count >= PARTY_BOOKING_RESULTS) {
			more_result = true;
			break;
		}
		if (mapid == 0 && job == -1)
			result_list[count] = pb_ad;
		else if (mapid == 0) {
			for(i = 0; i < PARTY_BOOKING_JOBS; i++)
				if (pb_ad->p_detail.job[i] == job && job != -1)
					result_list[count] = pb_ad;
		} else if (job == -1) {
			if (pb_ad->p_detail.mapid == mapid)
				result_list[count] = pb_ad;
		}
		if (result_list[count])
			count++;
	}
	dbi_destroy(iter);
	clif_PartyBookingSearchAck(sd->fd, result_list, count, more_result);
}
开发者ID:SamuelHercules,项目名称:idathena,代码行数:33,代码来源:party.c

示例3: channel_close

void channel_close(struct channel_data *cd)
{
	int j;
	char output[128];
	struct map_session_data *pl_sd;
	DBIterator* iter;

	if( cd == NULL || cd->type != CHN_USER )
		return;
	
	sprintf(output, msg_txt(804), cd->name);
	clif_channel_message(cd, output, -1);

	iter = db_iterator(cd->users_db);
	for( pl_sd = (struct map_session_data *)dbi_first(iter); dbi_exists(iter); pl_sd = (struct map_session_data *)dbi_next(iter) )
	{
		idb_remove(cd->users_db, pl_sd->bl.id);
		ARR_FIND(0, MAX_USER_CHANNELS, j, pl_sd->cd[j] == cd);
		if( j == MAX_USER_CHANNELS )
			continue;
		
		pl_sd->cd[j] = NULL;
	}
	dbi_destroy(iter);
	
	db_destroy(cd->users_db);
	strdb_remove(channel_db, cd->name);
}
开发者ID:Chocolate31,项目名称:eamod,代码行数:28,代码来源:channel.c

示例4: party_send_xy_timer

int party_send_xy_timer(int tid, unsigned int tick, int id, intptr_t data)
{
	struct party_data *p;

	DBIterator *iter = db_iterator(party_db);
	//For each existing party
	for( p = (struct party_data *)dbi_first(iter); dbi_exists(iter); p = (struct party_data *)dbi_next(iter) ) {
		int i;

		if( !p->party.count ) //No online party members so do not iterate
			continue;

		//For each member of this party
		for( i = 0; i < MAX_PARTY; i++ ) {
			struct map_session_data *sd = p->data[i].sd;

			if( !sd )
				continue;

			if( p->data[i].x != sd->bl.x || p->data[i].y != sd->bl.y ) { //Perform position update
				clif_party_xy(sd);
				p->data[i].x = sd->bl.x;
				p->data[i].y = sd->bl.y;
			}
			if( battle_config.party_hp_mode && p->data[i].hp != sd->battle_status.hp ) { //Perform hp update
				clif_party_hp(sd);
				p->data[i].hp = sd->battle_status.hp;
			}
		}
	}
	dbi_destroy(iter);

	return 0;
}
开发者ID:SamuelHercules,项目名称:idathena,代码行数:34,代码来源:party.c

示例5: account_db_txt_iter_next

/// Fetches the next account in the database.
static bool account_db_txt_iter_next(AccountDBIterator* self, struct mmo_account* acc)
{
	AccountDBIterator_TXT* iter = (AccountDBIterator_TXT*)self;
	struct mmo_account* tmp = (struct mmo_account*)dbi_next(iter->iter);
	if( dbi_exists(iter->iter) )
	{
		memcpy(acc, tmp, sizeof(struct mmo_account));
		return true;
	}
	return false;
}
开发者ID:KimKyung-wook,项目名称:ilathena-project,代码行数:12,代码来源:account_txt.c

示例6: clan_searchname

struct clan* clan_searchname( const char* name ){
	struct clan* c;

	DBIterator *iter = db_iterator(clan_db);
	for( c = (struct clan*)dbi_first(iter); dbi_exists(iter); c = (struct clan*)dbi_next(iter) ){
		if( strncmpi( c->name, name, NAME_LENGTH ) == 0 ){
			break;
		}
	}
	dbi_destroy(iter);

	return c;
}
开发者ID:AtlantisRO,项目名称:rathena,代码行数:13,代码来源:clan.c

示例7: party_searchname

/// Party data lookup using party name.
struct party_data* party_searchname(const char* str)
{
	struct party_data* p;

	DBIterator *iter = db_iterator(party_db);
	for( p = (struct party_data*)dbi_first(iter); dbi_exists(iter); p = (struct party_data*)dbi_next(iter) ) {
		if( strncmpi(p->party.name,str,NAME_LENGTH) == 0 )
			break;
	}
	dbi_destroy(iter);

	return p;
}
开发者ID:julius5,项目名称:rathena,代码行数:14,代码来源:party.c

示例8: auction_count

static int auction_count(int char_id, bool buy)
{
	int i = 0;
	struct auction_data *auction;
	DBIterator *iter = db_iterator(auction_db_);

	for( auction = dbi_first(iter); dbi_exists(iter); auction = dbi_next(iter) )
	{
		if( (buy && auction->buyer_id == char_id) || (!buy && auction->seller_id == char_id) )
			i++;
	}
	dbi_destroy(iter);

	return i;
}
开发者ID:Boooo,项目名称:i-aint-quitting,代码行数:15,代码来源:int_auction.c

示例9: mapif_parse_PartyShareLevel

//Used to update party share level range in run time
int mapif_parse_PartyShareLevel(int fd,unsigned int share_lvl)
{
	struct party_data *p;
	DBIterator* iter = db_iterator(party_db_);

	party_share_level = share_lvl;

	for(p = dbi_first(iter); dbi_exists(iter); p = dbi_next(iter)) { //Update online parties
		if(p->party.count > 1)
			int_party_calc_state(p);
	}
	dbi_destroy(iter);

	return 1;
}
开发者ID:BlazingSpear,项目名称:rathena,代码行数:16,代码来源:int_party.c

示例10: raconf_destroy

void raconf_destroy(raconf rc){
	DBIterator *iter;
	struct conf_value *v;
	
	// Clear all entrys in db.
	iter = db_iterator(rc->db);
	for( v = (struct conf_value*)dbi_first(iter);  dbi_exists(iter);  v = (struct conf_value*)dbi_next(iter) ){
		aFree(v);
	}
	dbi_destroy(iter);

	db_destroy(rc->db);
	
	aFree(rc);	
	
}//end: raconf_destroy()
开发者ID:Abunay01,项目名称:Cronus,代码行数:16,代码来源:raconf.c

示例11: mapif_parse_PartyShareLevel

int mapif_parse_PartyShareLevel(int fd,unsigned int share_lvl)
{
	struct party_data *p;
	DBIterator* iter = db_iterator(party_db_);

	party_share_level = share_lvl;

	for(p = dbi_first(iter); dbi_exists(iter); p = dbi_next(iter)) { //Update online parties
		if(p->party.count > 1)
			int_party_calc_state(p);
		else if(!p->party.count) //Remove parties from memory that have no players online
			idb_remove(party_db_, p->party.party_id);
	}
	dbi_destroy(iter);

	return 1;
}
开发者ID:SNDBXIE,项目名称:myway-eathena,代码行数:17,代码来源:int_party.c

示例12: mapif_parse_Auction_requestlist

static void mapif_parse_Auction_requestlist(int fd)
{
	char searchtext[NAME_LENGTH];
	int char_id = RFIFOL(fd,4), len = sizeof(struct auction_data);
	int price = RFIFOL(fd,10);
	short type = RFIFOW(fd,8), page = max(1,RFIFOW(fd,14));
	unsigned char buf[5 * sizeof(struct auction_data)];
	DBIterator *iter = db_iterator(auction_db_);
	struct auction_data *auction;
	short i = 0, j = 0, pages = 1;

	memcpy(searchtext, RFIFOP(fd,16), NAME_LENGTH);

	for( auction = dbi_first(iter); dbi_exists(iter); auction = dbi_next(iter) )
	{
		if( (type == 0 && auction->type != IT_ARMOR && auction->type != IT_PETARMOR) || 
			(type == 1 && auction->type != IT_WEAPON) ||
			(type == 2 && auction->type != IT_CARD) ||
			(type == 3 && auction->type != IT_ETC) ||
			(type == 4 && !strstr(auction->item_name, searchtext)) ||
			(type == 5 && auction->price > price) ||
			(type == 6 && auction->seller_id != char_id) ||
			(type == 7 && auction->buyer_id != char_id) )
			continue;

		i++;
		if( i > 5 )
		{ // Counting Pages of Total Results (5 Results per Page)
			pages++;
			i = 1; // First Result of This Page
		}

		if( page != pages )
			continue; // This is not the requested Page

		memcpy(WBUFP(buf, j * len), auction, len);
		j++; // Found Results
	}
	dbi_destroy(iter);

	mapif_Auction_sendlist(fd, char_id, j, pages, buf);
}
开发者ID:Boooo,项目名称:i-aint-quitting,代码行数:42,代码来源:int_auction.c

示例13: channel_delete

/**
 * Delete a channel
 * - Checks if there is any user in channel and make them quit
 * @param channel: Channel data
 * @param force: Forcefully remove channel
 * @return
 *   0: Success
 *  -1: Invalid channel
 *  -2: Can't delete now
 */
int channel_delete(struct Channel *channel, bool force) {
	if(!channel)
		return -1;
	if(!force && channel->type == CHAN_TYPE_PUBLIC && runflag == MAPSERVER_ST_RUNNING) //only delete those serv stop
		return -2;
	if( db_size(channel->users)) {
		struct map_session_data *sd;
		DBIterator *iter = db_iterator(channel->users);
		for( sd = (struct map_session_data *)dbi_first(iter); dbi_exists(iter); sd = (struct map_session_data *)dbi_next(iter) ) { //for all users
			channel_clean(channel,sd,1); //make all quit
		}
		dbi_destroy(iter);
	}
	if (battle_config.etc_log)
		ShowInfo("Deleting channel %s alias %s type %d\n",channel->name,channel->alias,channel->type);
	db_destroy(channel->users);
	db_destroy(channel->banned);
	if (channel->groups)
		aFree(channel->groups);
	channel->groups = NULL;
	channel->group_count = 0;
	switch(channel->type){
	case CHAN_TYPE_MAP:
		map_getmapdata(channel->m)->channel = NULL;
		aFree(channel);
		break;
	case CHAN_TYPE_ALLY: {
		struct guild *g = guild_search(channel->gid);
		if(g) g->channel = NULL;
		aFree(channel);
		break;
	}
	default:
		strdb_remove(channel_db, channel->name);
		break;
	}
	return 0;
}
开发者ID:Atemo,项目名称:rathena,代码行数:48,代码来源:channel.cpp

示例14: read_config

/**
 * Loads group configuration from config file into memory.
 * @private
 */
static void read_config(void)
{
	config_setting_t *groups = NULL;
	const char *config_filename = "conf/groups.conf"; // FIXME hardcoded name
	int group_count = 0;
	
	if (conf_read_file(&pc_group_config, config_filename))
		return;

	groups = config_lookup(&pc_group_config, "groups");

	if (groups != NULL) {
		GroupSettings *group_settings = NULL;
		DBIterator *iter = NULL;
		int i, loop = 0;

		group_count = config_setting_length(groups);
		for (i = 0; i < group_count; ++i) {
			int id = 0, level = 0;
			const char *groupname = NULL;
			int log_commands = 0;
			config_setting_t *group = config_setting_get_elem(groups, i);

			if (!config_setting_lookup_int(group, "id", &id)) {
				ShowConfigWarning(group, "pc_groups:read_config: \"groups\" list member #%d has undefined id, removing...", i);
				config_setting_remove_elem(groups, i);
				--i;
				--group_count;
				continue;
			}

			if (id2group(id) != NULL) {
				ShowConfigWarning(group, "pc_groups:read_config: duplicate group id %d, removing...", i);
				config_setting_remove_elem(groups, i);
				--i;
				--group_count;
				continue;
			}

			config_setting_lookup_int(group, "level", &level);
			config_setting_lookup_bool(group, "log_commands", &log_commands);

			if (!config_setting_lookup_string(group, "name", &groupname)) {
				char temp[20];
				config_setting_t *name = NULL;
				snprintf(temp, sizeof(temp), "Group %d", id);
				if ((name = config_setting_add(group, "name", CONFIG_TYPE_STRING)) == NULL ||
				    !config_setting_set_string(name, temp)) {
					ShowError("pc_groups:read_config: failed to set missing group name, id=%d, skipping... (%s:%d)\n",
					          id, config_setting_source_file(group), config_setting_source_line(group));
					continue;
				}
				config_setting_lookup_string(group, "name", &groupname); // Retrieve the pointer
			}

			if (name2group(groupname) != NULL) {
				ShowConfigWarning(group, "pc_groups:read_config: duplicate group name %s, removing...", groupname);
				config_setting_remove_elem(groups, i);
				--i;
				--group_count;
				continue;
			}

			CREATE(group_settings, GroupSettings, 1);
			group_settings->id = id;
			group_settings->level = level;
			group_settings->name = groupname;
			group_settings->log_commands = (bool)log_commands;
			group_settings->inherit = config_setting_get_member(group, "inherit");
			group_settings->commands = config_setting_get_member(group, "commands");
			group_settings->permissions = config_setting_get_member(group, "permissions");
			group_settings->inheritance_done = false;
			group_settings->root = group;
			group_settings->group_pos = i;

			strdb_put(pc_groupname_db, groupname, group_settings);
			idb_put(pc_group_db, id, group_settings);
			
		}
		group_count = config_setting_length(groups); // Save number of groups
		
		// Check if all commands and permissions exist
		iter = db_iterator(pc_group_db);
		for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) {
			config_setting_t *commands = group_settings->commands, *permissions = group_settings->permissions;
			int count = 0, j;

			// Make sure there is "commands" group
			if (commands == NULL)
				commands = group_settings->commands = config_setting_add(group_settings->root, "commands", CONFIG_TYPE_GROUP);
			count = config_setting_length(commands);

			for (j = 0; j < count; ++j) {
				config_setting_t *command = config_setting_get_elem(commands, j);
				const char *name = config_setting_name(command);
				if (!atcommand_exists(name)) {
//.........这里部分代码省略.........
开发者ID:AsaK,项目名称:rathena,代码行数:101,代码来源:pc_groups.c

示例15: channel_leave

void channel_leave(struct map_session_data *sd, const char* name, bool msg)
{
	struct channel_data *cd;
	char output[128];
	int i;

	if( (cd = (struct channel_data *)strdb_get(channel_db, name)) == NULL )
		return;
	if( (i = channel_slot_get(sd, cd)) != -1 )
	{
		sd->cd[i] = NULL;
		clif_displaymessage(sd->fd, msg_txt(809));
		if( cd->type != CHN_USER && msg )
		{
			switch( cd->type )
			{
				case CHN_MAIN: sd->channels &= ~1; break;
				case CHN_VENDING: sd->channels &= ~2; break;
				case CHN_BATTLEGROUND: sd->channels &= ~4; break;
				case CHN_GAMEMASTER: sd->channels &= ~8; break;
			}
			pc_setaccountreg(sd, "#CHANNEL_CONF", sd->channels);
		}
	}

	if( idb_get(cd->users_db, sd->bl.id) != NULL )
	{
		idb_remove(cd->users_db, sd->bl.id);
		cd->users--;
		if( msg )
		{
			sprintf(output, msg_txt(810), cd->name, sd->status.name);
			clif_channel_message(cd, output, -1);
		}
	}

	if( cd->type != CHN_USER )
		return;

	if( cd->users < 1 )
	{ // No more users in the channel
		channel_close(cd);
		return;
	}

	if( sd->bl.id == cd->op )
	{ // Select another Operator
		struct map_session_data *pl_sd;
		DBIterator* iter = db_iterator(cd->users_db);

		cd->op = 0;
		if( (pl_sd = (struct map_session_data *)dbi_first(iter)) != NULL && dbi_exists(iter) )
		{
			cd->op = pl_sd->bl.id;
			sprintf(output, msg_txt(811), cd->name, pl_sd->status.name);
			clif_channel_message(cd, output, -1);
		}
		dbi_destroy(iter);
	}

	if( cd->users <= 0 )
	{
		ShowWarning("Channel '%s' with no users reporting %d users. Destroying it!!.\n", cd->name, cd->users);
		channel_close(cd);
	}
}
开发者ID:Chocolate31,项目名称:eamod,代码行数:66,代码来源:channel.c


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