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


C++ ConfigManager::getBool方法代码示例

本文整理汇总了C++中ConfigManager::getBool方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigManager::getBool方法的具体用法?C++ ConfigManager::getBool怎么用?C++ ConfigManager::getBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConfigManager的用法示例。


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

示例1: allow

bool Manager::allow(uint32_t ip) const
{
	if(!g_config.getBool(ConfigManager::MANAGER_LOCALHOST_ONLY))
		return !ConnectionManager::getInstance()->isDisabled(ip, 0xFE);

	if(ip == 0x0100007F) //127.0.0.1
		return true;

	if(g_config.getBool(ConfigManager::MANAGER_LOGS))
		LOG_MESSAGE(LOGTYPE_EVENT, "forbidden connection try", "MANAGER " + convertIPAddress(ip));

	return false;
}
开发者ID:Codex-NG,项目名称:tfs04full,代码行数:13,代码来源:manager.cpp

示例2: onCreatureLeave

void Monster::onCreatureLeave(Creature* creature)
{
#ifdef __DEBUG__
	std::clog << "onCreatureLeave - " << creature->getName() << std::endl;
#endif
	if(isSummon() && master == creature)
	{
		if(!g_config.getBool(ConfigManager::TELEPORT_SUMMONS) && (!master->getPlayer()
			|| !g_config.getBool(ConfigManager::TELEPORT_PLAYER_SUMMONS)))
		{
			//Turn the monster off until its master comes back
			isMasterInRange = false;
			updateIdleStatus();
		}
		else if(!doTeleportToMaster())
			teleportToMaster = true;
	}

	//update friendList
	if(isFriend(creature))
	{
		CreatureList::iterator it = std::find(friendList.begin(), friendList.end(), creature);
		if(it != friendList.end())
		{
			(*it)->unRef();
			friendList.erase(it);
		}
#ifdef __DEBUG__
		else
			std::clog << "Monster: " << creature->getName() << " not found in the friendList." << std::endl;
#endif
	}

	//update targetList
	if(isOpponent(creature))
	{
		CreatureList::iterator it = std::find(targetList.begin(), targetList.end(), creature);
		if(it != targetList.end())
		{
			(*it)->unRef();
			targetList.erase(it);
			if(targetList.empty())
				updateIdleStatus();
		}
#ifdef __DEBUG__
		else
			std::clog << "Player: " << creature->getName() << " not found in the targetList." << std::endl;
#endif
	}
}
开发者ID:alexisjojo,项目名称:darkkonia,代码行数:50,代码来源:monster.cpp

示例3: open

void ServicePort::open(uint16_t port)
{
	m_serverPort = port;
	m_pendingStart = false;
	try
	{
		if(g_config.getBool(ConfigManager::BIND_IP_ONLY))
			m_acceptor = new boost::asio::ip::tcp::acceptor(m_io_service, boost::asio::ip::tcp::endpoint(
				boost::asio::ip::address(boost::asio::ip::address_v4::from_string(
				g_config.getString(ConfigManager::IP))), m_serverPort));
		else
			m_acceptor = new boost::asio::ip::tcp::acceptor(m_io_service, boost::asio::ip::tcp::endpoint(
				boost::asio::ip::address(boost::asio::ip::address_v4(INADDR_ANY)), m_serverPort));

		accept();
	}
	catch(boost::system::system_error& e)
	{
		if(m_logError)
		{
			LOG_MESSAGE(LOGTYPE_ERROR, e.what(), "NETWORK")
			m_logError = false;
		}

		m_pendingStart = true;
		Scheduler::getInstance().addEvent(createSchedulerTask(5000, boost::bind(
			&ServicePort::onOpen, boost::weak_ptr<ServicePort>(shared_from_this()), m_serverPort)));
	}
}
开发者ID:A-Syntax,项目名称:cryingdamson-0.3.6-8.60-V8.2,代码行数:29,代码来源:server.cpp

示例4: saveMap

bool IOMapSerialize::saveMap(Map* map)
{
	if(g_config.getBool(ConfigManager::HOUSE_STORAGE))
		return saveMapBinary(map);

	return saveMapRelational(map);
}
开发者ID:PrzemolKing,项目名称:wedoserver,代码行数:7,代码来源:iomapserialize.cpp

示例5: updateDoorDescription

