예제 #1
0
CVarRef Array::add(CVarRef key, CVarRef v, bool isKey /* = false */) {
    if (key.getRawType() == KindOfInt64) {
        return addImpl(key.getNumData(), v);
    }
    if (isKey) return addImpl(key, v);
    VarNR k(key.toKey());
    if (!k.isNull()) {
        return addImpl(k, v);
    }
    return Variant::lvalBlackHole();
}
예제 #2
0
MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr)
{
    int type = getType(ptr);

    const MWWorld::ESMStore &esmStore =
        MWBase::Environment::get().getWorld()->getStore();

    // gold needs special handling: when it is inserted into a container, the base object automatically becomes Gold_001
    // this ensures that gold piles of different sizes stack with each other (also, several scripts rely on Gold_001 for detecting player gold)
    if (MWWorld::Class::get(ptr).getName(ptr) == esmStore.get<ESM::GameSetting>().find("sGold")->getString())
    {
        MWWorld::LiveCellRef<ESM::Miscellaneous> *gold =
            ptr.get<ESM::Miscellaneous>();

        if (compare_string_ci(gold->mRef.mRefID, "gold_001")
            || compare_string_ci(gold->mRef.mRefID, "gold_005")
            || compare_string_ci(gold->mRef.mRefID, "gold_010")
            || compare_string_ci(gold->mRef.mRefID, "gold_025")
            || compare_string_ci(gold->mRef.mRefID, "gold_100"))
        {
            MWWorld::ManualRef ref(esmStore, "Gold_001");

            int count = (ptr.getRefData().getCount() == 1) ? gold->mBase->mData.mValue : ptr.getRefData().getCount();
            ref.getPtr().getRefData().setCount(count);
            for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter)
            {
                if (compare_string_ci((*iter).get<ESM::Miscellaneous>()->mRef.mRefID, "gold_001"))
                {
                    (*iter).getRefData().setCount( (*iter).getRefData().getCount() + count);
                    flagAsModified();
                    return iter;
                }
            }

            return addImpl(ref.getPtr());
        }
    }

    // determine whether to stack or not
    for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter)
    {
        if (stacks(*iter, ptr))
        {
            // stack
            iter->getRefData().setCount( iter->getRefData().getCount() + ptr.getRefData().getCount() );

            flagAsModified();
            return iter;
        }
    }
    // if we got here, this means no stacking
    return addImpl(ptr);
}
예제 #3
0
파일: Cache.cpp 프로젝트: RobinWuDev/Qt
ScriptPromise Cache::add(ScriptState* scriptState, const String& requestString, ExceptionState& exceptionState)
{
    Request* request = Request::create(scriptState->executionContext(), requestString, exceptionState);
    if (exceptionState.hadException())
        return ScriptPromise();
    return addImpl(scriptState, request);
}
예제 #4
0
    //-----------------------------------------------------------------------
    PatchMeshPtr MeshManager::createBezierPatch(const String& name, const String& groupName, 
            void* controlPointBuffer, VertexDeclaration *declaration, 
            size_t width, size_t height,
            size_t uMaxSubdivisionLevel, size_t vMaxSubdivisionLevel,
            PatchSurface::VisibleSide visibleSide, 
            HardwareBuffer::Usage vbUsage, HardwareBuffer::Usage ibUsage,
            bool vbUseShadow, bool ibUseShadow)
    {
        if (width < 3 || height < 3)
        {
            OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
                "Bezier patch require at least 3x3 control points",
                "MeshManager::createBezierPatch");
        }

        MeshPtr pMesh = getByName(name);
        if (!pMesh.isNull())
        {
            OGRE_EXCEPT(Exception::ERR_DUPLICATE_ITEM, "A mesh called " + name + 
                " already exists!", "MeshManager::createBezierPatch");
        }
        PatchMesh* pm = OGRE_NEW PatchMesh(this, name, getNextHandle(), groupName);
        pm->define(controlPointBuffer, declaration, width, height,
            uMaxSubdivisionLevel, vMaxSubdivisionLevel, visibleSide, vbUsage, ibUsage,
            vbUseShadow, ibUseShadow);
        pm->load();
        ResourcePtr res(pm);
        addImpl(res);

        return res.staticCast<PatchMesh>();
    }
예제 #5
0
    //---------------------------------------------------------------------------
    ResourcePtr GpuProgramManager::create(const String& name, const String& group, 
        GpuProgramType gptype, const String& syntaxCode, bool isManual, 
        ManualResourceLoader* loader)
    {
        // Call creation implementation
        ResourcePtr ret = ResourcePtr(
            createImpl(name, getNextHandle(), group, isManual, loader, gptype, syntaxCode));

        addImpl(ret);
        // Tell resource group manager
        ResourceGroupManager::getSingleton()._notifyResourceCreated(ret);
        return ret;
    }
