本文整理汇总了C++中ShipRef::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ ShipRef::setAttribute方法的具体用法?C++ ShipRef::setAttribute怎么用?C++ ShipRef::setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShipRef
的用法示例。
在下文中一共展示了ShipRef::setAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Spawn
ShipRef Ship::Spawn(ItemData &data) {
uint32 shipID = Ship::_Spawn( data );
if( shipID == 0 )
return ShipRef();
ShipRef sShipRef = Ship::Load( shipID );
// Create default dynamic attributes in the AttributeMap:
sShipRef->setAttribute(AttrIsOnline, 1, true); // Is Online
sShipRef->setAttribute(AttrShieldCharge, sShipRef->getAttribute(AttrShieldCapacity), true); // Shield Charge
sShipRef->setAttribute(AttrArmorDamage, 0.0, true); // Armor Damage
sShipRef->setAttribute(AttrMass, sShipRef->type()->mass, true); // Mass
sShipRef->setAttribute(AttrRadius, sShipRef->type()->radius, true); // Radius
sShipRef->setAttribute(AttrVolume, sShipRef->type()->volume, true); // Volume
sShipRef->setAttribute(AttrCapacity, sShipRef->type()->capacity, true); // Capacity
sShipRef->setAttribute(AttrInertia, 1, true); // Inertia
sShipRef->setAttribute(AttrCharge, sShipRef->getAttribute(AttrCapacitorCapacity), true); // Set Capacitor Charge to the Capacitor Capacity
// Check for existence of some attributes that may or may not have already been loaded and set them
// to default values:
// Hull Damage
if (!(sShipRef->hasAttribute(AttrDamage)))
sShipRef->setAttribute(AttrDamage, 0, true);
// Theoretical Maximum Targeting Range
if (!(sShipRef->hasAttribute(AttrMaximumRangeCap)))
sShipRef->setAttribute(AttrMaximumRangeCap, ((double) BUBBLE_RADIUS_METERS), true);
// Maximum Armor Damage Resonance
if (!(sShipRef->hasAttribute(AttrArmorMaxDamageResonance)))
sShipRef->setAttribute(AttrArmorMaxDamageResonance, 1.0f, true);
// Maximum Shield Damage Resonance
if (!(sShipRef->hasAttribute(AttrShieldMaxDamageResonance)))
sShipRef->setAttribute(AttrShieldMaxDamageResonance, 1.0f, true);
// Warp Speed Multiplier
if (!(sShipRef.get()->hasAttribute(AttrWarpSpeedMultiplier)))
sShipRef.get()->setAttribute(AttrWarpSpeedMultiplier, 1.0f, true);
// CPU Load of the ship (new ships have zero load with no modules fitted, of course):
if (!(sShipRef.get()->hasAttribute(AttrCpuLoad)))
sShipRef.get()->setAttribute(AttrCpuLoad, 0, true);
// Power Load of the ship (new ships have zero load with no modules fitted, of course):
if (!(sShipRef.get()->hasAttribute(AttrPowerLoad)))
sShipRef.get()->setAttribute(AttrPowerLoad, 0, true);
// Warp Scramble Status of the ship (most ships have zero warp scramble status, but some already have it defined):
if (!(sShipRef.get()->hasAttribute(AttrWarpScrambleStatus)))
sShipRef.get()->setAttribute(AttrWarpScrambleStatus, 0.0, true);
// Shield Resonance
// AttrShieldEmDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrShieldEmDamageResonance)))
sShipRef.get()->setAttribute(AttrShieldEmDamageResonance, 1.0, true);
// AttrShieldExplosiveDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrShieldExplosiveDamageResonance)))
sShipRef.get()->setAttribute(AttrShieldExplosiveDamageResonance, 1.0, true);
// AttrShieldKineticDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrShieldKineticDamageResonance)))
sShipRef.get()->setAttribute(AttrShieldKineticDamageResonance, 1.0, true);
// AttrShieldThermalDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrShieldThermalDamageResonance)))
sShipRef.get()->setAttribute(AttrShieldThermalDamageResonance, 1.0, true);
// Armor Resonance
// AttrArmorEmDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrArmorEmDamageResonance)))
sShipRef.get()->setAttribute(AttrArmorEmDamageResonance, 1.0, true);
// AttrArmorExplosiveDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrArmorExplosiveDamageResonance)))
sShipRef.get()->setAttribute(AttrArmorExplosiveDamageResonance, 1.0, true);
// AttrArmorKineticDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrArmorKineticDamageResonance)))
sShipRef.get()->setAttribute(AttrArmorKineticDamageResonance, 1.0, true);
// AttrArmorThermalDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrArmorThermalDamageResonance)))
sShipRef.get()->setAttribute(AttrArmorThermalDamageResonance, 1.0, true);
// Hull Resonance
// AttrHullEmDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrHullEmDamageResonance)))
sShipRef.get()->setAttribute(AttrHullEmDamageResonance, 1.0, true);
// AttrHullExplosiveDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrHullExplosiveDamageResonance)))
sShipRef.get()->setAttribute(AttrHullExplosiveDamageResonance, 1.0, true);
// AttrHullKineticDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrHullKineticDamageResonance)))
sShipRef.get()->setAttribute(AttrHullKineticDamageResonance, 1.0, true);
// AttrHullThermalDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrHullThermalDamageResonance)))
sShipRef.get()->setAttribute(AttrHullThermalDamageResonance, 1.0, true);
// AttrTurretSlotsLeft
if (!(sShipRef.get()->hasAttribute(AttrTurretSlotsLeft)))
sShipRef.get()->setAttribute(AttrTurretSlotsLeft, 0, true);
// AttrLauncherSlotsLeft
if (!(sShipRef.get()->hasAttribute(AttrLauncherSlotsLeft)))
sShipRef.get()->setAttribute(AttrLauncherSlotsLeft, 0, true);
return sShipRef;
}