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


C++ Datapad::setLoadState方法代码示例

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


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

示例1: handleDatabaseJobComplete

void DatapadFactory::handleDatabaseJobComplete(void* ref,DatabaseResult* result)
{
    QueryContainerBase* asyncContainer = reinterpret_cast<QueryContainerBase*>(ref);

    switch(asyncContainer->mQueryType)
    {
    case DPFQuery_MainDatapadData:
    {
        //get the count of all Waypoints and Schematics
        Datapad* datapad = _createDatapad(result);

        QueryContainerBase* asContainer = new(mQueryContainerPool.ordered_malloc()) QueryContainerBase(asyncContainer->mOfCallback,DPFQuery_ObjectCount,asyncContainer->mClient);
        asContainer->mObject = datapad;

        mDatabase->executeSqlAsync(this,asContainer,"SELECT %s.sf_getDatapadObjectCount(%" PRIu64 ")",mDatabase->galaxy(),datapad->getId());
       
    }
    break;

    case DPFQuery_ObjectCount:
    {
        Datapad* datapad = dynamic_cast<Datapad*>(asyncContainer->mObject);

        uint32 objectCount;
        DataBinding* binding = mDatabase->createDataBinding(1);

        binding->addField(DFT_uint32,0,4);
        result->getNextRow(binding,&objectCount);

        datapad->setObjectLoadCounter(objectCount);

        if(objectCount != 0)
        {
            uint64 dtpId = datapad->getId();

            datapad->setLoadState(LoadState_Loading);

            // query contents
            QueryContainerBase* asContainer = new(mQueryContainerPool.ordered_malloc()) QueryContainerBase(asyncContainer->mOfCallback,DPFQuery_Objects,asyncContainer->mClient);
            asContainer->mObject = datapad;

            mDatabase->executeSqlAsync(this,asContainer,
                                       "(SELECT \'waypoints\',waypoints.waypoint_id FROM %s.waypoints WHERE owner_id = %" PRIu64 ")"
                                       " UNION (SELECT \'manschematics\',items.id FROM %s.items WHERE (parent_id=%" PRIu64 "))"
                                       " UNION (SELECT \'vehicles\',vehicles.id FROM %s.vehicles WHERE (parent=%" PRIu64 "))",
                                       mDatabase->galaxy(),dtpId-3,
                                       mDatabase->galaxy(),dtpId,
                                       mDatabase->galaxy(),dtpId);

        }
        else
        {
            datapad->setLoadState(LoadState_Loaded);
            asyncContainer->mOfCallback->handleObjectReady(datapad,asyncContainer->mClient);
        }

        mDatabase->destroyDataBinding(binding);
    }
    break;

    case DPFQuery_ItemId:
    {
        uint64 id;
        DataBinding* binding = mDatabase->createDataBinding(1);

        binding->addField(DFT_uint64,0,8);
        result->getNextRow(binding,&id);

        gTangibleFactory->requestObject(this,id,TanGroup_Item,0,asyncContainer->mClient);
        mDatabase->destroyDataBinding(binding);
    }
    break;

    case DPFQuery_MSParent:
    {
        uint64 id;
        DataBinding* binding = mDatabase->createDataBinding(1);

        binding->addField(DFT_uint64,0,8);
        result->getNextRow(binding,&id);

        PlayerObject* player = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(id-3));
        if(!player)
        {
            //factoryPanic!!!!!!!!
        	LOG(warning) << "Failed getting player to create MS";
            return;
        }

        Datapad* datapad = player->getDataPad();

        if(!datapad)
        {
            //factoryPanic!!!!!!!!
        	LOG(error) << "Failed getting datapad to create MS";
            return;
        }
        mObjectLoadMap.insert(std::make_pair(datapad->getId(),new(mILCPool.ordered_malloc()) InLoadingContainer(datapad,datapad,NULL,1)));
        gTangibleFactory->requestObject(this,asyncContainer->mId,TanGroup_Item,0,NULL);

//.........这里部分代码省略.........
开发者ID:schizix,项目名称:mmoserver,代码行数:101,代码来源:DatapadFactory.cpp


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