void House::updateDoorDescription()
{
	std::stringstream houseDescription;
	houseDescription << "It belongs to house '" << houseName << "'. " << std::endl;

	if(houseOwner != 0){
		houseDescription << houseOwnerName;
	}
	else{
		houseDescription << "Nobody";
	}
	houseDescription << " owns this house." << std::endl;

	if(getHouseOwner() == 0 && g_config.getBool(ConfigManager::SHOW_HOUSE_PRICE))
    {
		int price = 0;
		for(HouseTileList::iterator it = getHouseTileBegin(); it != getHouseTileEnd(); it++)
        {
			price += g_config.getNumber(ConfigManager::HOUSE_PRICE);
		}
		
		houseDescription << " This house costs " << price << " gold." << std::endl;
	}

	HouseDoorList::iterator it;
	for(it = doorList.begin(); it != doorList.end(); ++it){
		(*it)->setSpecialDescription(houseDescription.str());
	}
}
开发者ID:WeDontGiveAF,项目名称:OOServer,代码行数:29,代码来源:house.cpp

示例6: login

bool WaitingList::login(const Player* player)
{
	uint32_t online = g_game.getPlayersOnline(), max = g_config.getNumber(ConfigManager::MAX_PLAYERS);
	if(player->hasFlag(PlayerFlag_CanAlwaysLogin) || player->isAccountManager() || (waitList.empty()
		&& online < max) || (g_config.getBool(ConfigManager::PREMIUM_SKIP_WAIT) && player->isPremium()))
		return true;

	cleanup();
	uint32_t slot = 0;

	WaitList::iterator it = find(player, slot);
	if(it != waitList.end())
	{
		if((online + slot) > max)
		{
			//let them wait a bit longer
			(*it)->timeout = OTSYS_TIME() + getTimeout(slot) * 1000;
			return false;
		}

		//should be able to login now
		delete *it;
		waitList.erase(it);
		return true;
	}

	Wait* wait = new Wait();
	if(player->isPremium())
	{
		slot = 1;
		WaitList::iterator it = waitList.end();
		for(WaitList::iterator wit = waitList.begin(); wit != it; ++wit)
		{
			if(!(*wit)->premium)
			{
				it = wit;
				break;
			}

			++slot;
		}

		waitList.insert(it, wait);
	}
	else
	{
		waitList.push_back(wait);
		slot = waitList.size();
	}

	wait->name = player->getName();
	wait->ip = player->getIP();
	wait->premium = player->isPremium();

	wait->timeout = OTSYS_TIME() + getTimeout(slot) * 1000;
	return false;
}
开发者ID:A-Syntax,项目名称:cryingdamson-0.3.6-8.60-V8.2,代码行数:57,代码来源:waitlist.cpp

示例7: dropCorpse

void Creature::dropCorpse(DeathList deathList)
{
	if(master && !g_config.getBool(ConfigManager::SUMMONS_DROP_CORPSE))
	{
		g_game.addMagicEffect(getPosition(), MAGIC_EFFECT_POFF);
		return;
	}

	Item* corpse = createCorpse(deathList);
	if(corpse)
		corpse->setParent(VirtualCylinder::virtualCylinder);

	bool deny = false;
	CreatureEventList deathEvents = getCreatureEvents(CREATURE_EVENT_DEATH);
	for(CreatureEventList::iterator it = deathEvents.begin(); it != deathEvents.end(); ++it)
	{
		if(!(*it)->executeDeath(this, corpse, deathList) && !deny)
			deny = true;
	}

	if(!corpse)
		return;

	corpse->setParent(NULL);
	if(deny)
		return;

	Tile* tile = getTile();
	if(!tile)
		return;

	Item* splash = NULL;
	switch(getRace())
	{
		case RACE_VENOM:
			splash = Item::CreateItem(ITEM_FULLSPLASH, FLUID_GREEN);
			break;

		case RACE_BLOOD:
			splash = Item::CreateItem(ITEM_FULLSPLASH, FLUID_BLOOD);
			break;

		default:
			break;
	}

	if(splash)
	{
		g_game.internalAddItem(NULL, tile, splash, INDEX_WHEREEVER, FLAG_NOLIMIT);
		g_game.startDecay(splash);
	}

	g_game.internalAddItem(NULL, tile, corpse, INDEX_WHEREEVER, FLAG_NOLIMIT);
	dropLoot(corpse->getContainer());
	g_game.startDecay(corpse);
}
开发者ID:Azuen,项目名称:RealOTX-7.72,代码行数:56,代码来源:creature.cpp

示例8: onAttackedCreatureDisappear

void Monster::onAttackedCreatureDisappear(bool)
{
#ifdef __DEBUG__
	std::clog << "Attacked creature disappeared." << std::endl;
#endif
	attackTicks = 0;
	extraMeleeAttack = true;
	if(g_config.getBool(ConfigManager::MONSTER_SPAWN_WALKBACK))
		g_game.internalTeleport(this, getMasterPosition(), false);
}
开发者ID:milbradt,项目名称:TFS,代码行数:10,代码来源:monster.cpp

示例9: addLogLine

void ProtocolManager::addLogLine(LogType_t type, std::string message)
{
	if(!g_config.getBool(ConfigManager::MANAGER_LOGS))
		return;

	std::string tmp = "MANAGER";
	if(getIP())
		tmp += " " + convertIPAddress(getIP());

	LOG_MESSAGE(type, message, tmp)
}
开发者ID:Codex-NG,项目名称:tfs04full,代码行数:11,代码来源:manager.cpp

示例10: getPolicy

uint16_t Admin::getPolicy() const
{
	uint16_t policy = 0;
	if(g_config.getBool(ConfigManager::ADMIN_REQUIRE_LOGIN))
		policy |= REQUIRE_LOGIN;

	if(m_encrypted)
		policy |= REQUIRE_ENCRYPTION;

	return policy;
}
开发者ID:081421,项目名称:otxserver,代码行数:11,代码来源:admin.cpp

示例11: reloadPrices

bool Houses::reloadPrices()
{
	if(g_config.getBool(ConfigManager::HOUSE_RENTASPRICE))
		return true;

	const uint32_t tilePrice = g_config.getNumber(ConfigManager::HOUSE_PRICE);
	for(HouseMap::iterator it = houseMap.begin(); it != houseMap.end(); ++it)
		it->second->setPrice(tilePrice * it->second->getTilesCount(), true);

	return true;
}
开发者ID:alexisjojo,项目名称:darkkonia,代码行数:11,代码来源:house.cpp

示例12: storeQuery

DatabaseMySQL::DatabaseMySQL() :
	m_timeoutTask(0)
{
	m_connected = false;
	if(!mysql_init(&m_handle))
	{
		std::clog << std::endl << "Failed to initialize MySQL connection handler." << std::endl;
		return;
	}

	uint32_t timeout = g_config.getNumber(ConfigManager::MYSQL_READ_TIMEOUT);
	if(timeout)
		mysql_options(&m_handle, MYSQL_OPT_READ_TIMEOUT, (const char*)&timeout);

	timeout = g_config.getNumber(ConfigManager::MYSQL_WRITE_TIMEOUT);
	if(timeout)
		mysql_options(&m_handle, MYSQL_OPT_WRITE_TIMEOUT, (const char*)&timeout);

	my_bool reconnect = true;
	mysql_options(&m_handle, MYSQL_OPT_RECONNECT, &reconnect);
	if(!mysql_real_connect(&m_handle, g_config.getString(ConfigManager::SQL_HOST).c_str(), g_config.getString(
		ConfigManager::SQL_USER).c_str(), g_config.getString(ConfigManager::SQL_PASS).c_str(), g_config.getString(
		ConfigManager::SQL_DB).c_str(), g_config.getNumber(ConfigManager::SQL_PORT), NULL, 0))
	{
		std::clog << "Failed connecting to database - MYSQL ERROR: " << mysql_error(&m_handle) << " (" << mysql_errno(&m_handle) << ")" << std::endl;
		return;
	}

	m_connected = true;
	if(mysql_get_client_version() <= 50019)
		//MySQL servers <= 5.0.19 have a bug where MYSQL_OPT_RECONNECT option is reset by mysql_real_connect calls.
		//Read this http://dev.mysql.com/doc/refman/5.0/en/mysql-options.html for more information.
		std::clog << std::endl << "> WARNING: Outdated MySQL server detected, consider upgrading to a newer version." << std::endl;

	timeout = g_config.getNumber(ConfigManager::SQL_KEEPALIVE) * 1000;
	if(timeout)
		m_timeoutTask = Scheduler::getInstance().addEvent(createSchedulerTask(timeout,
			boost::bind(&DatabaseMySQL::keepAlive, this)));

	if(!g_config.getBool(ConfigManager::HOUSE_STORAGE))
		return;

	//we cannot lock mutex here :)
	DBResult* result = storeQuery("SHOW variables LIKE 'max_allowed_packet';");
	if(!result)
		return;

	if(result->getDataLong("Value") < 16776192)
		std::clog << std::endl << "> WARNING: max_allowed_packet might be set too low for binary map storage." << std::endl
			<< "Use the following query to raise max_allow_packet: SET GLOBAL max_allowed_packet = 16776192;" << std::endl;

	result->free();
}
开发者ID:Berze,项目名称:sour,代码行数:53,代码来源:databasemysql.cpp

