Example #1
0
Sense_type lookup_sense_type(std::string name)
{
  name = no_caps(name);
  for (int i = 0; i < SENSE_MAX; i++) {
    Sense_type ret = Sense_type(i);
    if ( no_caps( sense_type_name(ret) ) == name) {
      return ret;
    }
  }
  return SENSE_NULL;
}
Example #2
0
City_type lookup_city_type(std::string name)
{
  name = no_caps( trim( name ) );
  for (int i = 0; i < CITY_TYPE_MAX; i++) {
    City_type ret = City_type(i);
    if (name == no_caps( trim( city_type_name(ret) ) ) ) {
      return ret;
    }
  }
  return CITY_TYPE_NULL;
}
Example #3
0
Body_part lookup_body_part(std::string name)
{
  name = no_caps(name);
  for (int i = 0; i < BODY_PART_MAX; i++) {
    Body_part ret = Body_part(i);
    if ( no_caps( body_part_name(ret) ) == name) {
      return ret;
    }
  }
  return BODY_PART_NULL;
}
Example #4
0
Damage_type lookup_damage_type(std::string name)
{
  name = no_caps(name);
  for (int i = 0; i < DAMAGE_MAX; i++) {
    Damage_type ret = Damage_type(i);
    if (name == no_caps( damage_type_name(ret) ) ) {
      return ret;
    }
  }
  return DAMAGE_NULL;
}
Example #5
0
HP_part lookup_HP_part(std::string name)
{
  name = no_caps(name);
  for (int i = 0; i < HP_PART_MAX; i++) {
    HP_part ret = HP_part(i);
    if ( no_caps(HP_part_name(ret)) == name ) {
      return ret;
    }
  }
  return HP_PART_NULL;
}
Example #6
0
Debug_action lookup_debug_action(std::string name)
{
  name = no_caps(name);
  name = trim(name);
  for (int i = 0; i < IACTION_MAX; i++) {
    Debug_action ret = Debug_action(i);
    if ( no_caps( debug_action_name(ret) ) == name ) {
      return ret;
    }
  }
  return DEBUG_ACTION_NULL;
}
Example #7
0
Interface_action lookup_interface_action(std::string name)
{
  name = no_caps(name);
  name = trim(name);
  for (int i = 0; i < IACTION_MAX; i++) {
    Interface_action ret = Interface_action(i);
    if ( no_caps( interface_action_name(ret) ) == name ) {
      return ret;
    }
  }
  return IACTION_NULL;
}
Example #8
0
Stat_id lookup_stat_id(std::string name)
{
  name = no_caps(name);
  name = trim(name);
  for (int i = 0; i < STAT_MAX; i++) {
    Stat_id ret = Stat_id(i);
    if (no_caps(stat_id_short_name(ret)) == name ||
        no_caps(stat_id_name(ret))       == name   ) {
      return ret;
    }
  }
  return STAT_NULL;
}
Example #9
0
std::vector<Body_part> get_body_part_list(std::string name)
{
  name = no_caps(name);
  name = trim(name);
  std::vector<Body_part> ret;
  if (name == "hands") {
    ret.push_back(BODY_PART_LEFT_HAND);
    ret.push_back(BODY_PART_RIGHT_HAND);
  } else if (name == "feet") {
    ret.push_back(BODY_PART_LEFT_FOOT);
    ret.push_back(BODY_PART_RIGHT_FOOT);
  } else if (name == "arms") {
    ret.push_back(BODY_PART_LEFT_ARM);
    ret.push_back(BODY_PART_RIGHT_ARM);
  } else if (name == "legs") {
    ret.push_back(BODY_PART_LEFT_LEG);
    ret.push_back(BODY_PART_RIGHT_LEG);
  } else if (name == "all") {
    for (int i = 1; i < BODY_PART_MAX; i++) {
      ret.push_back( Body_part(i) );
    }
  } else {
    Body_part bp = lookup_body_part(name);
    if (bp != BODY_PART_NULL) {
      ret.push_back(bp);
    }
  }
  return ret;
}
Example #10
0
std::string capitalize_all_words(const std::string &orig)
{
  std::string ret = orig;

  for (int i = 0; i < ret.size(); i++) {
    std::string tag_check = no_caps( ret.substr(i, 3) );
    if (tag_check == "<c=") {  // It's a tag!
// Advance until we find the end of the tag.
      while (ret[i] != '>' && i < ret.size()) {
        i++;
      }
      if (i >= ret.size()) {  // Unterminated tag, oh well
        return ret;
      }
    }
    if (ret[i] >= 'a' && ret[i] <= 'z' && (i == 0 || !is_letter(ret[i - 1]))) {
      ret[i] = ret[i] - 'a' + 'A';
    }
  }

  return ret;
}