📄 channel.cpp
字号:
Zone* Channel::FindMissionZone( DWORD dwZoneKey )
{
ZONE_MAP_ITER it = m_mapMissionZones.find( dwZoneKey );
if( it != m_mapMissionZones.end() )
{
return it->second;
}
else
{
return NULL;
}
}
Zone* Channel::FindHuntingZone( DWORD dwZoneKey )
{
ZONE_MAP_ITER it = m_mapHuntingZones.find( dwZoneKey );
if( it != m_mapHuntingZones.end() )
{
return it->second;
}
else
{
return NULL;
}
}
Zone* Channel::FindQuestZone( DWORD dwZoneKey )
{
ZONE_MAP_ITER it = m_mapQuestZones.find( dwZoneKey );
if( it != m_mapQuestZones.end() )
{
return it->second;
}
else
{
return NULL;
}
}
Zone* Channel::FindPVPZone( DWORD dwZoneKey )
{
ZONE_MAP_ITER it = m_mapPVPZones.find( dwZoneKey );
if( it != m_mapPVPZones.end() )
{
return it->second;
}
else
{
return NULL;
}
}
Zone* Channel::FindEventZone( DWORD dwZoneKey )
{
ZONE_MAP_ITER it = m_mapEventZones.find( dwZoneKey );
if( it != m_mapEventZones.end() )
{
return it->second;
}
else
{
return NULL;
}
}
Zone* Channel::FindGuildZone( DWORD dwZoneKey )
{
ZONE_MAP_ITER it = m_mapGuildZones.find( dwZoneKey );
if( it != m_mapGuildZones.end() )
{
return it->second;
}
else
{
return NULL;
}
}
Zone* Channel::FindSiegeZone( DWORD dwZoneKey )
{
ZONE_MAP_ITER it = m_mapSiegeZones.find( dwZoneKey );
if( it != m_mapSiegeZones.end() )
{
return it->second;
}
else
{
return NULL;
}
}
Zone* Channel::FindFriendChat( DWORD dwZoneKey )
{
ZONE_MAP_ITER it = m_mapFriendChat.find( dwZoneKey );
if( it != m_mapFriendChat.end() )
{
return it->second;
}
else
{
return NULL;
}
}
// 盲澄俊 贸澜栏肺 蜡廉甫 眠啊茄促.
// 某腐磐纠俊 眠啊且 锭绰 粮虐 公矫
VOID Channel::AddUser( User *pUser, eZONETYPE userStatus, DWORD dwZoneKey )
{
// pUser->SetStatus( userStatus );
switch( userStatus )
{
case eZONETYPE_CHARSELECT:
UserEnterCharScene( pUser );
break;
case eZONETYPE_VILLAGE:
UserEnterVillage( pUser, dwZoneKey );
break;
case eZONETYPE_LOBBY:
UserEnterLobby( pUser, dwZoneKey );
break;
case eZONETYPE_MISSION:
UserEnterMissionZone( pUser, dwZoneKey );
break;
case eZONETYPE_HUNTING:
UserEnterHuntingZone( pUser, dwZoneKey );
break;
case eZONETYPE_QUEST:
UserEnterQuestZone( pUser, dwZoneKey );
break;
case eZONETYPE_PVP:
UserEnterPVPZone( pUser, dwZoneKey );
break;
case eZONETYPE_EVENT:
UserEnterEventZone( pUser, dwZoneKey );
break;
case eZONETYPE_GUILD:
UserEnterGuildZone( pUser, dwZoneKey );
break;
case eZONETYPE_SIEGE:
UserEnterSiegeZone( pUser, dwZoneKey );
break;
default:
#ifdef _DEBUG
assert( !"AddUser - invalid user status" );
#else
MessageOut( eCRITICAL_LOG, "[Guid:%u] Channel::AddUser Error - No ZoneType[%u][ZK:%u]", userStatus, dwZoneKey );
// 酪绢滚啡栏聪 谗绢滚妨!!!
pUser->Logout();
return;
#endif
break;
}
// 盲澄 蜡廉 府胶飘俊档 眠啊
m_mapUsers.insert( USER_MAP_PAIR( pUser->GetGUID(), pUser ) );
// 傈眉 蜡廉 府胶飘俊档 眠啊
UserManager::Instance()->AddUser( pUser->GetGUID(), pUser );
MessageOut( eFULL_LOG, "盲澄(%d) 蜡廉 眠啊! [Guid:%u][CharName:%s][Status:%u]",
GetChannelID(), pUser->GetGUID(), pUser->GetCharName().c_str(), userStatus );
}
// 盲澄阑 肯傈洒 狐廉唱哎 锭 龋免
VOID Channel::RemoveUser( User *pUser )
{
MessageOut( eFULL_LOG, "盲澄(%d) 蜡廉 力芭 [Guid:%u][CharName:%s][Status:%u]",
GetChannelID(), pUser->GetGUID(), pUser->GetCharName().c_str(), pUser->GetStatus() );
if( pUser->GetStatus() >= eZONETYPE_LOBBY && pUser->GetStatus() < eZONETYPE_MAX )
{
// 盲澄俊辑 泅犁 困摹茄 府胶飘俊辑 力芭
UserLeavePrevZone( pUser );
}
// 轰器飘俊辑档 力芭
// ViewPortManager::Instance()->RemoveUser( pUser );
m_pViewPortManager->RemoveUser( pUser );
// 盲澄 蜡廉 府胶飘俊辑档 力芭
USER_MAP_ITER it = m_mapUsers.find( pUser->GetGUID() );
if( it != m_mapUsers.end() )
{
m_mapUsers.erase( it );
}
// 傈眉 蜡廉 府胶飘俊辑档 力芭
UserManager::Instance()->RemoveUser( pUser->GetGUID() );
}
BOOL Channel::AddViewPortUser( User *pUser, DWORD dwField, DWORD dwSector )
{
return m_pViewPortManager->AddUser( pUser, dwField, dwSector );
}
BOOL Channel::MoveViewPortUser( User *pUser, DWORD dwField, DWORD dwSector )
{
return m_pViewPortManager->MoveUser( pUser, dwField, dwSector );
}
VOID Channel::RemoveViewPortUser( User *pUser )
{
m_pViewPortManager->RemoveUser( pUser );
}
VOID Channel::UserLeavePrevZone( User *pUser )
{
MessageOut( eMIDDLE_LOG, "UserLeaveZone[ZoneType:%u][Key:%u][Guid:%u][CharGuid:%u]", pUser->GetStatus(),
pUser->GetZoneKey(),
pUser->GetGUID(),
pUser->GetCharGuid() );
switch( pUser->GetStatus() )
{
case eZONETYPE_CHARSELECT:
{
m_pCharSceneZone->RemoveUser( pUser->GetGUID() );
}
break;
case eZONETYPE_VILLAGE:
{
Zone *pZone = FindVillage( pUser->GetZoneKey() );
if( pZone )
{
if( pZone->RemoveUser( pUser->GetGUID() ) )
{
DecVillageUserNum();
}
// 后 付阑捞搁 昏力
if( pZone->GetNumberOfUsers() == 0 )
{
RemoveVillage( pZone->GetKey() );
}
}
// ViewPortManager::Instance()->RemoveUser( pUser ); // 轰器飘俊辑 昏力
m_pViewPortManager->RemoveUser( pUser );
}
break;
case eZONETYPE_LOBBY:
{
Zone *pZone = FindLobby( pUser->GetZoneKey() );
if( pZone )
{
if( pZone->RemoveUser( pUser->GetGUID() ) )
{
DecLobbyUserNum();
}
// 后 硅撇粮捞搁 昏力
if( pZone->GetNumberOfUsers() == 0 )
{
RemoveLobby( pZone->GetKey() );
}
}
}
break;
case eZONETYPE_MISSION:
{
Zone *pZone = FindMissionZone( pUser->GetZoneKey() );
if( pZone )
{
if( pZone->RemoveUser( pUser->GetGUID() ) )
{
DecMissionUserNum();
}
// 后 硅撇粮捞搁 昏力
if( pZone->GetNumberOfUsers() == 0 )
{
RemoveMissionZone( pZone->GetKey() );
}
}
}
break;
case eZONETYPE_HUNTING:
{
Zone *pZone = FindHuntingZone( pUser->GetZoneKey() );
if( pZone )
{
if( pZone->RemoveUser( pUser->GetGUID() ) )
{
DecHuntingUserNum();
}
// 后 硅撇粮捞搁 昏力
if( pZone->GetNumberOfUsers() == 0 )
{
RemoveHuntingZone( pZone->GetKey() );
}
}
}
break;
case eZONETYPE_QUEST:
{
Zone *pZone = FindQuestZone( pUser->GetZoneKey() );
if( pZone )
{
if( pZone->RemoveUser( pUser->GetGUID() ) )
{
DecQuestUserNum();
}
// 后 硅撇粮捞搁 昏力
if( pZone->GetNumberOfUsers() == 0 )
{
RemoveQuestZone( pZone->GetKey() );
}
}
}
break;
case eZONETYPE_PVP:
{
Zone *pZone = FindPVPZone( pUser->GetZoneKey() );
if( pZone )
{
if( pZone->RemoveUser( pUser->GetGUID() ) )
{
DecPVPUserNum();
}
// 后 硅撇粮捞搁 昏力
if( pZone->GetNumberOfUsers() == 0 )
{
RemovePVPZone( pZone->GetKey() );
}
}
}
break;
case eZONETYPE_EVENT:
{
Zone *pZone = FindEventZone( pUser->GetZoneKey() );
if( pZone )
{
if( pZone->RemoveUser( pUser->GetGUID() ) )
{
DecEventUserNum();
}
// 后 硅撇粮捞搁 昏力
if( pZone->GetNumberOfUsers() == 0 )
{
RemoveEventZone( pZone->GetKey() );
}
}
}
break;
case eZONETYPE_GUILD:
{
Zone *pZone = FindGuildZone( pUser->GetZoneKey() );
if( pZone )
{
if( pZone->RemoveUser( pUser->GetGUID() ) )
{
DecGuildUserNum();
}
// 后 硅撇粮捞搁 昏力
if( pZone->GetNumberOfUsers() == 0 )
{
RemoveGuildZone( pZone->GetKey() );
}
}
}
break;
case eZONETYPE_SIEGE:
{
Zone *pZone = FindSiegeZone( pUser->GetZoneKey() );
if( pZone )
{
if( pZone->RemoveUser( pUser->GetGUID() ) )
{
DecSiegeUserNum();
}
// 后 硅撇粮捞搁 昏力
if( pZone->GetNumberOfUsers() == 0 )
{
RemoveSiegeZone( pZone->GetKey() );
}
}
}
break;
default: // 老窜 某腐磐 急琶/付阑 酒聪搁 傈何 硅撇粮栏肺 秒鞭茄促
{
MessageOut( eFULL_LOG, "[%u][ZK:%u] UserLeavePrevZone Error - 吝汗 昏力", pUser->GetGUID(), pUser->GetZoneKey() );
return;
}
break;
// assert( !"UserLeavePrevZone - invalid user status" );
/*
{
Zone *pZone = FindBattleZone( pUser->GetZoneKey() );
if( pZone )
{
pZone->RemoveUser( pUser->GetGUID() );
// 后 硅撇粮捞搁 昏力
if( pZone->GetNumberOfUsers() == 0 )
{
RemoveBattleZone( pZone->GetKey() );
}
}
}
*/
break;
}
}
VOID Channel::UserEnterCharScene( User *pUser )
{
if( pUser->GetStatus() >= eZONETYPE_LOBBY && pUser->GetStatus() < eZONETYPE_MAX )
{
MessageOut( eCRITICAL_LOG, "User Leave 绝捞 CharSceneEnter Error[%s][Guid:%u][CharGuid:%u]", pUser->GetCharName().c_str(),
pUser->GetGUID(),
pUser->GetCharGuid() );
UserLeavePrevZone( pUser ); // 趣矫扼档 巢篮 惑怕老 荐 乐栏聪 昏力
}
pUser->SetStatus( eZONETYPE_CHARSELECT );
m_pCharSceneZone->AddUser( pUser->GetGUID(), pUser );
MessageOut( eFULL_LOG, "UserEnterCharScene(%s:%u)", pUser->GetCharName().c_str(), pUser->GetGUID() );
}
VOID Channel::UserEnterVillage( User *pUser, DWORD dwZoneKey )
{
if( pUser->GetStatus() >= eZONETYPE_LOBBY && pUser->GetStatus() < eZONETYPE_MAX )
{
MessageOut( eCRITICAL_LOG, "User Leave 绝捞 VillageEnter Error[%s][Guid:%u][CharGuid:%u]", pUser->GetCharName().c_str(),
pUser->GetGUID(),
pUser->GetCharGuid() );
UserLeavePrevZone( pUser ); // 趣矫扼档 巢篮 惑怕老 荐 乐栏聪 昏力
}
pUser->SetStatus( eZONETYPE_VILLAGE );
// 秦寸 虐肺 付阑阑 茫酒焊绊 绝栏搁 付阑 眠啊 饶 蜡廉 眠啊
Zone *pZone = FindVillage( dwZoneKey );
if( !pZone )
{
pZone = AddVillage( dwZoneKey );
}
if( pZone->AddUser( pUser->GetGUID(), pUser ) )
{
IncVillageUserNum();
}
MessageOut( eMIDDLE_LOG, "UserEnterVillage[Guid:%u][CharGuid:%u][ZK:%u]", pUser->GetGUID(), pUser->GetCharGuid(), dwZoneKey );
}
/*
VOID Channel::UserEnterBattleZone( User *pUser, DWORD dwZoneKey )
{
UserLeavePrevZone( pUser ); // 趣矫扼档 巢篮 惑怕老 荐 乐栏聪 昏力
pUser->SetStatus( eZONETYPE_LOBBY );
// 秦寸 虐肺 硅撇粮阑 茫酒焊绊 绝栏搁 硅撇粮 眠啊 饶 蜡廉 眠啊
Zone *pZone = FindBattleZone( dwZoneKey );
if( !pZone )
{
pZone = AddBattleZone( dwZoneKey );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -