• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MakeAnyLenString函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: safe_delete_array

void EQLConfig::DeleteLauncher() {

	launcher_list.Remove(m_name.c_str());

	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;

	char namebuf[128];
	database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F);	//limit len to 64
	namebuf[127] = '\0';

	if (!database.RunQuery(query, MakeAnyLenString(&query,
		"DELETE FROM launcher WHERE name='%s'",
		namebuf), errbuf)) {
		LogFile->write(EQEMuLog::Error, "Error in DeleteLauncher 1 query: %s", errbuf);
		safe_delete_array(query);
		return;
	}
	safe_delete_array(query);

	if (!database.RunQuery(query, MakeAnyLenString(&query,
		"DELETE FROM launcher_zones WHERE launcher='%s'",
		namebuf), errbuf)) {
		LogFile->write(EQEMuLog::Error, "Error in DeleteLauncher 2 query: %s", errbuf);
		safe_delete_array(query);
		return;
	}
	safe_delete_array(query);
}
开发者ID:Derision,项目名称:Server,代码行数:29,代码来源:EQLConfig.cpp


示例2: _log

void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 Items) {

	char errbuf[MYSQL_ERRMSG_SIZE];
	char* query = 0;
	uint32 lastid = 0;
	if(!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO `qs_player_trade_record` SET `time`=NOW(), "
		"`char1_id`='%i', `char1_pp`='%i', `char1_gp`='%i', `char1_sp`='%i', `char1_cp`='%i', `char1_items`='%i', "
		"`char2_id`='%i', `char2_pp`='%i', `char2_gp`='%i', `char2_sp`='%i', `char2_cp`='%i', `char2_items`='%i'",
		QS->char1_id, QS->char1_money.platinum, QS->char1_money.gold, QS->char1_money.silver, QS->char1_money.copper, QS->char1_count,
		QS->char2_id, QS->char2_money.platinum, QS->char2_money.gold, QS->char2_money.silver, QS->char2_money.copper, QS->char2_count),
		errbuf, 0, 0, &lastid)) {
		_log(NET__WORLD, "Failed Trade Log Record Insert: %s", errbuf);
		_log(NET__WORLD, "%s", query);
	}

	if(Items > 0) {
		for(int i = 0; i < Items; i++) {
			if(!RunQuery(query, MakeAnyLenString(&query, "INSERT INTO `qs_player_trade_record_entries` SET `event_id`='%i', "
				"`from_id`='%i', `from_slot`='%i', `to_id`='%i', `to_slot`='%i', `item_id`='%i', "
				"`charges`='%i', `aug_1`='%i', `aug_2`='%i', `aug_3`='%i', `aug_4`='%i', `aug_5`='%i'",
				lastid, QS->items[i].from_id, QS->items[i].from_slot, QS->items[i].to_id, QS->items[i].to_slot, QS->items[i].item_id,
				QS->items[i].charges, QS->items[i].aug_1, QS->items[i].aug_2, QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5,
				errbuf, 0, 0))) {
				_log(NET__WORLD, "Failed Trade Log Record Entry Insert: %s", errbuf);
				_log(NET__WORLD, "%s", query);
			}
		}
	}
}
开发者ID:Corysia,项目名称:Server,代码行数:29,代码来源:database.cpp


示例3: _log

void LFGuildManager::ExpireEntries()
{
	char errbuf[MYSQL_ERRMSG_SIZE];
	char* query = 0;

	std::list<PlayerLookingForGuild>::iterator it;
	std::list<GuildLookingForPlayers>::iterator it2;

	for(it = Players.begin(); it != Players.end(); ++it)
	{
		if((*it).TimePosted + 604800 <= (uint32)time(NULL))
		{
			if(!database.RunQuery(query, MakeAnyLenString(&query, "DELETE from `lfguild` WHERE `type` = 0 AND `name` = '%s'", (*it).Name.c_str()), errbuf, 0, 0))
				_log(QUERYSERV__ERROR, "Error expiring player LFGuild entry, query was %s, %s", query, errbuf);

			safe_delete_array(query);

			it = Players.erase(it);
		}
	}

	for(it2 = Guilds.begin(); it2 != Guilds.end(); ++it2)
	{
		if((*it2).TimePosted + 2592000 <= time(NULL))
		{
			if(!database.RunQuery(query, MakeAnyLenString(&query, "DELETE from `lfguild` WHERE `type` = 1 AND `name` = '%s'", (*it2).Name.c_str()), errbuf, 0, 0))
				_log(QUERYSERV__ERROR, "Error removing guild LFGuild entry, query was %s, %s", query, errbuf);

			safe_delete_array(query);

			it2 = Guilds.erase(it2);
		}
	}
}
开发者ID:Lord-Ptolemy,项目名称:projecteqemu,代码行数:34,代码来源:lfguild.cpp


