本文整理汇总了C++中Player::Active方法的典型用法代码示例。如果您正苦于以下问题:C++ Player::Active方法的具体用法?C++ Player::Active怎么用?C++ Player::Active使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player::Active方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChatSendChannel
//PM
void PlayerManager::ChatSendChannel(long GameID, char * Channel, char * Message)
{
if (Message && Channel)
{
// Find sender's name
Player * s = GetPlayer(GameID);
Player * p = (0);
char FName[40];
GetPostFix(s, FName, 40);
if (s)
{
m_Mutex.Lock();
while (GetNextPlayerOnList(p, m_GlobalPlayerList))
{
if (p->Active())
{
p->SendClientChatEvent(0x03, 0x00, FName, FName, Channel, Message);
}
}
m_Mutex.Unlock();
}
}
}
示例2: SetSquad
//*********************************************************
SetType SetSquad(ifstream & fin, VecPlayerType & pVec,int num, MapSquadType & squadMap){
char type;
string pName= "";
int pRow;
int pCol;
char direction;
SetType squad;
Player * p;
BoardClass * bd= BoardClass::GetBd();
fin>> type;
while(type != 'q' && fin){
fin>> pName;
fin>> pRow;
fin>> pCol;
fin>> direction;
p= CreaterPlayer(pName, type);
bd->BoardClass::PlacePlayer(p, pRow, pCol);
p->Active();
p->ResetMomentum();
p->DropWeapon();
p->SetDir(direction);
pVec.push_back(p);
squad.insert(pName);
squadMap.insert(make_pair(p->Name(), SquadType(num)));
fin>> type;
}
return squad;
}
示例3: SendSoundBroadcast
void StaticMap::SendSoundBroadcast(long rcount)
{
Player *p = (0);
u32 * sector_list = m_ObjectMgr->GetSectorList();
if (BroadcastID() == 0)
{
return;
}
ObjectEffect StationBroadcast;
StationBroadcast.Bitmask = 0x04;
StationBroadcast.GameID = GameID();
StationBroadcast.EffectDescID = (short)BroadcastID();
StationBroadcast.EffectID = BroadcastID();
StationBroadcast.Duration = 8000;
while (g_PlayerMgr->GetNextPlayerOnList(p, sector_list))
{
if (p && p->Active() && (p->GameID()%128 == rcount) && RangeFrom(p->Position()) < 40000.0f)
{
LogDebug("Broadcasting for station %s\n", Name());
p->SendObjectEffect(&StationBroadcast);
}
}
}
示例4: ChatSendChannel
//PM
void PlayerManager::ChatSendChannel(long GameID, char * Channel, char * Message)
{
if (Message && Channel)
{
// Find sender's name
Player * s = GetPlayer(GameID);
Player * p = (0);
char FName[40];
GetPostFix(s, FName, 40);
long channel_id = GetChannelFromName(Channel);
if (s)
{
while (GetNextPlayerOnList(p, m_GlobalPlayerList))
{
if (p->Active() && p->IsSubscribed(channel_id))
{
p->SendClientChatEvent(0x03, 0x00, FName, FName, Channel, Message);
}
}
}
}
}
示例5: CheckAccountInUse
bool PlayerManager::CheckAccountInUse(char *username)
{
Player * p = (0);
while (GetNextPlayerOnList(p, m_GlobalPlayerList))
{
if (strncmp(p->AccountUsername(), username, 50) == 0)
{
if (p->Active())
{
//this player's account is already active
//p->ForceLogout();
//check time of last received update, if older than 30 seconds, kill the account.
if ((p->LastAccessTime() + 30000) < GetNet7TickCount())
{
LogMessage("Account user %s seems to have died. Remove so they can log in again\n", username);
DropPlayerFromGalaxy(p);
}
else
{
LogMessage("Account user %s already active, don't allow second account\n", p->AccountUsername());
return true;
}
}
else
{
LogMessage("Account user %s has dead player on server, remove\n", username);
DropPlayerFromGalaxy(p);
}
}
}
return false;
}
示例6: CheckAccountInUse
bool PlayerManager::CheckAccountInUse(char *username)
{
Player * p = (0);
while (GetNextPlayerOnList(p, m_GlobalPlayerList))
{
if (strncmp(p->AccountUsername(), username, 50) == 0)
{
if (p->Active())
{
//this player's account is already active
//p->ForceLogout();
LogMessage("Account user %s already active, don't allow second account\n", p->AccountUsername());
return true;
}
else
{
LogMessage("Account user %s has dead player on server, remove\n", username);
DropPlayerFromGalaxy(p);
}
}
}
return false;
}
示例7: RunMovementThread
//PM - start at startup
void PlayerManager::RunMovementThread()
{
Player * p = (0);
unsigned long current_tick;
long sleep_time;
LogMessage("Begin move thread cycle\n");
do
{
current_tick = GetNet7TickCount();
// Run through all players sequentially and update each in turn
m_Mutex.Lock();
p = (0);
while (GetNextPlayerOnList(p, m_GlobalPlayerList))
{
current_tick = GetNet7TickCount();
//Handle player removal here
if (p)
{
if (p->GetLoginStage() == 2)
{
p->SendPacketCache();
p->HandleLoginStage2();
}
else if (p->IsToBeRemoved())
{
m_GlobMemMgr->ReleasePlayerNode(p);
p->SetActive(false);
LogMessage("Player %s Removed from Galaxy.\n", p->Name());
UnSetIndex(p->GameID(), m_GlobalPlayerList);
}
else if ((p->LastAccessTime() + 2*60000) < current_tick )
{
DropPlayerFromGalaxy(p);
}
else if (p->Active())
{
if (p->InSpace())
{
if (p->MovementID() % 5 == 0)
{
p->CalcNewPosition(current_tick); //update the positions
if (!p->DebugPlayer() && (!IS_PLAYER(p->MVASIndex()) || p->WarpDrive() || p->Following() || p->PlayerUpdateSet()) )
{
p->SendLocationAndSpeed(true);
}
else if (IS_PLAYER(p->MVASIndex()))
{
p->SendLocationAndSpeed(false);
}
if (p->ObjectIsMoving())
{
p->UpdateVerbs();
}
if (p->MovementID() % 50)
{
Object *obj = p->NearestNav();
p->SetNearestNav(obj);
}
p->CheckObjectRanges();
p->UpdatePlayerVisibilityList();
p->ResetAttacksThisTick();
}
p->IncrementMovementID(1);
}
p->SendPacketCache();
p->CheckEventTimes(current_tick);
}
else if (p->DebugPlayer())
{
if (p->MovementID() % 5 == 0)
{
p->SendLocationAndSpeed(false);
p->UpdatePlayerVisibilityList();
}
p->IncrementMovementID(1);
}
else
{
p->SendPacketCache();
}
}
}
m_Mutex.Unlock();
sleep_time = current_tick - GetNet7TickCount() + 100;
if (sleep_time < 0) sleep_time = 0;
Sleep(sleep_time);
} while (!g_ServerShutdown);
//.........这里部分代码省略.........
示例8: RunMovementThread
//PM - start at startup
void PlayerManager::RunMovementThread()
{
Player * p = (0);
unsigned long current_tick = GetNet7TickCount();
// Run through all players sequentially and update each in turn
m_Mutex.Lock();
while (GetNextPlayerOnList(p, m_GlobalPlayerList))
{
//Handle player removal here
if (p)
{
if (p->GetLoginStage() == 1)
{
p->SetLoginStage(2);
p->SendPacketCache();
p->HandleLoginStage2();
}
else if (p->IsToBeRemoved() || (p->LastAccessTime() + 2*60000) < current_tick)
{
DropPlayerFromGalaxy(p);
}
else if (p->Active())
{
if (p->InSpace())
{
if (p->MovementID() % 5 == 0)
{
p->CalcNewPosition(current_tick); //update the positions
if (!p->DebugPlayer() && (!IS_PLAYER(p->MVASIndex()) || p->WarpDrive() || p->Following() || p->PlayerUpdateSet()) )
{
p->SendLocationAndSpeed(true);
}
else if (IS_PLAYER(p->MVASIndex()))
{
p->SendLocationAndSpeed(false);
}
if (p->ObjectIsMoving())
{
p->UpdateVerbs();
}
if (p->MovementID() % 50)
{
Object *obj = p->NearestNav();
p->SetNearestNav(obj);
}
p->CheckObjectRanges();
p->UpdatePlayerVisibilityList();
p->ResetAttacksThisTick();
}
p->IncrementMovementID(1);
}
p->SendPacketCache();
p->CheckEventTimes(current_tick);
}
else if (p->DebugPlayer())
{
if (p->MovementID() % 5 == 0)
{
p->SendLocationAndSpeed(false);
p->UpdatePlayerVisibilityList();
}
p->IncrementMovementID(1);
}
else
{
p->SendPacketCache();
}
}
}
m_Mutex.Unlock();
}