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


C++ Shuttle::getInPortTime方法代码示例

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


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

示例1: _handleShuttleUpdate

bool WorldManager::_handleShuttleUpdate(uint64 callTime,void* ref)
{
    ShuttleList::iterator shuttleIt = mShuttleList.begin();
    while(shuttleIt != mShuttleList.end())
    {
        Shuttle* shuttle = (*shuttleIt);

        // The Ticket Collector need a valid shuttle-object.
        if (!shuttle->ticketCollectorEnabled())
        {
            TicketCollector* collector = dynamic_cast<TicketCollector*>(getObjectById(shuttle->getCollectorId()));
            if (collector)
            {
                if (!collector->getShuttle())
                {
                    // Enable the collector.
                    collector->setShuttle(shuttle);
                }
                shuttle->ticketCollectorEnable();
            }
        }

        switch(shuttle->getShuttleState())
        {
        case ShuttleState_Away:
        {
            uint32 awayTime = shuttle->getAwayTime() + 1000;
            if(awayTime >= shuttle->getAwayInterval())
            {
                uint32 awayTime = shuttle->getAwayTime() + 1000;
                if(awayTime >= shuttle->getAwayInterval())
                {
                    shuttle->states.setPosture(0);
                    shuttle->setAwayTime(0);
                    shuttle->setShuttleState(ShuttleState_AboutBoarding);
                    gMessageLib->sendPostureUpdate(shuttle);
                    gMessageLib->sendCombatAction(shuttle,NULL,opChange_Posture);
                }
            }
            else
                shuttle->setAwayTime(awayTime);
        }
        break;

        case ShuttleState_Landing:
        {
            uint32 landingTime = shuttle->getLandingTime() + 1000;

            if(landingTime >= SHUTTLE_LANDING_ANIMATION_TIME - 5000)
            {
                shuttle->setShuttleState(ShuttleState_AboutBoarding);
            }
            else
                shuttle->setLandingTime(landingTime);
        }
        break;

        case ShuttleState_AboutBoarding:
        {
            uint32 landingTime = shuttle->getLandingTime() + 1000;

            if(landingTime >= SHUTTLE_LANDING_ANIMATION_TIME)
            {
                shuttle->setLandingTime(0);

                shuttle->setShuttleState(ShuttleState_InPort);
            }
            else
                shuttle->setLandingTime(landingTime);
        }
        break;

        case ShuttleState_InPort:
        {
            uint32 inPortTime = shuttle->getInPortTime() + 1000;
            if(inPortTime >= shuttle->getInPortInterval())
            {
                uint32 inPortTime = shuttle->getInPortTime() + 1000;
                if(inPortTime >= shuttle->getInPortInterval())
                {
                    shuttle->setInPortTime(0);
                    shuttle->setShuttleState(ShuttleState_Away);
                    shuttle->states.setPosture(2);
                    gMessageLib->sendPostureUpdate(shuttle);
                    gMessageLib->sendCombatAction(shuttle,NULL,opChange_Posture);
                }
            }
            else
            {
                shuttle->setInPortTime(inPortTime);
            }
        }
        break;

        default:
            break;
        }

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


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