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


C++ readXMLInteger函数代码示例

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


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

示例1: if

bool TalkAction::configureEvent(xmlNodePtr p)
{
	std::string str;
	int intValue;
	if(readXMLString(p, "words", str)){
		commandString = str;
	}
	else{
		std::cout << "Error: [TalkAction::configureEvent] No words for TalkAction or Spell." 
			<< std::endl;
		return false;
	}

	if(readXMLString(p, "filter", str)){
		if(str == "quotation") {
			filterType = TALKACTION_MATCH_QUOTATION;
		} else if(str == "first word") {
			filterType = TALKACTION_MATCH_FIRST_WORD;
		}
	}

	if(readXMLInteger(p, "case-sensitive", intValue) || readXMLInteger(p, "sensitive", intValue)){
		caseSensitive = (intValue != 0);
	}

	if(readXMLInteger(p, "access", intValue)){
		accessLevel = intValue;
	}

	return true;
}
开发者ID:Codex-NG,项目名称:avesta74,代码行数:31,代码来源:talkaction.cpp

示例2: configureEvent

bool WeaponWand::configureEvent(xmlNodePtr p)
{
	if(!Weapon::configureEvent(p))
		return false;

	int32_t intValue;
	std::string strValue;

	if(readXMLInteger(p, "min", intValue))
		minChange = intValue;

	if(readXMLInteger(p, "max", intValue))
		maxChange = intValue;

	if(readXMLString(p, "type", strValue))
	{
		std::string tmpStrValue = asLowerCaseString(strValue);
		if(tmpStrValue == "earth")
			params.combatType = COMBAT_EARTHDAMAGE;
		else if(tmpStrValue == "ice")
			params.combatType = COMBAT_ICEDAMAGE;
		else if(tmpStrValue == "energy")
			params.combatType = COMBAT_ENERGYDAMAGE;
		else if(tmpStrValue == "fire")
			params.combatType = COMBAT_FIREDAMAGE;
		else if(tmpStrValue == "death")
			params.combatType = COMBAT_DEATHDAMAGE;
		else if(tmpStrValue == "holy")
			params.combatType = COMBAT_HOLYDAMAGE;
		else
			std::cout << "[Warning - WeaponWand::configureEvent] Type \"" << strValue << "\" does not exist." << std::endl;
	}
	return true;
}
开发者ID:CkyLua,项目名称:tfs,代码行数:34,代码来源:weapons.cpp

示例3: id

bool EffectEvent::configureRaidEvent(xmlNodePtr eventNode)
{
	if(!RaidEvent::configureRaidEvent(eventNode))
		return false;

	int32_t intValue;
	std::string strValue;
	if(!readXMLInteger(eventNode, "id", intValue))
	{
		if(!readXMLString(eventNode, "name", strValue))
		{
			std::clog << "[Error - EffectEvent::configureRaidEvent] id (or name) tag missing for effect event." << std::endl;
			return false;
		}
		else
			m_effect = getMagicEffect(strValue);
	}
	else
		m_effect = (MagicEffect_t)intValue;

	if(!readXMLString(eventNode, "pos", strValue))
	{
		if(!readXMLInteger(eventNode, "x", intValue))
		{
			std::clog << "[Error - EffectEvent::configureRaidEvent] x tag missing for effect event." << std::endl;
			return false;
		}

		m_position.x = intValue;
		if(!readXMLInteger(eventNode, "y", intValue))
		{
			std::clog << "[Error - EffectEvent::configureRaidEvent] y tag missing for effect event." << std::endl;
			return false;
		}

		m_position.y = intValue;
		if(!readXMLInteger(eventNode, "z", intValue))
		{
			std::clog << "[Error - EffectEvent::configureRaidEvent] z tag missing for effect event." << std::endl;
			return false;
		}

		m_position.z = intValue;
	}
	else
	{
		IntegerVec posList = vectorAtoi(explodeString(strValue, ";"));
		if(posList.size() < 3)
		{
			std::clog << "[Error - EffectEvent::configureRaidEvent] Malformed pos tag for effect event." << std::endl;
			return false;
		}

		m_position = Position(posList[0], posList[1], posList[2]);
	}

	return true;
}
开发者ID:milbradt,项目名称:TFS,代码行数:58,代码来源:raids.cpp

