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


C++ PlayerState::getTeamID方法代码示例

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


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

示例1: addPlayer

void Team::addPlayer(PlayerID new_player)
{
    for ( PlayerID player_id = 0; player_id < PlayerInterface::getMaxPlayers(); ++player_id )
    {
        PlayerState* state = PlayerInterface::getPlayer(player_id);
        if (state->isActive())
        {
            if (state->getTeamID() == teamID
                    && (player_id != new_player))
            {
                PlayerInterface::allyplayers( player_id, new_player);
            }
        }
    }
    PlayerInterface::getPlayer(new_player)->setTeamID(teamID);
}
开发者ID:BackupTheBerlios,项目名称:netpanzer-svn,代码行数:16,代码来源:Team.cpp

示例2: getTeamObjective

short Team::getTeamObjective() const
{
    short TeamObjective = 0;
    PlayerID player_id;
 
    for ( player_id = 0; player_id < PlayerInterface::getMaxPlayers(); ++player_id )
    {
        PlayerState* state = PlayerInterface::getPlayer(player_id);
        if (state->isActive())
        {
            if (state->getTeamID() == teamID)
            {
                TeamObjective += state->getObjectivesHeld();
            }
        }
    }
    return TeamObjective;
}
开发者ID:BackupTheBerlios,项目名称:netpanzer-svn,代码行数:18,代码来源:Team.cpp

示例3: UpdateState

void tPlayerStateBox::UpdateState(bool ForceUpdate)
{
    int nbPlayer = PlayerInterface::getActivePlayerCount();
    if (GameConfig::game_teammode && ShowTeam)
        nbPlayer = TeamManager::CountPlayerinTeam(TeamNumber);

    if ((nbPlayer != Count()) || ForceUpdate) 
    {
        Clear();
        for ( int i = 0; i < PlayerInterface::getMaxPlayers(); ++i)
        {
            PlayerState* state = PlayerInterface::getPlayer(i);
            if( state->isActive() )
            {
                if (ShowTeam)
                {
                    if (state->getTeamID() == TeamNumber)
                        AddData(state->getName(), state);
                } 
                else AddData(state->getName(), state);
            }
        }
    }
}
开发者ID:LucasVini,项目名称:OldNetPanzer,代码行数:24,代码来源:tPlayerStateBox.cpp

示例4: if

void
NetworkServer::onClientDisconected(ClientSocket *s, const char * msg)
{
    LOGGER.debug("NetworkServer::onClientDisconected( %d, '%s')", s->getId(), msg ? msg : "nice");
    
    bool cleandisconnect = false;
    bool sendalert = true;
    
    if ( ServerConnectDaemon::inConnectQueue(s) )
    {
        // player was connecting and dropped.
        ServerConnectDaemon::removeClientFromQueue(s);
        sendalert = false;
        LOGGER.debug("NetworkServer::onClientDisconected player was connecting");
    }
    
    if ( NetworkInterface::receive_queue.isReady() )
    {
        unsigned long frontsave = NetworkInterface::receive_queue.front;
        while ( NetworkInterface::receive_queue.isReady() )
        {
            LOGGER.debug("NetworkServer::onClientDisconected there was a packet");
            NetPacket packet;

            NetworkInterface::receive_queue.dequeue(&packet);

            if ( packet.fromClient == s )
            {
                LOGGER.debug("NetworkServer::onClientDisconected the packet was from our friend");
                const NetMessage * netmessage = packet.getNetMessage();
                if (   netmessage->message_class == _net_message_class_connect 
                    && netmessage->message_id == _net_message_id_connect_netPanzer_client_disconnect )
                {
                    LOGGER.debug("NetworkServer::onClientDisconected so is a clean disconnect");
                    cleandisconnect = true;
                }
            }
        }
        NetworkInterface::receive_queue.front = frontsave;
    }
    
    PlayerID player_index = s->getPlayerIndex();
    
    if ( player_index != INVALID_PLAYER_ID )
    {
        PlayerState * player = PlayerInterface::getPlayer(player_index);
        bool kicked = player ? player->isKicked() : false;

        if ( player && sendalert && ! kicked)
        {
            if (GameConfig::game_teammode == true)
            ConsoleInterface::postMessage(Color::cyan, true, player->getFlag(),
                                      _("'%s' has left."),
                                      player->getName().c_str());
        }

        ObjectiveInterface::disownPlayerObjectives( player_index );
        UnitInterface::destroyPlayerUnits( player_index );
        PlayerInterface::disconnectPlayerCleanup( player_index );    

        if ( sendalert )
        {
            SystemConnectAlert scmsg;
            if ( cleandisconnect || ! msg )
            {
                scmsg.set( player_index, _connect_alert_mesg_disconnect);
            }
            else if ( kicked )
            {
                scmsg.set( player_index, _connect_alert_mesg_client_kicked);
            }
            else
            {
                scmsg.set( player_index, _connect_alert_mesg_client_drop );
            }
            SERVER->broadcastMessage(&scmsg, sizeof(scmsg));
        }
        if (GameConfig::game_teammode == true)
        {
            TeamManager::removePlayer(player->getID(), player->getTeamID());
            TeamManager::BalancedTeam();
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:netpanzer-svn,代码行数:84,代码来源:NetworkServer.cpp


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