本文整理汇总了C++中PlayerState::getLosses方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerState::getLosses方法的具体用法?C++ PlayerState::getLosses怎么用?C++ PlayerState::getLosses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerState
的用法示例。
在下文中一共展示了PlayerState::getLosses方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inputLoop
//-----------------------------------------------------------------
void DedicatedGameManager::inputLoop()
{
// handle server commands
SDL_mutexP(commandqueue_mutex);
while(!commandqueue.empty()) {
const ServerCommand& command = commandqueue.front();
switch(command.type) {
case ServerCommand::QUIT:
{
ActionManager::runAction("quit");
break;
}
case ServerCommand::CHAT:
{
ChatInterface::serversay(command.argument.c_str());
break;
}
case ServerCommand::STATUS:
{
//*Console::server
std::cout
<< "Server " << *GameConfig::server_name
<< " version " << PACKAGE_VERSION << " port "
<< GameConfig::server_port << "\n"
<< "Map: " << *GameConfig::game_map << "\n"
<< std::setw(3) << "ID" << " "
<< std::setw(30) << "Name" << " "
<< std::setw(4) << "Kill" << " "
<< std::setw(4) << "Lost" << " "
<< std::setw(5) << "Score" << " "
<< std::setw(21) << "IP\n";
PlayerID i;
for ( i = 0; i<PlayerInterface::getMaxPlayers(); ++i)
{
PlayerState* playerstate = PlayerInterface::getPlayer(i);
if ( playerstate->isActive() )
{
//*Console::server
std::cout
<< std::setw(3) << static_cast<int>(i) << " "
<< std::setw(30) << playerstate->getName() << " "
<< std::setw(4) << playerstate->getKills() << " "
<< std::setw(4) << playerstate->getLosses() << " "
<< std::setw(5) << playerstate->getTotal() << " "
<< std::setw(21)
<< SERVER->getIP(playerstate->getID())
<< "\n";
}
}
//*Console::server << std::flush;
std::cout << std::flush;
break;
}
case ServerCommand::MAPCHANGE:
if(!MapsManager::existsMap(command.argument)) {
std::cout << "map '" << command.argument
<< "' doesn't exist." << std::endl;
break;
}
GameControlRulesDaemon::forceMapChange(command.argument);
std::cout << "Preparing mapchange..." << std::endl;
break;
case ServerCommand::KICK:
std::stringstream idstream(command.argument);
PlayerID id = INVALID_PLAYER_ID;
idstream >> (int&)id; // XXX KREMOVE
if(id >= PlayerInterface::getMaxPlayers()) {
std::cout << "Unknown player." << std::endl;
break;
}
SERVER->kickClient(id);
break;
}
commandqueue.pop();
}
SDL_mutexV(commandqueue_mutex);
BaseGameManager::inputLoop();
}