示例13: payRent

bool Houses::payRent(Player* player, House* house, uint32_t bid, time_t _time/* = 0*/)
{
	if(rentPeriod == RENTPERIOD_NEVER || !house->getOwner() ||
		house->getPaidUntil() > _time || !house->getRent() ||
		player->hasCustomFlag(PlayerCustomFlag_IgnoreHouseRent))
		return true;

	Town* town = Towns::getInstance()->getTown(house->getTownId());
	if(!town)
		return false;

	bool paid = false;
	uint32_t amount = house->getRent() + bid;
	if(g_config.getBool(ConfigManager::BANK_SYSTEM) && player->balance >= amount)
	{
		player->balance -= amount;
		paid = true;
	}
	else if(DepotChest* depotChest = player->getDepotChest(town->getID(), true))
		paid = g_game.removeMoney(depotChest, amount, FLAG_NOLIMIT);

	if(!paid)
		return false;

	if(!_time)
		_time = time(NULL);

	uint32_t paidUntil = _time;
	switch(rentPeriod)
	{
		case RENTPERIOD_DAILY:
			paidUntil += 86400;
			break;
		case RENTPERIOD_WEEKLY:
			paidUntil += 7 * 86400;
			break;
		case RENTPERIOD_MONTHLY:
			paidUntil += 30 * 86400;
			break;
		case RENTPERIOD_YEARLY:
			paidUntil += 365 * 86400;
			break;
		default:
			break;
	}

	house->setLastWarning(0);
	house->setRentWarnings(0);

	house->setPaidUntil(paidUntil);
	return true;
}
开发者ID:081421,项目名称:otxserver,代码行数:52,代码来源:house.cpp

示例14: isProtected

bool Combat::isProtected(Player* attacker, Player* target)
{
	if(attacker->hasFlag(PlayerFlag_CannotAttackPlayer))
		return true;

	if(attacker->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges))
		return false;

	if(attacker->getZone() == ZONE_HARDCORE && target->getZone() == ZONE_HARDCORE && g_config.getBool(ConfigManager::PVP_TILE_IGNORE_PROTECTION))
		return false;

	return target->isProtected() || attacker->isProtected() || (attacker->checkLoginDelay() && !attacker->hasBeenAttacked(target->getID()));
}
开发者ID:angeliker,项目名称:RlMap77x,代码行数:13,代码来源:combat.cpp

示例15: doCombatDispel

void Combat::doCombatDispel(Creature* caster, Creature* target, const CombatParams& params, bool check/* = true*/)
{
	if(check && params.isAggressive && (caster == target || Combat::canDoCombat(caster, target, true) != RET_NOERROR))
		return;

	CombatDispelFunc(caster, target, params, NULL);
	if(params.targetCallback)
		params.targetCallback->onTargetCombat(caster, target);

	if(params.effects.impact != MAGIC_EFFECT_NONE && (!caster || !caster->isGhost()
		|| g_config.getBool(ConfigManager::GHOST_SPELL_EFFECTS)))
		g_game.addMagicEffect(target->getPosition(), params.effects.impact);

	if(caster && params.effects.distance != SHOOT_EFFECT_NONE)
		addDistanceEffect(caster, caster->getPosition(), target->getPosition(), params.effects.distance);
}
开发者ID:angeliker,项目名称:RlMap77x,代码行数:16,代码来源:combat.cpp


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