本文整理汇总了C++中STRING_LIST::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ STRING_LIST::empty方法的具体用法?C++ STRING_LIST::empty怎么用?C++ STRING_LIST::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STRING_LIST
的用法示例。
在下文中一共展示了STRING_LIST::empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configureEvent
//.........这里部分代码省略.........
}
else if(asLowerCaseString(str) == "necklace"){
slot = SLOT_NECKLACE;
}
else if(asLowerCaseString(str) == "backpack"){
slot = SLOT_BACKPACK;
}
else if(asLowerCaseString(str) == "armor"){
slot = SLOT_ARMOR;
}
else if(asLowerCaseString(str) == "right-hand"){
slot = SLOT_RIGHT;
}
else if(asLowerCaseString(str) == "left-hand"){
slot = SLOT_LEFT;
}
else if(asLowerCaseString(str) == "legs"){
slot = SLOT_LEGS;
}
else if(asLowerCaseString(str) == "feet"){
slot = SLOT_FEET;
}
else if(asLowerCaseString(str) == "ring"){
slot = SLOT_RING;
}
else if(asLowerCaseString(str) == "ammo"){
slot = SLOT_AMMO;
}
else{
std::cout << "Warning: [MoveEvent::configureMoveEvent] " << "Unknown slot type " << str << std::endl;
}
}
wieldInfo = 0;
if(readXMLInteger(p, "lvl", intValue) || readXMLInteger(p, "level", intValue)){
reqLevel = intValue;
if(reqLevel > 0){
wieldInfo |= WIELDINFO_LEVEL;
}
}
if(readXMLInteger(p, "maglv", intValue) || readXMLInteger(p, "maglevel", intValue)){
reqMagLevel = intValue;
if(reqMagLevel > 0){
wieldInfo |= WIELDINFO_MAGLV;
}
}
if(readXMLInteger(p, "prem", intValue) || readXMLInteger(p, "premium", intValue)){
premium = (intValue != 0);
if(premium){
wieldInfo |= WIELDINFO_PREMIUM;
}
}
//Gather vocation information
typedef std::list<std::string> STRING_LIST;
STRING_LIST vocStringList;
xmlNodePtr vocationNode = p->children;
while(vocationNode){
if(xmlStrcmp(vocationNode->name,(const xmlChar*)"vocation") == 0){
if(readXMLString(vocationNode, "name", str)){
int32_t vocationId = g_vocations.getVocationId(str);
if(vocationId != -1){
vocEquipMap[vocationId] = true;
intValue = 1;
readXMLInteger(vocationNode, "showInDescription", intValue);
if(intValue != 0){
toLowerCaseString(str);
vocStringList.push_back(str);
}
}
}
}
vocationNode = vocationNode->next;
}
if(!vocStringList.empty()){
for(STRING_LIST::iterator it = vocStringList.begin(); it != vocStringList.end(); ++it){
if(*it != vocStringList.front()){
if(*it != vocStringList.back()){
vocationString += ", ";
}
else{
vocationString += " and ";
}
}
vocationString += *it;
vocationString += "s";
}
wieldInfo |= WIELDINFO_VOCREQ;
}
}
}
else{
std::cout << "Error: [MoveEvent::configureMoveEvent] No event found." << std::endl;
return false;
}
return true;
}
示例2: configureEvent
bool Weapon::configureEvent(xmlNodePtr p)
{
int32_t intValue;
std::string strValue;
if (readXMLInteger(p, "id", intValue)) {
id = intValue;
} else {
std::cout << "Error: [Weapon::configureEvent] Weapon without id." << std::endl;
return false;
}
if (readXMLInteger(p, "lvl", intValue) || readXMLInteger(p, "level", intValue)) {
level = intValue;
}
if (readXMLInteger(p, "maglv", intValue) || readXMLInteger(p, "maglevel", intValue)) {
magLevel = intValue;
}
if (readXMLInteger(p, "mana", intValue)) {
mana = intValue;
}
if (readXMLInteger(p, "manapercent", intValue)) {
manaPercent = intValue;
}
if (readXMLInteger(p, "soul", intValue)) {
soul = intValue;
}
if (readXMLInteger(p, "exhaustion", intValue)) {
exhaustion = intValue;
}
if (readXMLInteger(p, "prem", intValue)) {
premium = (intValue == 1);
}
if (readXMLInteger(p, "enabled", intValue)) {
enabled = (intValue == 1);
}
if (readXMLInteger(p, "unproperly", intValue)) {
wieldUnproperly = (intValue == 1);
}
if (readXMLString(p, "ammo", strValue)) {
std::cout << "Warning: ammo is not longer used in weapons.xml." << std::endl;
}
typedef std::list<std::string> STRING_LIST;
STRING_LIST vocStringList;
xmlNodePtr vocationNode = p->children;
while (vocationNode) {
if (xmlStrcmp(vocationNode->name, (const xmlChar*)"vocation") == 0) {
if (readXMLString(vocationNode, "name", strValue)) {
int32_t vocationId = g_vocations.getVocationId(strValue);
if (vocationId != -1) {
vocWeaponMap[vocationId] = true;
int32_t promotedVocation = g_vocations.getPromotedVocation(vocationId);
if (promotedVocation != 0) {
vocWeaponMap[promotedVocation] = true;
}
readXMLInteger(vocationNode, "showInDescription", intValue);
if (intValue != 0) {
toLowerCaseString(strValue);
vocStringList.push_back(strValue);
}
}
}
}
vocationNode = vocationNode->next;
}
range = Item::items[id].shootRange;
std::string vocationString;
if (!vocStringList.empty()) {
for (STRING_LIST::iterator it = vocStringList.begin(); it != vocStringList.end(); ++it) {
if (*it != vocStringList.front()) {
if (*it != vocStringList.back()) {
vocationString += ", ";
} else {
vocationString += " and ";
}
}
vocationString += *it;
vocationString += "s";
}
}
//.........这里部分代码省略.........