示例4: _log

bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) {
	if(m_db == nullptr) {
		_log(GUILDS__DB, "Requested to set char to guild %d when we have no database object.", guild_id);
		return(false);
	}

	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;

	if(guild_id != GUILD_NONE) {
		if (!m_db->RunQuery(query, MakeAnyLenString(&query,
			"REPLACE INTO guild_members (char_id,guild_id,rank) VALUES(%d,%d,%d)",
			charid, guild_id, rank), errbuf))
		{
			_log(GUILDS__ERROR, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query, errbuf);
			safe_delete_array(query);
			return(false);
		}
	} else {
		if (!m_db->RunQuery(query, MakeAnyLenString(&query,
			"DELETE FROM guild_members WHERE char_id=%d",
			charid), errbuf))
		{
			_log(GUILDS__ERROR, "Error removing char %d from guild '%s': %s", charid, guild_id, query, errbuf);
			safe_delete_array(query);
			return(false);
		}
	}
	safe_delete_array(query);

	_log(GUILDS__DB, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank);

	return(true);
}
开发者ID:Corysia,项目名称:Server,代码行数:34,代码来源:guild_base.cpp


示例5: BuildFactionMessage

//o--------------------------------------------------------------
//| Name: BuildFactionMessage; rembrant, Dec. 16, 2001
//o--------------------------------------------------------------
//| Purpose: duh?
//o--------------------------------------------------------------
char* BuildFactionMessage(sint32 tmpvalue, sint32 faction_id, sint32 totalvalue)
{
	char *faction_message = 0;

	char name[50];

	if(database.GetFactionName(faction_id, name, sizeof(name)) == false) {
		snprintf(name, sizeof(name),"Faction%i",faction_id);
	}

	if(totalvalue >= MAX_FACTION) {
		MakeAnyLenString(&faction_message, "Your faction standing with %s could not possibly get any better!", name);
		return faction_message;
	}
	else if(tmpvalue > 0 && totalvalue < MAX_FACTION) {
		MakeAnyLenString(&faction_message, "Your faction standing with %s has gotten better!", name);
		return faction_message;
	}
	else if(tmpvalue == 0) {
		return 0;
	}
	else if(tmpvalue < 0 && totalvalue > MIN_FACTION) {
		MakeAnyLenString(&faction_message, "Your faction standing with %s has gotten worse!", name);
		return faction_message;
	}
	else if(totalvalue <= MIN_FACTION) {
		MakeAnyLenString(&faction_message, "Your faction standing with %s could not possibly get any worse!", name);
		return faction_message;
	}
	return 0;
}
开发者ID:aceoyame,项目名称:OpenEQC,代码行数:36,代码来源:faction.cpp


示例6: MakeAnyLenString