示例4: xmlParseFile

bool Actions::loadFromXml(const std::string &_datadir)
{
	this->loaded = false;
	Action *action = NULL;

	datadir = _datadir;

	std::string filename = datadir + "actions/actions.xml";
	std::transform(filename.begin(), filename.end(), filename.begin(), tolower);
	xmlDocPtr doc = xmlParseFile(filename.c_str());

	if (doc){
		this->loaded=true;
		xmlNodePtr root, p;
		root = xmlDocGetRootElement(doc);

		if (xmlStrcmp(root->name,(const xmlChar*) "actions")){
			xmlFreeDoc(doc);
			return false;
		}
		p = root->children;

		while (p)
		{
			const char* str = (char*)p->name;

			if (strcmp(str, "action") == 0){
				int itemid,uniqueid,actionid;
				if(readXMLInteger(p,"itemid",itemid)){
					action = loadAction(p);
					useItemMap[itemid] = action;
					action = NULL;
				}
				else if(readXMLInteger(p,"uniqueid",uniqueid)){
					action = loadAction(p);
					uniqueItemMap[uniqueid] = action;
					action = NULL;
				}
				else if(readXMLInteger(p,"actionid",actionid)){
					action = loadAction(p);
					actionItemMap[actionid] = action;
					action = NULL;
				}
				else{
					std::cout << "missing action id." << std::endl;
				}
			}
			p = p->next;
		}

		xmlFreeDoc(doc);
	}
	return this->loaded;
}
开发者ID:divinity76,项目名称:YurOTS,代码行数:54,代码来源:actions.cpp

示例5: configureRaidEvent

bool SingleSpawnEvent::configureRaidEvent(xmlNodePtr eventNode)
{
	if(!RaidEvent::configureRaidEvent(eventNode))
		return false;

	std::string strValue;
	if(!readXMLString(eventNode, "name", strValue))
	{
		std::clog << "[Error - SingleSpawnEvent::configureRaidEvent] name tag missing for singlespawn event." << std::endl;
		return false;
	}

	m_monsterName = strValue;
	if(!readXMLString(eventNode, "pos", strValue))
	{
		int32_t intValue;
		if(!readXMLInteger(eventNode, "x", intValue))
		{
			std::clog << "[Error - SingleSpawnEvent::configureRaidEvent] x tag missing for singlespawn event." << std::endl;
			return false;
		}

		m_position.x = intValue;
		if(!readXMLInteger(eventNode, "y", intValue))
		{
			std::clog << "[Error - SingleSpawnEvent::configureRaidEvent] y tag missing for singlespawn event." << std::endl;
			return false;
		}

		m_position.y = intValue;
		if(!readXMLInteger(eventNode, "z", intValue))
		{
			std::clog << "[Error - SingleSpawnEvent::configureRaidEvent] z tag missing for singlespawn event." << std::endl;
			return false;
		}

		m_position.z = intValue;
	}
	else
	{
		IntegerVec posList = vectorAtoi(explodeString(strValue, ";"));
		if(posList.size() < 3)
		{
			std::clog << "[Error - SingleSpawnEvent::configureRaidEvent] Malformed pos tag for singlespawn event." << std::endl;
			return false;
		}

		m_position = Position(posList[0], posList[1], posList[2]);
	}

	return true;
}
开发者ID:milbradt,项目名称:TFS,代码行数:52,代码来源:raids.cpp

示例6: Group

