本文整理汇总了C++中playerhandler::const_iterator::GetHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::GetHandler方法的具体用法?C++ const_iterator::GetHandler怎么用?C++ const_iterator::GetHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类playerhandler::const_iterator
的用法示例。
在下文中一共展示了const_iterator::GetHandler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadPlayerManager
void NczPlayerManager::LoadPlayerManager ()
{
SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "player_death", true );
SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "player_team", true );
SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "player_spawn", true );
SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "player_connect", true );
SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "player_disconnect", true );
SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "round_end", true );
SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "round_freeze_end", true );
SourceSdk::InterfacesProxy::GetGameEventManager ()->AddListener ( this, "bot_takeover", true );
//Helpers::FastScan_EntList();
Helpers::m_EdictList = Helpers::PEntityOfEntIndex ( 0 );
//if(Helpers::m_EdictList)
//{
//int maxcl = Helpers::GetMaxClients();
for( PlayerHandler::const_iterator ph ( PlayerHandler::begin () ); ph != PlayerHandler::end (); ++ph )
{
SourceSdk::edict_t* const pEntity ( Helpers::PEntityOfEntIndex ( ph.GetIndex () ) );
if( Helpers::isValidEdict ( pEntity ) )
{
void * playerinfo ( SourceSdk::InterfacesProxy::Call_GetPlayerInfo ( pEntity ) );
if( playerinfo )
{
bool isfakeclient;
if( SourceSdk::InterfacesProxy::m_game == SourceSdk::CounterStrikeGlobalOffensive )
{
isfakeclient = static_cast< SourceSdk::IPlayerInfo_csgo* >( playerinfo )->IsFakeClient ();
}
else
{
isfakeclient = static_cast< SourceSdk::IPlayerInfo* >( playerinfo )->IsFakeClient ();
}
if( isfakeclient )
{
ph.GetHandler ()->status = SlotStatus::BOT;
ph.GetHandler ()->playerClass = new NczPlayer ( ph.GetIndex () );
m_max_index = ph.GetIndex ();
}
else if( static_cast< SourceSdk::IPlayerInfo* >( playerinfo )->IsConnected () )
{
ph.GetHandler ()->status = SlotStatus::PLAYER_CONNECTED;
ph.GetHandler ()->playerClass = new NczPlayer ( ph.GetIndex () );
ph.GetHandler ()->playerClass->OnConnect ();
m_max_index = ph.GetIndex ();
}
}
}
}
//}
if( m_max_index )
{
PlayerHandler::first = ( &FullHandlersList[ 1 ] );
PlayerHandler::last = ( &FullHandlersList[ m_max_index ] );
}
else
{
PlayerHandler::first = PlayerHandler::invalid;
PlayerHandler::last = PlayerHandler::invalid;
}
BaseSystem::ManageSystems ();
}
示例2: FireGameEvent
void NczPlayerManager::FireGameEvent ( SourceSdk::IGameEvent* ev )
/*
player_death
player_team
player_spawn
player_connect
player_disconnect
round_freeze_end
round_end
bot_takeover
*/
{
const char* event_name ( ev->GetName () + 6 );
const int maxcl ( m_max_index );
if( *event_name == 'e' ) // round_end
{
DebugMessage("event round_end");
for( int x ( 1 ); x <= maxcl; ++x )
{
PlayerHandler::const_iterator ph ( x );
if( ph == SlotStatus::PLAYER_IN_TESTS )
{
ph.GetHandler()->status = SlotStatus::PLAYER_CONNECTED;
ph.GetHandler()->in_tests_time = std::numeric_limits<float>::max ();
DebugMessage(Helpers::format("Players %s : Status changed from PLAYER_IN_TESTS to PLAYER_CONNECTED", ph->GetName()));
}
/*else if( ph == SlotStatus::PLAYER_IN_TESTS_TAKEOVER )
{
ph->GetTakeover ()->StopBotTakeover ();
ph->StopBotTakeover ();
ph.GetHandler ()->status = SlotStatus::PLAYER_CONNECTED;
ph.GetHandler ()->in_tests_time = std::numeric_limits<float>::max ();
}*/
}
ProcessFilter::HumanAtLeastConnected filter_class;
if( GetPlayerCount ( &filter_class ) == 0 ) AutoTVRecord::GetInstance ()->StopRecord ();
BaseSystem::ManageSystems ();
Logger::GetInstance ()->Flush ();
return;
}
/*else*/ if( *event_name == 'f' ) // round_freeze_end = round_start
{
DebugMessage("event round_freeze_end");
for( int x ( 1 ); x <= maxcl; ++x )
{
PlayerHandler& ph ( FullHandlersList[ x ] );
if( ph.status == SlotStatus::INVALID ) continue;
if( ph.status >= SlotStatus::PLAYER_CONNECTED )
{
ph.status = SlotStatus::PLAYER_CONNECTED;
SourceSdk::IPlayerInfo * const pinfo ( ph.playerClass->GetPlayerInfo () );
if( pinfo )
{
if( pinfo->GetTeamIndex () > 1 )
{
DebugMessage(Helpers::format("Players %s : Will enter in status PLAYER_IN_TESTS in 1 second", ph.playerClass->GetName()));
ph.in_tests_time = Plat_FloatTime () + 1.0f;
}
else
{
ph.in_tests_time = std::numeric_limits<float>::max ();
}
}
}
}
BaseSystem::ManageSystems ();
return;
}
PlayerHandler::const_iterator ph ( GetPlayerHandlerByUserId ( ev->GetInt ( "userid" ) ) );
if( *event_name == 'k' ) // bot_takeover
{
DebugMessage(Helpers::format("event bot_takeover : %s -> %s", ph->GetName (), GetPlayerHandlerByUserId ( ev->GetInt ( "botid" ) )->GetName ()));
//PlayerHandler::const_iterator bh1 ( GetPlayerHandlerByUserId ( ev->GetInt ( "botid" ) ) );
//PlayerHandler::const_iterator bh2 ( GetPlayerHandlerByUserId ( ) );
//DebugMessage ( Helpers::format ( "Player %s taking control of bot %s or bot %d", ph->GetName (), bh1->GetName (), ev->GetInt ( "index" ) ));
//ph->EnterBotTakeover ( ev->GetInt ( "index" ) );
//bh2->EnterBotTakeover ( ph.GetIndex () );
//ph.GetHandler ()->status = SlotStatus::PLAYER_IN_TESTS_TAKEOVER;
//ph.GetHandler ()->in_tests_time = std::numeric_limits<float>::max ();
return;
}
++event_name;
if( *event_name == 'c' ) // player_connect
{
if( ev->GetBool ( "bot" ) == false )
{
if( SourceSdk::InterfacesProxy::m_game == SourceSdk::CounterStrikeGlobalOffensive )
{
//.........这里部分代码省略.........