void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) {
    if(mob && mob->IsClient())
    {
        std::string hashname = package_name + std::string("::hasitem");

        //start with an empty hash
        perl->eval(std::string("%").append(hashname).append(" = ();").c_str());

        for(int slot = HASITEM_FIRST; slot <= HASITEM_LAST; slot++)
        {
            char *hi_decl=nullptr;
            int itemid = mob->CastToClient()->GetItemIDAt(slot);
            if(!HASITEM_ISNULLITEM(itemid))
            {
                MakeAnyLenString(&hi_decl, "push (@{$%s{%d}},%d);", hashname.c_str(), itemid, slot);
                perl->eval(hi_decl);
                safe_delete_array(hi_decl);
            }
        }
    }

    if(mob && mob->IsClient()) {
        std::string hashname = package_name + std::string("::oncursor");
        perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
        char *hi_decl = nullptr;
        int itemid = mob->CastToClient()->GetItemIDAt(30);
        if(!HASITEM_ISNULLITEM(itemid)) {
            MakeAnyLenString(&hi_decl, "push (@{$%s{%d}},%d);",hashname.c_str(), itemid, 30);
            perl->eval(hi_decl);
            safe_delete_array(hi_decl);
        }
    }
}
开发者ID:AthrogatePEQ,项目名称:Server,代码行数:33,代码来源:embparser.cpp


示例7: MakeAnyLenString

void Client::LearnRecipe(uint32 recipeID)
{
	char *query = 0;
	uint32 qlen;
	uint32 qcount = 0;
	char errbuf[MYSQL_ERRMSG_SIZE];
	MYSQL_RES *result;
	MYSQL_ROW row;
	
	qlen = MakeAnyLenString(&query, "SELECT tr.name, crl.madecount "
		" FROM tradeskill_recipe as tr "
		" LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl "
		"  ON tr.id = crl.recipe_id "
		" WHERE tr.id = %u ;", CharacterID(), recipeID);
	
	if (!database.RunQuery(query, qlen, errbuf, &result)) {
		LogFile->write(EQEMuLog::Error, "Error in Client::LearnRecipe query '%s': %s", query, errbuf);
		safe_delete_array(query);
		return;
	}
	
	qcount = mysql_num_rows(result);
	if (qcount != 1) {
		LogFile->write(EQEMuLog::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, qcount);
		mysql_free_result(result);
		safe_delete_array(query);
		return;
	}
	safe_delete_array(query);

	row = mysql_fetch_row(result);
	
	if (row != NULL && row[0] != NULL) {
		// Only give Learn message if character doesn't know the recipe
		if (row[1] == NULL) {
			Message_StringID(4, TRADESKILL_LEARN_RECIPE, row[0]);
			// Actually learn the recipe now
			qlen = MakeAnyLenString(&query, "INSERT INTO char_recipe_list "
				" SET recipe_id = %u, char_id = %u, madecount = 0 "
				" ON DUPLICATE KEY UPDATE madecount = madecount;"
			, recipeID, CharacterID());

			if (!database.RunQuery(query, qlen, errbuf)) {
				LogFile->write(EQEMuLog::Error, "Error in LearnRecipe query '%s': %s", query, errbuf);
			}
			safe_delete_array(query);
		}
	}
	
	mysql_free_result(result);
	
}
开发者ID:pixelbound,项目名称:Server,代码行数:52,代码来源:tradeskills.cpp


示例8: LearnMembers

bool Group::LearnMembers() {
	char errbuf[MYSQL_ERRMSG_SIZE];
	char* query = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;
	if (database.RunQuery(query,MakeAnyLenString(&query, "SELECT name FROM group_id WHERE groupid=%lu", (unsigned long)GetID()),
					errbuf,&result)){
		safe_delete_array(query);
		if(mysql_num_rows(result) < 1) {	//could prolly be 2
			mysql_free_result(result);
			LogFile->write(EQEMuLog::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), errbuf);
			return(false);
		}
		int i = 0;
		while((row = mysql_fetch_row(result))) {
			if(!row[0])
				continue;
			members[i] = nullptr;
			strn0cpy(membername[i], row[0], 64);

			i++;
		}
		mysql_free_result(result);
	}

	return(true);
}
开发者ID:eqmactop,项目名称:Server,代码行数:27,代码来源:groups.cpp


示例9: atoi

