本文整理汇总了C++中PlayerState::getStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerState::getStatus方法的具体用法?C++ PlayerState::getStatus怎么用?C++ PlayerState::getStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerState
的用法示例。
在下文中一共展示了PlayerState::getStatus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawPlayerStats
// drawPlayerStats
//---------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------
void RankView::drawPlayerStats(Surface &dest)
{
char statBuf[256];
ObjectiveInterface::updatePlayerObjectiveCounts();
std::vector<const PlayerState*> states;
for(size_t i = 0; i < PlayerInterface::getMaxPlayers(); ++i) {
PlayerState* state = PlayerInterface::getPlayerState(i);
if(state->getStatus() != _player_state_active)
continue;
states.push_back(state);
}
switch(gameconfig->gametype) {
case _gametype_objective:
std::sort(states.begin(), states.end(), StatesSortByObjectives());
break;
case _gametype_timelimit:
case _gametype_fraglimit:
std::sort(states.begin(), states.end(), StatesSortByFrags());
break;
}
unsigned int CHAR_YPIX = Surface::getFontHeight();
unsigned int entryHeight = std::max(CHAR_YPIX, UNIT_FLAGS_SURFACE.getHeight()) + 2;
iXY offset(2, 40);
iXY flagOffset(162, 40 + (int(CHAR_YPIX - UNIT_FLAGS_SURFACE.getHeight()))/2);
for(std::vector<const PlayerState*>::iterator i = states.begin();
i != states.end(); ++i) {
const PlayerState* state = *i;
snprintf(statBuf, sizeof(statBuf),
"%-20s%10i%7i%6i%10i", state->getName().substr(0,20).c_str(),
state->getKills(), state->getLosses(), state->getTotal(),
state->getObjectivesHeld());
dest.bltString(offset.x, offset.y, statBuf, state->getColor());
UNIT_FLAGS_SURFACE.setFrame(state->getFlag());
UNIT_FLAGS_SURFACE.blt( dest, flagOffset.x, flagOffset.y );
offset.y += entryHeight;
flagOffset.y += entryHeight;
}
} // end RankView::drawPlayerStats
示例2: netMessagePingRequest
void GameManager::netMessagePingRequest(const NetMessage* message)
{
const SystemPingRequest *ping_request
= (const SystemPingRequest*) message;
if(ping_request->getClientPlayerIndex() >= PlayerInterface::getMaxPlayers())
{
LOGGER.warning("Invalid pingRequest message");
return;
}
PlayerState * player;
player = PlayerInterface::getPlayer( ping_request->getClientPlayerIndex() );
SystemPingAcknowledge ping_ack;
if ( player->getStatus() == _player_state_active
&& ping_request->getClientPlayerIndex() != MIN_PLAYER_ID
)
{
SERVER->sendMessage(player->getID(), &ping_ack, sizeof(SystemPingAcknowledge));
}
}
示例3: drawPlayerStats
// drawPlayerStats
//---------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------
void RankView::drawPlayerStats( unsigned int flagHeight)
{
char statBuf[256];
states.clear();
for(size_t i = 0; i < PlayerInterface::getMaxPlayers(); ++i)
{
PlayerState* state = PlayerInterface::getPlayer(i);
if(state->getStatus() != _player_state_active)
{
continue;
}
states.push_back(state);
}
switch(gameconfig->gametype)
{
case _gametype_objective:
std::sort(states.begin(), states.end(), StatesSortByObjectives());
break;
case _gametype_timelimit:
case _gametype_fraglimit:
std::sort(states.begin(), states.end(), StatesSortByFrags());
break;
}
unsigned int CHAR_YPIX = Surface::getFontHeight();
unsigned int entryHeight = std::max(CHAR_YPIX, flagHeight) + 2;
iXY offset( 6*8, 40);
iXY flagOffset(26, 40 + (int(CHAR_YPIX - flagHeight))/2);
Surface * flag = 0;
for(std::vector<const PlayerState*>::iterator i = states.begin();
i != states.end(); ++i) {
const PlayerState* state = *i;
snprintf(statBuf, sizeof(statBuf),
"%-20s%5i%7i%7i%10i", state->getName().substr(0,20).c_str(),
state->getKills(), state->getLosses(), state->getTotal(),
state->getObjectivesHeld());
drawStringShadowed(offset.x, offset.y, statBuf, Color::white, Color::gray64);
flag = ResourceManager::getFlag(state->getFlag());
drawImage( *flag, flagOffset.x, flagOffset.y );
if ( state->getID() != PlayerInterface::getLocalPlayerIndex() )
{
bool meWithHim = PlayerInterface::isSingleAllied(PlayerInterface::getLocalPlayerIndex(), state->getID());
bool himWithMe = PlayerInterface::isSingleAllied(state->getID(), PlayerInterface::getLocalPlayerIndex());
if ( meWithHim && himWithMe )
{
drawImage( allyImage, 4, flagOffset.y );
}
else if ( meWithHim )
{
drawImage( allyRequestImage, 4, flagOffset.y );
}
else if ( himWithMe )
{
drawImage( allyOtherImage, 4, flagOffset.y );
}
else
{
drawImage( noAllyImage, 4, flagOffset.y );
}
}
offset.y += entryHeight;
flagOffset.y += entryHeight;
}
} // end RankView::drawPlayerStats