本文整理汇总了C++中PlayerState::getFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerState::getFlag方法的具体用法?C++ PlayerState::getFlag怎么用?C++ PlayerState::getFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerState
的用法示例。
在下文中一共展示了PlayerState::getFlag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Vehicle
UnitBase * UnitInterface::newUnit( unsigned short unit_type,
const iXY &location,
unsigned short player_index,
UnitID id)
{
UnitBase* unit = 0;
bool color_flag;
unsigned char unit_flag;
if ( player_index == PlayerInterface::getLocalPlayerIndex() ) {
color_flag = true;
} else {
color_flag = false;
}
PlayerState* player = PlayerInterface::getPlayer( player_index );
unit_flag = player->getFlag();
if ( unit_type < UnitProfileInterface::getNumUnitTypes() )
{
unit = new Vehicle(player, unit_type, id, location);
}
else
{ // XXX change for a error window
assert("unknown unit_type" == 0);
}
return unit;
}
示例2: onPaint
void tPlayerStateBox::onPaint(Surface &dst, const DataItem& data)
{
char statBuf[256];
int StartX = 1;
PlayerState *state = (PlayerState*)(data.Data);
if (DrawFlags)
{
Surface * flag = 0;
flag = ResourceManager::getFlag(state->getFlag());
flag->blt(dst, 0, 0);
StartX = flag->getWidth()+4;
}
snprintf(statBuf, sizeof(statBuf), "%-20s", state->getName().c_str());
dst.bltString(StartX , 4, statBuf, ctTexteNormal);
}
示例3: while
void
NetworkServer::onClientDisconected(ClientSocket *s, const char * msg)
{
LOGGER.debug("NetworkServer::onClientDisconected( %d, '%s')", s->getId(), msg);
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();
ClientList::iterator i = client_list.begin();
while ( i != client_list.end() )
{
if ( (*i)->client_socket == s )
{
LOGGER.debug("NetworkServer:onClientDisconnected found client in list, preparing to die [%d]", player_index);
(*i)->wannadie = true;
break;
}
++i;
}
if ( player_index != INVALID_PLAYER_ID )
{
PlayerState * player = PlayerInterface::getPlayer(player_index);
if ( player && sendalert )
{
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 msg;
if ( cleandisconnect )
{
msg.set( player_index, _connect_alert_mesg_disconnect);
}
else
{
msg.set( player_index, _connect_alert_mesg_client_drop );
}
SERVER->broadcastMessage(&msg, sizeof(msg));
}
}
// LOGGER.warning("NetworkServer::onClientDisconected( %d, '%s')", s->getId(), msg);
}
示例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();
}
}
}