本文整理汇总了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);
}
示例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;
}
示例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);
}
}
}
}
示例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();
}
}
}