bool Groups::parseGroupNode(xmlNodePtr p)
{
	if(xmlStrcmp(p->name, (const xmlChar*)"group"))
		return false;

	int32_t intValue;
	if(!readXMLInteger(p, "id", intValue))
	{
		std::cout << "[Warning - Groups::parseGroupNode] Missing group id." << std::endl;
		return false;
	}

	std::string strValue;
	int64_t int64Value;

	Group* group = new Group(intValue);
	if(readXMLString(p, "name", strValue))
	{
		group->setFullName(strValue);
		group->setName(asLowerCaseString(strValue));
	}

	if(readXMLInteger64(p, "flags", int64Value))
		group->setFlags(int64Value);

	if(readXMLInteger64(p, "customFlags", int64Value))
		group->setCustomFlags(int64Value);

	if(readXMLInteger(p, "access", intValue))
		group->setAccess(intValue);

	if(readXMLInteger(p, "ghostAccess", intValue))
		group->setGhostAccess(intValue);
	else
		group->setGhostAccess(group->getAccess());

	if(readXMLInteger(p, "violationReasons", intValue))
		group->setViolationReasons(intValue);

	if(readXMLInteger(p, "nameViolationFlags", intValue))
		group->setNameViolationFlags(intValue);

	if(readXMLInteger(p, "statementViolationFlags", intValue))
		group->setStatementViolationFlags(intValue);

	if(readXMLInteger(p, "depotLimit", intValue))
		group->setDepotLimit(intValue);

	if(readXMLInteger(p, "maxVips", intValue))
		group->setMaxVips(intValue);

	if(readXMLInteger(p, "outfit", intValue))
		group->setOutfit(intValue);

	groupsMap[group->getId()] = group;
	return true;
}
开发者ID:A-Syntax,项目名称:cryingdamson-0.3.6-8.60-V8.2,代码行数:57,代码来源:group.cpp

示例7: explodeString

bool Item::loadItem(xmlNodePtr node, Container* parent)
{
	if(!xmlStrcmp(node->name, (const xmlChar*)"item"))
		return false;

	int32_t intValue;
	std::string strValue;

	Item* item = NULL;
	if(readXMLInteger(node, "id", intValue))
		item = Item::CreateItem(intValue);

	if(!item)
		return false;

	if(readXMLString(node, "attributes", strValue))
	{
		StringVec v, attr = explodeString(strValue, ";");
		for(StringVec::iterator it = attr.begin(); it != attr.end(); ++it)
		{
			v = explodeString((*it), ",");
			if(v.size() < 2)
				continue;

			if(atoi(v[1].c_str()) || v[1] == "0")
				item->setAttribute(v[0].c_str(), atoi(v[1].c_str()));
			else
				item->setAttribute(v[0].c_str(), v[1]);
		}
	}

	//compatibility
	if(readXMLInteger(node, "subtype", intValue) || readXMLInteger(node, "subType", intValue))
		item->setSubType(intValue);

	if(readXMLInteger(node, "actionId", intValue) || readXMLInteger(node, "actionid", intValue)
		|| readXMLInteger(node, "aid", intValue))
		item->setActionId(intValue);

	if(readXMLInteger(node, "uniqueId", intValue) || readXMLInteger(node, "uniqueid", intValue)
		|| readXMLInteger(node, "uid", intValue))
		item->setUniqueId(intValue);

	if(readXMLString(node, "text", strValue))
		item->setText(strValue);

	if(item->getContainer())
		loadContainer(node, item->getContainer());

	if(parent)
		parent->addItem(item);

	return true;
}
开发者ID:Elexonic,项目名称:otxserver,代码行数:54,代码来源:item.cpp

示例8: loadItem

bool Item::loadItem(xmlNodePtr node, Container* parent)
{
	if (xmlStrcmp(node->name, (const xmlChar*)"item") == 0)
	{
		int32_t intValue;
		std::string strValue;
		Item* item = NULL;

		if (readXMLInteger(node, "id", intValue))
		{
			item = Item::CreateItem(intValue);
		}

		if (!item)
		{
			return false;
		}

		//optional
		if (readXMLInteger(node, "subtype", intValue))
		{
			item->setSubType(intValue);
		}

		if (readXMLInteger(node, "actionid", intValue))
		{
			item->setActionId(intValue);
		}

		if (readXMLString(node, "text", strValue))
		{
			item->setText(strValue);
		}

		if (item->getContainer())
		{
			loadContainer(node, item->getContainer());
		}

		if (parent)
		{
			parent->addItem(item);
		}

		return true;
	}

	return false;
}
开发者ID:edubart,项目名称:otserv,代码行数:49,代码来源:item.cpp

