本文整理汇总了C++中PlayerState::isKicked方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerState::isKicked方法的具体用法?C++ PlayerState::isKicked怎么用?C++ PlayerState::isKicked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerState
的用法示例。
在下文中一共展示了PlayerState::isKicked方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
}