本文整理汇总了C++中UserInfo::getUserNum方法的典型用法代码示例。如果您正苦于以下问题:C++ UserInfo::getUserNum方法的具体用法?C++ UserInfo::getUserNum怎么用?C++ UserInfo::getUserNum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserInfo
的用法示例。
在下文中一共展示了UserInfo::getUserNum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
//----------------------------------------------------------------------
//
// GMServerInfoHander::execute()
//
// 게임 서버가 로그인 서버로부터 GMServerInfo 패킷을 받게 되면,
// ReconnectLoginInfo를 새로 추가하게 된다.
//
//----------------------------------------------------------------------
void GMServerInfoHandler::execute (GMServerInfo * pPacket )
throw(ProtocolException , Error )
{
__BEGIN_TRY __BEGIN_DEBUG_EX
__BEGIN_DEBUG
#ifdef __LOGIN_SERVER__
ZONEUSERDATA rData;
WorldID_t WorldID = pPacket->getWorldID();
ServerGroupID_t ServerGroupID = pPacket->getServerID();
BYTE MaxCount = pPacket->getZoneUserCount();
UserInfo * pUserInfo = g_pUserInfoManager->getUserInfo(ServerGroupID, WorldID);
pUserInfo->setUserNum(0);
Assert(pUserInfo != NULL);
for(int count = 0; count < MaxCount; count++ ) {
pPacket->popZoneUserData(rData);
pUserInfo->setUserNum(pUserInfo->getUserNum() + rData.UserNum);
}
#endif
__END_DEBUG
__END_DEBUG_EX __END_CATCH
}
示例2: execute
//////////////////////////////////////////////////////////////////////////////
// 클라이언트가 서버의 리스트를 달라고 요청해오면, 로그인 서버는 DB로부터
// 서버들의 정보를 로딩해서 LCServerList 패킷에 담아서 전송한다.
//////////////////////////////////////////////////////////////////////////////
void CLGetServerListHandler::execute (CLGetServerList* pPacket , Player* pPlayer)
throw(ProtocolException , Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __LOGIN_SERVER__
Assert(pPacket != NULL);
Assert(pPlayer != NULL);
//cout << "Start execute" << endl;
LoginPlayer* pLoginPlayer = dynamic_cast<LoginPlayer*>(pPlayer);
WorldID_t WorldID = pLoginPlayer->getWorldID();
try
{
int GroupNum = g_pGameServerGroupInfoManager->getSize(WorldID);
//cout << "ServerNum : " << GroupNum << endl;
ServerGroupInfo* aServerGroupInfo[GroupNum];
for(int i = 0 ; i < GroupNum; i++)
{
ServerGroupInfo* pServerGroupInfo = new ServerGroupInfo();
GameServerGroupInfo* pGameServerGroupInfo = g_pGameServerGroupInfoManager->getGameServerGroupInfo(i, WorldID);
pServerGroupInfo->setGroupID(pGameServerGroupInfo->getGroupID());
pServerGroupInfo->setGroupName(pGameServerGroupInfo->getGroupName());
pServerGroupInfo->setStat(SERVER_FREE);
UserInfo * pUserInfo = g_pUserInfoManager->getUserInfo(pGameServerGroupInfo->getGroupID(), WorldID);
WORD UserModify = 800;
WORD UserMax = 1500;
if (pUserInfo->getUserNum() < 100 + UserModify )
{
pServerGroupInfo->setStat(SERVER_FREE);
}
else if (pUserInfo->getUserNum() < 250 + UserModify )
{
pServerGroupInfo->setStat(SERVER_NORMAL);
}
else if (pUserInfo->getUserNum() < 400 + UserModify )
{
pServerGroupInfo->setStat(SERVER_BUSY);
}
else if (pUserInfo->getUserNum() < 500 + UserModify )
{
pServerGroupInfo->setStat(SERVER_VERY_BUSY);
}
else //if (pUserInfo->getUserNum() >= 500 + UserModify )
{
pServerGroupInfo->setStat(SERVER_FULL);
}
//else
{
//pServerGroupInfo->setStat(SERVER_DOWN);
}
if (pUserInfo->getUserNum() >= UserMax)
{
pServerGroupInfo->setStat(SERVER_FULL);
}
if (pGameServerGroupInfo->getStat() == SERVER_DOWN )
{
pServerGroupInfo->setStat(SERVER_DOWN);
}
aServerGroupInfo[i] = pServerGroupInfo;
//cout << "AddServer : " << pServerGroupInfo->getGroupName() << endl;
}
LCServerList lcServerList;
Statement * pStmt = NULL;
BEGIN_DB
{
pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement();
Result * pResult = pStmt->executeQuery("SELECT CurrentWorldID, CurrentServerGroupID FROM Player where PlayerID='%s'" , pLoginPlayer->getID().c_str());
if(pResult->next() ) {
lcServerList.setCurrentServerGroupID(pResult->getInt(1));
lcServerList.setCurrentServerGroupID(pResult->getInt(2));
}
SAFE_DELETE(pStmt); // by sigi
}
END_DB(pStmt) // by sigi
//.........这里部分代码省略.........