예제 #6
0
	//-----------------------------------------------------------------------
    ResourcePtr ResourceManager::create(const String& name, const String& group, 
		bool isManual, ManualResourceLoader* loader, const NameValuePairList* params)
	{
		// Call creation implementation
		ResourcePtr ret = ResourcePtr(
            createImpl(name, getNextHandle(), group, isManual, loader, params));
        if (params)
            ret->setParameterList(*params);

		addImpl(ret);
		// Tell resource group manager
		ResourceGroupManager::getSingleton()._notifyResourceCreated(ret);
		return ret;

	}
    //---------------------------------------------------------------------------
    HighLevelGpuProgramPtr HighLevelGpuProgramManager::createProgram(
			const String& name, const String& groupName, 
            const String& language, GpuProgramType gptype)
    {
        ResourcePtr ret = ResourcePtr(
            getFactory(language)->create(this, name, getNextHandle(), 
            groupName, false, 0));

        HighLevelGpuProgramPtr prg = ret;
        prg->setType(gptype);
        prg->setSyntaxCode(language);

        addImpl(ret);
        // Tell resource group manager
        ResourceGroupManager::getSingleton()._notifyResourceCreated(ret);
        return prg;
    }
예제 #8
0
파일: Frame.cpp 프로젝트: bramstein/ui
	void Frame::setMenuBar(MenuBar* menuBar)
	{
		menubar = menuBar;
		addImpl(menuBar,layout::BorderLayout::NORTH);
	}
예제 #9
0
파일: Cache.cpp 프로젝트: RobinWuDev/Qt
ScriptPromise Cache::add(ScriptState* scriptState, Request* request)
{
    return addImpl(scriptState, request);
}
예제 #10
0
CVarRef Array::add(CStrRef key, CVarRef v, bool isKey /* = false */) {
    if (isKey) return addImpl(key, v);
    return addImpl(key.toKey(), v);
}
예제 #11
0
CVarRef Array::add(litstr  key, CVarRef v, bool isKey /* = false */) {
    if (isKey) return addImpl(String(key), v);
    return addImpl(String(key).toKey(), v);
}
예제 #12
0
CVarRef Array::add(int64   key, CVarRef v) {
    return addImpl(key, v);
}
예제 #13
0
파일: Container.cpp 프로젝트: bramstein/ui
/**
 * Container operations.
 */
	void Container::add(Component* comp, int constraints)
	{
		addImpl(comp,constraints);
	}
예제 #14
0
ConfigKeySet &
ConfigKeySet::add(const vespalib::string & configId)
{
    addImpl(configId, TypeTag<ConfigTypes...>());
    return *this;
}
예제 #15
0
void
ConfigKeySet::addImpl(const vespalib::string & configId, TypeTag<ConfigType, ConfigTypes...>)
{
    insert(ConfigKey::create<ConfigType>(configId));
    addImpl(configId, TypeTag<ConfigTypes...>());
}
예제 #16
0
//Формирование фабрики команд, а так же получчение указателей
//на обекты других классов
CommandFactory::CommandFactory(CPU *cpu, Memory *memory)
{
    this->impl = cpu;
    this->mMemory = memory;

    addImpl(01, new FactoryItem<CommandImplIn>());
    addImpl(02, new FactoryItem<CommandImplOut>());

    addImpl(06, new FactoryItem<CommandImplPush>());
    addImpl(07, new FactoryItem<CommandImplPop>());

    addImpl(8, new FactoryItem<CommandImplRet>());
    addImpl(19, new FactoryItem<CommandImplCall>());

    addImpl(10, new FactoryItem<CommandImplJmp>());
    addImpl(11, new FactoryItem<CommandImplJz>());
    addImpl(12, new FactoryItem<CommandImplJnz>());
    addImpl(13, new FactoryItem<CommandImplJs>());
    addImpl(14, new FactoryItem<CommandImplJns>());
    addImpl(15, new FactoryItem<CommandImplJo>());
    addImpl(16, new FactoryItem<CommandImplJno>());
    addImpl(17, new FactoryItem<CommandImplJrnz>());

    addImpl(21, new FactoryItem<CommandImplRead>());
    addImpl(22, new FactoryItem<CommandImplWrite>());
    addImpl(23, new FactoryItem<CommandImplAdd>());
    addImpl(24, new FactoryItem<CommandImplSub>());
    addImpl(25, new FactoryItem<CommandImplMul>());
    addImpl(26, new FactoryItem<CommandImplDiv>());

    addImpl(31, new FactoryItem<CommandImplReadRegister>());
    addImpl(32, new FactoryItem<CommandImplWriteRegister>());
    addImpl(33, new FactoryItem<CommandImplAddRegister>());
    addImpl(34, new FactoryItem<CommandImplSubRegister>());
    addImpl(35, new FactoryItem<CommandImplMulRegister>());
    addImpl(36, new FactoryItem<CommandImplDivRegister>());
}
예제 #17
0
Tree::Iterator Tree::add(const Data &key)
{
    void *p = 0;
    addImpl(key, p);
    return Iterator(this, p);
}