Spawn2* ZoneDatabase::LoadSpawn2(LinkedList<Spawn2*> &spawn2_list, int32 spawn2id, int32 timeleft) {
	char errbuf[MYSQL_ERRMSG_SIZE];
	char* query = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;

	if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, spawngroupID, x, y, z, heading, respawntime, variance, pathgrid, _condition, cond_value, enabled FROM spawn2 WHERE id=%i", spawn2id), errbuf, &result))
	{
		if (mysql_num_rows(result) == 1)
		{
			row = mysql_fetch_row(result);
			bool perl_enabled = atoi(row[11]) == 1 ? true : false;
			Spawn2* newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), atof(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atoi(row[6]), atoi(row[7]), timeleft, atoi(row[8]), atoi(row[9]), atoi(row[10]), perl_enabled);
			spawn2_list.Insert( newSpawn );
			mysql_free_result(result);
			safe_delete_array(query);
			return newSpawn;
		}
		mysql_free_result(result);
	}

	LogFile->write(EQEMuLog::Error, "Error in LoadSpawn2 query '%s': %s", query, errbuf);
	safe_delete_array(query);
	return 0;
}
开发者ID:Xackery,项目名称:provztz,代码行数:25,代码来源:spawn2.cpp


示例10: return

bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vector<CharGuildInfo *> &members) {
	members.clear();

	if(m_db == nullptr)
		return(false);

	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;

	//load up the rank info for each guild.
	if (!m_db->RunQuery(query, MakeAnyLenString(&query,
		GuildMemberBaseQuery " WHERE g.guild_id=%d", guild_id
		), errbuf, &result)) {
		_log(GUILDS__ERROR, "Error loading guild member list '%s': %s", query, errbuf);
		safe_delete_array(query);
		return(false);
	}
	safe_delete_array(query);

	while ((row = mysql_fetch_row(result))) {
		CharGuildInfo *ci = new CharGuildInfo;
		ProcessGuildMember(row, *ci);
		members.push_back(ci);
	}
	mysql_free_result(result);

	_log(GUILDS__DB, "Retreived entire guild member list for guild %d from the database", guild_id);

	return(true);
}
开发者ID:Corysia,项目名称:Server,代码行数:32,代码来源:guild_base.cpp


示例11: GetAltFlag

bool BaseGuildManager::GetAltFlag(uint32 CharID)
{
	char errbuf[MYSQL_ERRMSG_SIZE];
	char* query = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;

	if(!m_db)
		return false;

	if(!m_db->RunQuery(query, MakeAnyLenString(&query, "select `alt` from `guild_members` where char_id=%i LIMIT 1", CharID), errbuf, &result))
	{
		_log(GUILDS__ERROR, "Error retrieving alt flag '%s': %s", query, errbuf);

		safe_delete_array(query);

		return false;
	}

	safe_delete_array(query);

	if(mysql_num_rows(result) != 1)
		return false;

	row = mysql_fetch_row(result);

	bool IsAlt = atoi(row[0]);

	mysql_free_result(result);

	return IsAlt;
}
开发者ID:Corysia,项目名称:Server,代码行数:32,代码来源:guild_base.cpp


示例12: switch

void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) {
	char vstr[100];

	switch(type) {
	case IntRule:
		sprintf(vstr, "%d", m_RuleIntValues[index]);
		break;
	case RealRule:
		sprintf(vstr, "%.13f", m_RuleRealValues[index]);
		break;
	case BoolRule:
		sprintf(vstr, "%s", m_RuleBoolValues[index]?"true":"false");
		break;
	}

	char errbuf[MYSQL_ERRMSG_SIZE];
	char* query = 0;
	if (!db->RunQuery(query, MakeAnyLenString(&query,
		"REPLACE INTO rule_values (ruleset_id, rule_name, rule_value) "
		" VALUES(%d, '%s', '%s')",
		m_activeRuleset, _GetRuleName(type, index), vstr),errbuf))
	{
		_log(RULES__ERROR, "Fauled to set rule in the database: %s: %s", query,errbuf);
	}
	safe_delete_array(query);
}
开发者ID:Corysia,项目名称:Server,代码行数:26,代码来源:rulesys.cpp


示例13: GetVariable

bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_len) {

	char errbuf[MYSQL_ERRMSG_SIZE];
	char* query = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;

	if (!RunQuery(query,MakeAnyLenString(&query, "select `value` from `variables` where `varname`='%s'", varname), errbuf, &result)) {

		_log(UCS__ERROR, "Unable to get message count from database. %s %s", query, errbuf);

		safe_delete_array(query);

		return false;
	}

	safe_delete_array(query);

	if (mysql_num_rows(result) != 1) {

		mysql_free_result(result);

		return false;
	}

	row = mysql_fetch_row(result);

	snprintf(varvalue, varvalue_len, "%s", row[0]);

	mysql_free_result(result);

	return true;
}
开发者ID:Corysia,项目名称:Server,代码行数:33,代码来源:database.cpp


示例14: GetRulesetID

int RuleManager::_FindOrCreateRuleset(Database *db, const char *ruleset) {
	int res;

	res = GetRulesetID(db, ruleset);
	if(res >= 0)
		return(res);	//found and existing one...

	uint32 len = strlen(ruleset);
	char* rst = new char[2*len+1];
	db->DoEscapeString(rst, ruleset, len);

	uint32 new_id;
	char errbuf[MYSQL_ERRMSG_SIZE];
	char* query = 0;
	if (!db->RunQuery(query, MakeAnyLenString(&query,
		"INSERT INTO rule_sets (ruleset_id, name) "
		" VALUES(0, '%s')",
		rst),errbuf,nullptr,nullptr,&new_id))
	{
		_log(RULES__ERROR, "Fauled to create rule set in the database: %s: %s", query,errbuf);
		res = -1;
	} else {
		res = new_id;
	}
	safe_delete_array(query);

	return(res);
}
开发者ID:Corysia,项目名称:Server,代码行数:28,代码来源:rulesys.cpp


示例15: strlen

int RuleManager::GetRulesetID(Database *db, const char *rulesetname) {
	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;

	uint32 len = strlen(rulesetname);
	char* rst = new char[2*len+1];
	db->DoEscapeString(rst, rulesetname, len);

	int res = -1;

	if (db->RunQuery(query, MakeAnyLenString(&query,
		"SELECT ruleset_id"
		" FROM rule_sets"
		" WHERE name='%s'", rst), errbuf, &result))
	{
		if((row = mysql_fetch_row(result))) {
			res = atoi(row[0]);
		}
		mysql_free_result(result);
	} else {
		LogFile->write(EQEMuLog::Error, "Error in LoadRules query %s: %s", query, errbuf);
	}
	safe_delete_array(query);
	safe_delete_array(rst);

	return(res);
}
开发者ID:Corysia,项目名称:Server,代码行数:29,代码来源:rulesys.cpp


示例16: ListRulesets

bool RuleManager::ListRulesets(Database *db, std::map<int, std::string> &into) {
	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;

	//start out with the default set which is always present.
	into[0] = "default";

	if (db->RunQuery(query, MakeAnyLenString(&query,
		"SELECT ruleset_id,name"
		" FROM rule_sets"), errbuf, &result))
	{
		while((row = mysql_fetch_row(result))) {
			into[ atoi(row[0]) ] = row[1];
		}
		mysql_free_result(result);
		safe_delete_array(query);
	} else {
		LogFile->write(EQEMuLog::Error, "Error in ListRulesets query %s: %s", query, errbuf);
		safe_delete_array(query);
		return(false);
	}
	return(true);
}
开发者ID:Corysia,项目名称:Server,代码行数:25,代码来源:rulesys.cpp


示例17: MakeAnyLenString

bool PTimerList::Clear(Database *db) {
	_list.clear();
	
	char errbuf[MYSQL_ERRMSG_SIZE];
    char *query = 0;
	uint32 qlen = 0;
	
	qlen = MakeAnyLenString(&query, "DELETE FROM timers "
		" WHERE char_id=%lu ", (unsigned long)_char_id);
	
#ifdef DEBUG_PTIMERS
	printf("Storing all timers for char %lu: '%s'\n", (unsigned long)_char_id, query);
#endif
	
	if (!db->RunQuery(query, qlen, errbuf)) {
		safe_delete_array(query);
#if EQDEBUG > 5
		LogFile->write(EQEMuLog::Error, "Error in PersistentTimer::Clear, error: %s", errbuf);
#endif
		return(false);
	}
	safe_delete_array(query);
	
	return(true);
}
开发者ID:epicemu,项目名称:Server,代码行数:25,代码来源:ptimer.cpp