示例9: parseOutfitNode

bool Outfits::parseOutfitNode(xmlNodePtr p)
{
	if(xmlStrcmp(p->name, (const xmlChar*)"outfit"))
		return false;

	int32_t intValue;
	if(!readXMLInteger(p, "id", intValue))
	{
		LOGe("[Outfits::parseOutfitNode] Missing outfit id, skipping");
		return false;
	}

	Outfit newOutfit;
	newOutfit.outfitId = intValue;

	std::string name, strValue;
	if(readXMLString(p, "default", strValue))
		newOutfit.isDefault = booleanString(strValue);

	if(!readXMLString(p, "name", strValue))
	{
		std::stringstream ss;
		ss << "Outfit #" << newOutfit.outfitId;
		ss >> name;
	}
开发者ID:novasdream,项目名称:tyano-core,代码行数:25,代码来源:outfit.cpp

示例10: setAllowFarUse

bool Action::configureEvent(xmlNodePtr p)
{
	int32_t intValue;
	if(readXMLInteger(p, "allowfaruse", intValue))
	{
		if(intValue != 0)
			setAllowFarUse(true);
	}

	if(readXMLInteger(p, "blockwalls", intValue))
	{
		if(intValue == 0)
			setCheckLineOfSight(false);
	}
	return true;
}
开发者ID:CkyLua,项目名称:tfs,代码行数:16,代码来源:actions.cpp

示例11: xmlParseMemory

Item* ProtocolAdmin::createMail(const std::string& xmlData, std::string& name, uint32_t& depotId)
{
	xmlDocPtr doc = xmlParseMemory(xmlData.c_str(), strlen(xmlData.c_str()));
	if(!doc){
		return NULL;
	}

	xmlNodePtr root = xmlDocGetRootElement(doc);

	if(xmlStrcmp(root->name,(const xmlChar*)"mail") != 0){
		return NULL;
	}

	int32_t itemId = ITEM_PARCEL;

	int32_t intValue;
	std::string strValue;

	if(readXMLString(root, "to", strValue)){
		name = strValue;
	}

	if(readXMLString(root, "town", strValue)){
		if(!Mailbox::getDepotId(strValue, depotId)){
			return NULL;
		}
	}
	else{
		//use the players default town
		if(!IOPlayer::instance()->getDefaultTown(name, depotId)){
			return NULL;
		}
	}

	if(readXMLInteger(root, "id", intValue)){
		itemId = intValue;
	}

	Item* mailItem = Item::CreateItem(itemId);
	mailItem->setParent(VirtualCylinder::virtualCylinder);

	if(Container* mailContainer = mailItem->getContainer()){
		xmlNodePtr node = root->children;
		while(node){
			if(node->type != XML_ELEMENT_NODE){
				node = node->next;
				continue;
			}

			if(!Item::loadItem(node, mailContainer)){
				delete mailContainer;
				return NULL;
			}

			node = node->next;
		}
	}

	return mailItem;
}
开发者ID:CkyLua,项目名称:OTHire,代码行数:60,代码来源:admin.cpp

示例12: configureEvent

bool WeaponDistance::configureEvent(xmlNodePtr p)
{
	if (!Weapon::configureEvent(p)) {
		return false;
	}

	const ItemType& it = Item::items[id];

	//default values
	if (it.ammoType != AMMO_NONE) {
		//hit chance on two-handed weapons is limited to 90%
		maxHitChance = 90;
	} else {
		//one-handed is set to 75%
		maxHitChance = 75;
	}

	if (it.hitChance != 0) {
		hitChance = it.hitChance;
	}

	if (it.maxHitChance != -1) {
		maxHitChance = it.maxHitChance;
	}

	if (it.breakChance != -1) {
		breakChance = it.breakChance;
	}

	if (it.ammoAction != AMMOACTION_NONE) {
		ammoAction = it.ammoAction;
	}

	int32_t intValue;

	if (readXMLInteger(p, "hitChance", intValue)) {
		std::cout << "Warning: hitChance is not longer used in weapons.xml." << std::endl;
	}

	if (readXMLInteger(p, "breakChance", intValue)) {
		std::cout << "Warning: breakChance is not longer used in weapons.xml." << std::endl;
	}

	return true;
}
开发者ID:bergvall,项目名称:forgottenserver,代码行数:45,代码来源:weapons.cpp

示例13: configureRaidEvent

bool SingleSpawnEvent::configureRaidEvent(xmlNodePtr eventNode)
{
	if(!RaidEvent::configureRaidEvent(eventNode)){
		return false;
	}

	std::string strValue;
	int intValue;

	if(readXMLString(eventNode, "name", strValue)){
		m_monsterName = strValue;
	}
	else{
		std::cout << "[Error] Raid: name tag missing for singlespawn event." << std::endl;
		return false;
	}

	if(readXMLInteger(eventNode, "x", intValue)){
		m_position.x = intValue;
	}
	else{
		std::cout << "[Error] Raid: x tag missing for singlespawn event." << std::endl;
		return false;
	}

	if(readXMLInteger(eventNode, "y", intValue)){
		m_position.y = intValue;
	}
	else{
		std::cout << "[Error] Raid: y tag missing for singlespawn event." << std::endl;
		return false;
	}

	if(readXMLInteger(eventNode, "z", intValue)){
		m_position.z = intValue;
	}
	else{
		std::cout << "[Error] Raid: z tag missing for singlespawn event." << std::endl;
		return false;
	}

	return true;
}
开发者ID:ChubNtuck,项目名称:avesta74,代码行数:43,代码来源:raids.cpp

示例14: booleanString

bool RaidEvent::configureRaidEvent(xmlNodePtr eventNode)
{
	std::string strValue;
	if(readXMLString(eventNode, "ref", strValue))
		m_ref = booleanString(strValue);

	int32_t intValue;
	if(readXMLInteger(eventNode, "delay", intValue))
		m_delay = std::max((int32_t)m_delay, intValue);

	return true;
}
开发者ID:milbradt,项目名称:TFS,代码行数:12,代码来源:raids.cpp

示例15: setSubType

bool Item::unserialize(xmlNodePtr nodeItem)
{
	int intValue;
	std::string strValue;

	if(readXMLInteger(nodeItem, "id", intValue)){
		id = intValue;
	}
	else{
		return false;
	}

	if(readXMLInteger(nodeItem, "count", intValue)){
		setSubType(intValue);
	}

	if(readXMLString(nodeItem, "special_description", strValue)){
		setSpecialDescription(strValue);
	}

	if(readXMLString(nodeItem, "text", strValue)){
		setText(strValue);
	}

	if(readXMLInteger(nodeItem, "written_date", intValue)){
		setWrittenDate(intValue);
	}

	if(readXMLString(nodeItem, "writer", strValue)){
		setWriter(strValue);
	}

	if(readXMLInteger(nodeItem, "actionId", intValue)){
		setActionId(intValue);
	}

	if(readXMLInteger(nodeItem, "uniqueId", intValue)){
		setUniqueId(intValue);
	}

	if(readXMLInteger(nodeItem, "duration", intValue)){
		setDuration(intValue);
	}

	if(readXMLInteger(nodeItem, "decayState", intValue)){
		ItemDecayState_t decayState = (ItemDecayState_t)intValue;
		if(decayState != DECAYING_FALSE){
			setDecaying(DECAYING_PENDING);
		}
	}

	return true;
}
开发者ID:cp1337,项目名称:devland,代码行数:53,代码来源:item.cpp


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