예제 #1
0
void KeyerConfigure::SetCW( TiXmlElement *e )
{
   int tone;
   int speed;
   if ( GetIntAttribute( e, "tone", tone, 1000 ) == TIXML_SUCCESS )
   {
      CWTone = tone;
   }
   if ( GetIntAttribute( e, "speed", speed, 12 ) == TIXML_SUCCESS )
   {
      CWSpeed = speed;
   }
}
예제 #2
0
static int GetIntAttribute( TiXmlElement *e, const std::string &name, int &i, int def )
{
   int ret = GetIntAttribute( e, name, i );
   if ( ret == TIXML_NO_ATTRIBUTE )
   {
      i = def;
   }
   return ret;
}
예제 #3
0
void KeyerConfigure::SetKeyers( TiXmlElement *e )
{
   /*
      void procKeyerParam( void *self, const std::string &pname, int pvalue )
      {
         lineMonitor * lm = ( lineMonitor * ) self;
         lm->procParam( pname, pvalue );
      }
   */
   for ( TiXmlElement * c = e->FirstChildElement(); c; c = c->NextSiblingElement() )
   {
      if ( checkElementName( c, "Keyer" ) )
      {
         // attribs name PipTone EnablePip StartDelay AutoRepeat PipStartDelay PlayPTTDelay
         std::string name;
         int PipTone;
         int PipLength;
         bool EnablePip;
         int StartDelay;
         int AutoRepeatDelay;
         bool EnableAutoRepeat;
         int PipStartDelay;
         int PlayPTTDelay;
         int voxHangTime;
         int pipVolume;
         int ClipRecord;

         if ( GetStringAttribute( c, "name", name ) == TIXML_SUCCESS )
         {
            GetIntAttribute( c, "pipTone", PipTone, 1000 );
            GetIntAttribute( c, "pipLength", PipLength, 250 );
            GetBoolAttribute( c, "enablePip", EnablePip, false );
            GetIntAttribute( c, "pipStartDelay", PipStartDelay, 0 );
            GetIntAttribute( c, "pipVolume", pipVolume, 80 );
            GetIntAttribute( c, "startDelay", StartDelay, 0 );
            GetIntAttribute( c, "autoRepeat", AutoRepeatDelay, 6 );
            GetBoolAttribute( c, "enableAutoRepeat", EnableAutoRepeat, false );
            GetIntAttribute( c, "playPTTDelay", PlayPTTDelay, 0 );
            GetIntAttribute( c, "voxHangTime", voxHangTime, 0 );
            GetIntAttribute( c, "clipRecord", ClipRecord, 0 );

            KeyerConfig k( name, PipTone, pipVolume, PipLength, EnablePip, StartDelay,
                           AutoRepeatDelay, EnableAutoRepeat, PipStartDelay, PlayPTTDelay, voxHangTime,
                           ClipRecord );
            keyermap[ name ] = k;
         }
      }
   }
}
예제 #4
0
///=====================================================
/// 
///=====================================================
TeleportBehavior::TeleportBehavior(const std::string& name, const XMLNode& behaviorNode) :
BaseAIBehavior(name, BehaviorType::Attack, behaviorNode),
m_healthThreshold(0.0f),
m_chance(0.0f),
m_phrase("casts Teleport"),
m_numUses(-1){
	m_healthThreshold = GetFloatAttribute(behaviorNode, "healthThreshold", m_healthThreshold);
	m_chance = GetFloatAttribute(behaviorNode, "chance", m_chance);
	m_phrase = GetStringAttribute(behaviorNode, "phrase", m_phrase);
	m_numUses = GetIntAttribute(behaviorNode, "numUses", m_numUses);
}
예제 #5
0
void KeyerConfigure::SetTune( TiXmlElement *e )
{
   int tval;
   if ( GetIntAttribute( e, "time", tval, 20 ) == TIXML_SUCCESS )
   {
      if ( tval > 0 && tval <= 30 )
         tuneTime = tval;
      else
      {
         trace( "Incorrect argument to attribute `Tune Time' - must be > 0 and <= 30 (secs)" );
      }
   }
   if ( GetIntAttribute( e, "level", tval, 80 ) == TIXML_SUCCESS )
   {
      if ( tval > 0 && tval <= 100 )
         tuneLevel = tval;
      else
      {
         trace( "Incorrect argument to attribute `Tune Level' - must be > 0 and <= 100 (%)" );
      }
   }
}
예제 #6
0
NS_IMETHODIMP
nsMsgIdentity::GetReceiptHeaderType(PRInt32 *aType)
{
    NS_ENSURE_ARG_POINTER(aType);

    bool useCustomPrefs = false;
    nsresult rv = GetBoolAttribute("use_custom_prefs", &useCustomPrefs);
    NS_ENSURE_SUCCESS(rv, rv);
    if (useCustomPrefs)
        return GetIntAttribute("request_receipt_header_type", aType);

    nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
    NS_ENSURE_SUCCESS(rv, rv);
    return prefs->GetIntPref("mail.receipt.request_header_type", aType);
}
예제 #7
0
파일: Item.cpp 프로젝트: asocha/Dagger
///=====================================================
/// 
///=====================================================
Item::Item(const XMLNode& itemNode, OpenGLRenderer* renderer) :
Entity(itemNode, renderer),
m_type(Undefined),
m_equippedSlot(Unequippable),
m_damageReductionPercent(0.0f),
m_numUses(1),
m_healing(0),
m_damage(0, 0){
	m_name = GetStringAttribute(itemNode, "name");

	std::string itemType = GetStringAttribute(itemNode, "type");

	m_damageReductionPercent = GetFloatAttribute(itemNode, "damageReductionPercent", m_damageReductionPercent);
	m_numUses = GetIntAttribute(itemNode, "numUses", m_numUses);
	m_healing = GetIntAttribute(itemNode, "healing", m_healing);
	m_damage = IntVec2(GetIntAttribute(itemNode, "minDamage", m_damage.x), GetIntAttribute(itemNode, "maxDamage", m_damage.y));

	RGBAchars defaultColor = RGBAchars::WHITE;
	char defaultGlyph = ':';

	if (itemType == "Weapon"){
		m_type = ItemType::Weapon;
	}
	else if (itemType == "Armor"){
		m_type = ItemType::Armor;
	}
	else if (itemType == "Consumable"){
		m_type = ItemType::Consumable;
	}
	else{ //unknown item
		assert(false);
	}

	if (m_type != ItemType::Undefined){
		defaultColor = ITEM_COLOR_TABLE[m_type];
		defaultGlyph = ITEM_SYMBOL_TABLE[m_type];
	}


	std::string itemEquipSlot = GetStringAttribute(itemNode, "equip");

	if (itemEquipSlot == "Weapon"){
		m_equippedSlot = EquipmentSlot::WeaponSlot;
	}
	else if (itemEquipSlot == "Chest"){
		m_equippedSlot = EquipmentSlot::Chest;
	}
	else if (itemEquipSlot == "Head"){
		m_equippedSlot = EquipmentSlot::Head;
	}
	else if (itemEquipSlot == "Ring"){
		m_equippedSlot = EquipmentSlot::Ring;
	}
	else if (itemEquipSlot == "Hands"){
		m_equippedSlot = EquipmentSlot::Hands;
	}
	else if (itemEquipSlot == "Feet"){
		m_equippedSlot = EquipmentSlot::Feet;
	}
	else if (itemEquipSlot == "Legs"){
		m_equippedSlot = EquipmentSlot::Legs;
	}

	m_glyph = GetCharAttribute(itemNode, "glyph", defaultGlyph);
	m_color = GetColorAttribute(itemNode, "color", defaultColor);

	m_textRenderer.SetInputString(std::string(1, m_glyph));
	m_textRenderer.SetInputStringColor(m_color);
}