示例18: LoadGroundSpawns

Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs){
	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;

	if (RunQuery(query, MakeAnyLenString(&query, "SELECT max_x,max_y,max_z,min_x,min_y,heading,name,item,max_allowed,respawn_timer from ground_spawns where zoneid=%i and (version=%u OR version=-1) limit 50", zone_id, version), errbuf, &result))
	{
		safe_delete_array(query);
		int i=0;
		while( (row=mysql_fetch_row(result) ) ) {
			gs->spawn[i].max_x=atof(row[0]);
			gs->spawn[i].max_y=atof(row[1]);
			gs->spawn[i].max_z=atof(row[2]);
			gs->spawn[i].min_x=atof(row[3]);
			gs->spawn[i].min_y=atof(row[4]);
			gs->spawn[i].heading=atof(row[5]);
			strcpy(gs->spawn[i].name,row[6]);
			gs->spawn[i].item=atoi(row[7]);
			gs->spawn[i].max_allowed=atoi(row[8]);
			gs->spawn[i].respawntimer=atoi(row[9]);
			i++;
		}
		mysql_free_result(result);
	}
	else {
		std::cerr << "Error in LoadGroundSpawns query '" << query << "' " << errbuf << std::endl;
		safe_delete_array(query);
	}
	return gs;
}
开发者ID:jdewitt,项目名称:Server,代码行数:31,代码来源:Object.cpp


示例19: MakeAnyLenString

bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spawn2_list, int16 version, uint32 repopdelay) {
	char errbuf[MYSQL_ERRMSG_SIZE];
	char* query = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;
	
	const char *zone_name = database.GetZoneName(zoneid);

	MakeAnyLenString(&query, "SELECT id, spawngroupID, x, y, z, heading, respawntime, variance, pathgrid, _condition, cond_value, enabled, animation FROM spawn2 WHERE zone='%s' AND version=%u", zone_name, version);	
	if (RunQuery(query, strlen(query), errbuf, &result))
	{
		safe_delete_array(query);
		while((row = mysql_fetch_row(result)))
		{
			Spawn2* newSpawn = 0;
			
			bool perl_enabled = atoi(row[11]) == 1 ? true : false;
			uint32 spawnLeft = (GetSpawnTimeLeft(atoi(row[0]), zone->GetInstanceID()) * 1000);
			newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), atof(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atoi(row[6]), atoi(row[7]), spawnLeft, atoi(row[8]), atoi(row[9]), atoi(row[10]), perl_enabled, (EmuAppearance)atoi(row[12]));	
			spawn2_list.Insert( newSpawn );
		}
		mysql_free_result(result);
	}
	else
	{
		LogFile->write(EQEMuLog::Error, "Error in PopulateZoneLists query '%s': %s", query, errbuf);
		safe_delete_array(query);
		return false;
	}
	
	return true;
}
开发者ID:josheb,项目名称:emu_dc,代码行数:32,代码来源:spawn2.cpp


示例20: SetDynamicCount

bool EQLConfig::SetDynamicCount(int count) {
	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;

	char namebuf[128];
	database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F);	//limit len to 64
	namebuf[127] = '\0';

	if (!database.RunQuery(query, MakeAnyLenString(&query,
		"UPDATE launcher SET dynamics=%d WHERE name='%s'",
		count, namebuf), errbuf)) {
		LogFile->write(EQEMuLog::Error, "Error in SetDynamicCount query: %s", errbuf);
		safe_delete_array(query);
		return false;
	}
	safe_delete_array(query);

	//update in-memory version.
	m_dynamics = count;

	//if the launcher is connected, update it.
	LauncherLink *ll = launcher_list.Get(m_name.c_str());
	if(ll != nullptr) {
		ll->BootDynamics(count);
	}

	return(false);
}
开发者ID:Derision,项目名称:Server,代码行数:28,代码来源:EQLConfig.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MakeCamel函数代码示例发布时间:2022-05-30
下一篇:
C++ MakeActivityException函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap