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


C++ ShipRef::get方法代码示例

本文整理汇总了C++中ShipRef::get方法的典型用法代码示例。如果您正苦于以下问题:C++ ShipRef::get方法的具体用法?C++ ShipRef::get怎么用?C++ ShipRef::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ShipRef的用法示例。


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

示例1: Spawn

ShipRef Ship::Spawn(ItemFactory &factory, ItemData &data) {
    uint32 shipID = Ship::_Spawn( factory, data );
    if( shipID == 0 )
        return ShipRef();

    ShipRef sShipRef = Ship::Load( factory, shipID );

    // Create default dynamic attributes in the AttributeMap:
    sShipRef->SetAttribute(AttrIsOnline,            1);                                             // Is Online
    sShipRef->SetAttribute(AttrShieldCharge,        sShipRef->GetAttribute(AttrShieldCapacity));    // Shield Charge
    sShipRef->SetAttribute(AttrArmorDamage,         0.0);                                           // Armor Damage
    sShipRef->SetAttribute(AttrMass,                sShipRef->type().attributes.mass());            // Mass
    sShipRef->SetAttribute(AttrRadius,              sShipRef->type().attributes.radius());          // Radius
    sShipRef->SetAttribute(AttrVolume,              sShipRef->type().attributes.volume());          // Volume
    sShipRef->SetAttribute(AttrCapacity,            sShipRef->type().attributes.capacity());        // Capacity
    sShipRef->SetAttribute(AttrInertia,             1);                                             // Inertia
    sShipRef->SetAttribute(AttrCharge,              sShipRef->GetAttribute(AttrCapacitorCapacity)); // 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:
    // Maximum Range Capacitor
    if( !(sShipRef->HasAttribute(AttrMaximumRangeCap)) )
        sShipRef->SetAttribute(AttrMaximumRangeCap, 249999.0 );
    // Maximum Armor Damage Resonance
    if( !(sShipRef->HasAttribute(AttrArmorMaxDamageResonance)) )
        sShipRef->SetAttribute(AttrArmorMaxDamageResonance, 1.0f);
    // Maximum Shield Damage Resonance
    if( !(sShipRef->HasAttribute(AttrShieldMaxDamageResonance)) )
        sShipRef->SetAttribute(AttrShieldMaxDamageResonance, 1.0f);
    // Warp Speed Multiplier
    if( !(sShipRef.get()->HasAttribute(AttrWarpSpeedMultiplier)) )
        sShipRef.get()->SetAttribute(AttrWarpSpeedMultiplier, 1.0f);

	//Save Ship To Database.
	sShipRef->SaveShip();

    return sShipRef;
}
开发者ID:Logomorph,项目名称:evemu_crucible,代码行数:38,代码来源:Ship.cpp

示例2: Spawn

InventoryItemRef InventoryItem::Spawn(ItemFactory &factory, ItemData &data)
{
    // obtain type of new item
    const ItemType *t = factory.GetType( data.typeID );
    if( t == NULL )
        return InventoryItemRef();

    // See what to do next:
    switch( t->categoryID() ) {
        //! TODO not handled.
        case EVEDB::invCategories::_System:
        case EVEDB::invCategories::Station:
        case EVEDB::invCategories::Material:
        case EVEDB::invCategories::Accessories:
        case EVEDB::invCategories::Charge:
        case EVEDB::invCategories::Trading:
        case EVEDB::invCategories::Bonus:
        case EVEDB::invCategories::Commodity:
        case EVEDB::invCategories::Implant:
        case EVEDB::invCategories::Reaction:
             break;

		///////////////////////////////////////
        // Entity:
        ///////////////////////////////////////
        case EVEDB::invCategories::Entity: {
			// Spawn generic item for Entities at this time:
			uint32 itemID = InventoryItem::_SpawnEntity( factory, data );
			if( itemID == 0 )
				return InventoryItemRef();
			InventoryItemRef itemRef = InventoryItem::LoadEntity( factory, itemID, data );
			return itemRef;
		}

		///////////////////////////////////////
        // Blueprint:
        ///////////////////////////////////////
        case EVEDB::invCategories::Blueprint: {
            BlueprintData bdata; // use default blueprint attributes

            BlueprintRef blueRef = Blueprint::Spawn( factory, data, bdata );
            blueRef.get()->SaveAttributes();

            return blueRef;
        }

        ///////////////////////////////////////
        // Celestial:
        // (used for Cargo Containers, Rings, and Biomasses, Wrecks, Large Collidable Objects, Clouds,
        //  Cosmic Signatures, Mobile Sentry Guns, Global Warp Disruptors, Agents in Space, Cosmic Anomaly, Beacons, Wormholes,
        //  and other celestial static objects such as NPC stations, stars, moons, planets, and stargates)
        ///////////////////////////////////////
        case EVEDB::invCategories::Celestial: {
            if ( (t->groupID() == EVEDB::invGroups::Secure_Cargo_Container)
                || (t->groupID() == EVEDB::invGroups::Cargo_Container)
                || (t->groupID() == EVEDB::invGroups::Freight_Container)
                || (t->groupID() == EVEDB::invGroups::Audit_Log_Secure_Container)
                || (t->groupID() == EVEDB::invGroups::Spawn_Container)
                || (t->groupID() == EVEDB::invGroups::Wreck) )
            {
                // Spawn new Cargo Container
                uint32 itemID = CargoContainer::_Spawn( factory, data );
                if( itemID == 0 )
                    return CargoContainerRef();

                CargoContainerRef cargoRef = CargoContainer::Load( factory, itemID );

                // THESE SHOULD BE MOVED INTO A CargoContainer::Spawn() function that does not exist yet
                // Create default dynamic attributes in the AttributeMap:
                cargoRef.get()->SetAttribute(AttrIsOnline,      1);                                                 // Is Online
                cargoRef.get()->SetAttribute(AttrDamage,        0.0);                                               // Structure Damage
                //cargoRef.get()->SetAttribute(AttrShieldCharge,  cargoRef.get()->GetAttribute(AttrShieldCapacity));  // Shield Charge
                //cargoRef.get()->SetAttribute(AttrArmorDamage,   0.0);                                               // Armor Damage
                cargoRef.get()->SetAttribute(AttrMass,          cargoRef.get()->type().attributes.mass());          // Mass
                cargoRef.get()->SetAttribute(AttrRadius,        cargoRef.get()->type().attributes.radius());        // Radius
                cargoRef.get()->SetAttribute(AttrVolume,        cargoRef.get()->type().attributes.volume());        // Volume
                cargoRef.get()->SetAttribute(AttrCapacity,      cargoRef.get()->type().attributes.capacity());      // Capacity
                cargoRef.get()->SaveAttributes();

                return cargoRef;
                //uint32 itemID = InventoryItem::_Spawn( factory, data );
                //if( itemID == 0 )
                //    return InventoryItemRef();
                //return InventoryItem::Load( factory, itemID );
            }
            else
            {
                // Spawn new Celestial Object
                uint32 itemID = CelestialObject::_Spawn( factory, data );
                if( itemID == 0 )
                    return CelestialObjectRef();
                CelestialObjectRef celestialRef = CelestialObject::Load( factory, itemID );
                celestialRef.get()->SaveAttributes();

                return celestialRef;
            }
        }

        ///////////////////////////////////////
        // Ship:
//.........这里部分代码省略.........
开发者ID:careysky,项目名称:evemu_server,代码行数:101,代码来源:InventoryItem.cpp

示例3: 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;
}
开发者ID:eve-moo,项目名称:evemu_server,代码行数:96,代码来源:Ship.cpp

示例4: Spawn

ShipRef Ship::Spawn(ItemFactory &factory, ItemData &data) {
    uint32 shipID = Ship::_Spawn( factory, data );
    if( shipID == 0 )
        return ShipRef();

    ShipRef sShipRef = Ship::Load( factory, shipID );

    // Create default dynamic attributes in the AttributeMap:
    sShipRef->SetAttribute(AttrIsOnline,            1);                                             // Is Online
    sShipRef->SetAttribute(AttrShieldCharge,        sShipRef->GetAttribute(AttrShieldCapacity));    // Shield Charge
    sShipRef->SetAttribute(AttrArmorDamage,         0.0);                                           // Armor Damage
    sShipRef->SetAttribute(AttrMass,                sShipRef->type().attributes.mass());            // Mass
    sShipRef->SetAttribute(AttrRadius,              sShipRef->type().attributes.radius());          // Radius
    sShipRef->SetAttribute(AttrVolume,              sShipRef->type().attributes.volume());          // Volume
    sShipRef->SetAttribute(AttrCapacity,            sShipRef->type().attributes.capacity());        // Capacity
    sShipRef->SetAttribute(AttrInertia,             1);                                             // Inertia
    sShipRef->SetAttribute(AttrCharge,              sShipRef->GetAttribute(AttrCapacitorCapacity)); // 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 );
    // Maximum Range Capacitor
    if( !(sShipRef->HasAttribute(AttrMaximumRangeCap)) )
        sShipRef->SetAttribute(AttrMaximumRangeCap, 249999.0 );
    // Maximum Armor Damage Resonance
    if( !(sShipRef->HasAttribute(AttrArmorMaxDamageResonance)) )
        sShipRef->SetAttribute(AttrArmorMaxDamageResonance, 1.0f);
    // Maximum Shield Damage Resonance
    if( !(sShipRef->HasAttribute(AttrShieldMaxDamageResonance)) )
        sShipRef->SetAttribute(AttrShieldMaxDamageResonance, 1.0f);
    // Warp Speed Multiplier
    if( !(sShipRef.get()->HasAttribute(AttrWarpSpeedMultiplier)) )
        sShipRef.get()->SetAttribute(AttrWarpSpeedMultiplier, 1.0f);
    // 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);
    // 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);
	// 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);

	// AttrHullEmDamageResonance
	if( !(sShipRef.get()->HasAttribute(AttrHullEmDamageResonance)) )
		sShipRef.get()->SetAttribute(AttrHullEmDamageResonance, 0.0);
	// AttrHullExplosiveDamageResonance
	if( !(sShipRef.get()->HasAttribute(AttrHullExplosiveDamageResonance)) )
		sShipRef.get()->SetAttribute(AttrHullExplosiveDamageResonance, 0.0);
	// AttrHullKineticDamageResonance
	if( !(sShipRef.get()->HasAttribute(AttrHullKineticDamageResonance)) )
		sShipRef.get()->SetAttribute(AttrHullKineticDamageResonance, 0.0);
	// AttrHullThermalDamageResonance
	if( !(sShipRef.get()->HasAttribute(AttrHullThermalDamageResonance)) )
		sShipRef.get()->SetAttribute(AttrHullThermalDamageResonance, 0.0);

	// AttrTurretSlotsLeft
	if( !(sShipRef.get()->HasAttribute(AttrTurretSlotsLeft)) )
		sShipRef.get()->SetAttribute(AttrTurretSlotsLeft, 0);
	// AttrLauncherSlotsLeft
	if( !(sShipRef.get()->HasAttribute(AttrLauncherSlotsLeft)) )
		sShipRef.get()->SetAttribute(AttrLauncherSlotsLeft, 0);

    return sShipRef;
}
开发者ID:Reve,项目名称:evemu_retribution,代码行数:67,代码来源:Ship.cpp

示例5: Spawn

ShipRef Ship::Spawn(ItemFactory &factory,
    // InventoryItem stuff:
    ItemData &data
) {
    uint32 shipID = Ship::_Spawn( factory, data );
    if( shipID == 0 )
        return ShipRef();

    ShipRef sShipRef = Ship::Load( factory, shipID );

    // Create default dynamic attributes in the AttributeMap:
    sShipRef.get()->SetAttribute(AttrIsOnline,      1);                                                 // Is Online
    sShipRef.get()->SetAttribute(AttrShieldCharge,  sShipRef.get()->GetAttribute(AttrShieldCapacity));  // Shield Charge
    sShipRef.get()->SetAttribute(AttrArmorDamage,   0.0);                                               // Armor Damage
    sShipRef.get()->SetAttribute(AttrMass,          sShipRef.get()->type().attributes.mass());          // Mass
    sShipRef.get()->SetAttribute(AttrRadius,        sShipRef.get()->type().attributes.radius());        // Radius
    sShipRef.get()->SetAttribute(AttrVolume,        sShipRef.get()->type().attributes.volume());        // Volume
    sShipRef.get()->SetAttribute(AttrCapacity,      sShipRef.get()->type().attributes.capacity());      // Capacity
    sShipRef.get()->SetAttribute(AttrInertia,       1);                                                 // Inertia

    return sShipRef;
}
开发者ID:MurdockGT,项目名称:evemu-incursion,代码行数:22,代码来源:Ship.cpp


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