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


C++ ItemFactory::GetType方法代码示例

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


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

示例1: Spawn

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

	switch( t->groupID() )
	{
		///////////////////////////////////////
		// Character:
		///////////////////////////////////////
		case EVEDB::invGroups::Character: {
			// we're not gonna create character from default attributes ...
			_log( ITEM__ERROR, "Refusing to create character '%s' from default attributes.", data.name.c_str() );

			return OwnerRef();
		}
	}

	// fallback to default:
	uint32 ownerID = Owner::_Spawn( factory, data );
	if( ownerID == 0 )
		return OwnerRef();
	return Owner::Load( factory, ownerID );
}
开发者ID:MurdockGT,项目名称:evemu-incursion,代码行数:26,代码来源:Owner.cpp

示例2: LoadEntity

InventoryItemRef InventoryItem::LoadEntity(ItemFactory &factory, uint32 itemID, const ItemData &data)
{
    const ItemType *type = factory.GetType( data.typeID );

	InventoryItemRef itemRef = InventoryItemRef( new InventoryItem(factory, itemID, *type, data) );

	itemRef->_Load();

	return itemRef;
}
开发者ID:careysky,项目名称:evemu_server,代码行数:10,代码来源:InventoryItem.cpp

示例3: _Spawn

uint32 Skill::_Spawn(ItemFactory &factory, ItemData &data)
{
    // check it's a skill
    const ItemType *type = factory.GetType( data.typeID );
    if( type == NULL )
        return 0;

    if( type->categoryID() != EVEDB::invCategories::Skill )
    {
        _log( ITEM__ERROR, "Trying to spawn %s as Skill.", type->category().name().c_str() );
        return 0;
    }

    // spawn item, nothing else
    return InventoryItem::_Spawn( factory, data );
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:16,代码来源:Skill.cpp

示例4: _SpawnEntity

// This Spawn function is meant for in-memory only items created from the
// EVEDB::invCategories::Entity category, items meant to never be saved to database
// and be thrown away on server shutdown.
uint32 InventoryItem::_SpawnEntity(ItemFactory &factory,
    // InventoryItem stuff:
    ItemData &data
) {
    // obtain type of new item
    // this also checks that the type is valid
    const ItemType *t = factory.GetType(data.typeID);
    if(t == NULL)
        return 0;

    // fix the name (if empty)
    if(data.name.empty())
        data.name = t->name();

    // Get a new Entity ID from ItemFactory's ID Authority:
	return factory.GetNextEntityID();
}
开发者ID:careysky,项目名称:evemu_server,代码行数:20,代码来源:InventoryItem.cpp

示例5: _Spawn

uint32 InventoryItem::_Spawn(ItemFactory &factory,
    // InventoryItem stuff:
    ItemData &data
) {
    // obtain type of new item
    // this also checks that the type is valid
    const ItemType *t = factory.GetType(data.typeID);
    if(t == NULL)
        return 0;

    // fix the name (if empty)
    if(data.name.empty())
        data.name = t->name();

    // insert new entry into DB
    return factory.db().NewItem(data);
}
开发者ID:careysky,项目名称:evemu_server,代码行数:17,代码来源:InventoryItem.cpp

示例6: _Spawn

uint32 Structure::_Spawn(ItemFactory &factory,
    // InventoryItem stuff:
    ItemData &data
) {
    // make sure it's a Structure
    const ItemType *st = factory.GetType(data.typeID);
    if(st == NULL)
        return 0;

    // store item data
    uint32 structureID = InventoryItem::_Spawn(factory, data);
    if(structureID == 0)
        return 0;

    // nothing additional

    return structureID;
}
开发者ID:Logomorph,项目名称:evemu_crucible,代码行数:18,代码来源:Structure.cpp

示例7: _Spawn

uint32 CargoContainer::_Spawn(ItemFactory &factory,
    // InventoryItem stuff:
    ItemData &data
) {
    // make sure it's a cargo container
    const ItemType *st = factory.GetType(data.typeID);
    if(st == NULL)
        return 0;

    // store item data
    uint32 containerID = InventoryItem::_Spawn(factory, data);
    if(containerID == 0)
        return 0;

    // nothing additional

    return containerID;
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:18,代码来源:Container.cpp

示例8: _Spawn

uint32 Station::_Spawn(ItemFactory &factory,
    // InventoryItem stuff:
    ItemData &data
) {
    // make sure it's a Station
    const ItemType *item = factory.GetType(data.typeID);
    if( !(item->categoryID() == EVEDB::invCategories::Station) )
        return 0;

    // store item data
    uint32 stationID = InventoryItem::_Spawn(factory, data);
    if( stationID == 0 )
        return 0;

    // nothing additional

    return stationID;
}
开发者ID:Almamu,项目名称:evemu_apocrypha,代码行数:18,代码来源:Station.cpp

示例9: _Spawn

uint32 CelestialObject::_Spawn(ItemFactory &factory,
    // InventoryItem stuff:
    ItemData &data
) {
    // make sure it's a ship
    const ItemType *item = factory.GetType(data.typeID);
    if( !(item->categoryID() == EVEDB::invCategories::Celestial) )
        return 0;

    // store item data
    uint32 celestialID = InventoryItem::_Spawn(factory, data);
    if( celestialID == 0 )
        return 0;

    // nothing additional

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

示例10: 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


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