mirror of
https://github.com/HikikoMarmy/Champions-Reborn-Server.git
synced 2026-04-11 03:19:49 -03:00
Simplification of discovery events
This commit is contained in:
@@ -220,8 +220,7 @@ bool GameSessionManager::RequestOpen( sptr_user user )
|
|||||||
session->m_state = GameSession::GameState::Open;
|
session->m_state = GameSession::GameState::Open;
|
||||||
|
|
||||||
// Tell the host its own address.
|
// Tell the host its own address.
|
||||||
NotifyGameDiscovered msg( user->m_discoveryAddr, user->m_discoveryPort, user->m_gameType );
|
user->sock->send( NotifyGameDiscovered( user ) );
|
||||||
user->sock->send( msg );
|
|
||||||
|
|
||||||
Log::Info( "Game Session [{}] Discoverable on {}", gameId, user->m_discoveryAddr );
|
Log::Info( "Game Session [{}] Discoverable on {}", gameId, user->m_discoveryAddr );
|
||||||
|
|
||||||
@@ -403,12 +402,10 @@ std::vector<sptr_game_session> GameSessionManager::GetPrivateGameSessionList( co
|
|||||||
void GameSessionManager::ProcessJoinNorrath( sptr_user join, sptr_user host )
|
void GameSessionManager::ProcessJoinNorrath( sptr_user join, sptr_user host )
|
||||||
{
|
{
|
||||||
// Tell the joining user its own address
|
// Tell the joining user its own address
|
||||||
NotifyClientDiscovered msgClientDiscovered( join );
|
join->sock->send( NotifyClientDiscovered( join ) );
|
||||||
join->sock->send( msgClientDiscovered );
|
|
||||||
|
|
||||||
// Tell the host the joining user's address.
|
// Tell the host the joining user's address.
|
||||||
NotifyClientRequestConnect msgNotifyReqConnect( join );
|
host->sock->send( NotifyClientRequestConnect( join ) );
|
||||||
host->sock->send( msgNotifyReqConnect );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameSessionManager::ProcessJoinArms( sptr_user join, sptr_user host )
|
void GameSessionManager::ProcessJoinArms( sptr_user join, sptr_user host )
|
||||||
@@ -420,10 +417,8 @@ void GameSessionManager::ProcessJoinArms( sptr_user join, sptr_user host )
|
|||||||
host->m_localAddr, host->m_localPort, host->m_discoveryAddr, host->m_discoveryPort );
|
host->m_localAddr, host->m_localPort, host->m_discoveryAddr, host->m_discoveryPort );
|
||||||
|
|
||||||
// Tell the joining user its own address
|
// Tell the joining user its own address
|
||||||
NotifyClientDiscovered_RTA msgClientDiscovered( join );
|
join->sock->send( NotifyClientDiscovered_RTA( join ) );
|
||||||
join->sock->send( msgClientDiscovered );
|
|
||||||
|
|
||||||
// Tell the host the joining user's address.
|
// Tell the host the joining user's address.
|
||||||
NotifyClientRequestConnect_RTA msgNotifyReqConnect( join );
|
host->sock->send( NotifyClientRequestConnect_RTA( join ) );
|
||||||
host->sock->send( msgNotifyReqConnect );
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
#include "NotifyGameDiscovered.h"
|
#include "NotifyGameDiscovered.h"
|
||||||
|
#include "../../Game/RealmUser.h"
|
||||||
|
|
||||||
NotifyGameDiscovered::NotifyGameDiscovered( std::string clientIp, int32_t clientPort, RealmGameType clientType ) : GenericMessage( 0x3E )
|
NotifyGameDiscovered::NotifyGameDiscovered( sptr_user user ) : GenericMessage( 0x3E )
|
||||||
{
|
{
|
||||||
this->m_clientIp = std::move( clientIp );
|
this->m_clientIp = user->m_discoveryAddr;
|
||||||
this->m_clientPort = clientPort;
|
this->m_clientPort = user->m_discoveryPort;
|
||||||
this->m_clientType = clientType;
|
this->m_clientType = user->m_gameType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifyGameDiscovered::Serialize( ByteBuffer &out ) const
|
void NotifyGameDiscovered::Serialize( ByteBuffer &out ) const
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "../GenericNetMessage.h"
|
#include "../GenericNetMessage.h"
|
||||||
#include "../../Common/Constant.h"
|
#include "../../Common/Constant.h"
|
||||||
|
#include "../../Common/ForwardDecl.h"
|
||||||
|
|
||||||
class NotifyGameDiscovered : public GenericMessage {
|
class NotifyGameDiscovered : public GenericMessage {
|
||||||
private:
|
private:
|
||||||
@@ -13,6 +14,6 @@ private:
|
|||||||
RealmGameType m_clientType;
|
RealmGameType m_clientType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NotifyGameDiscovered( std::string clientIp, int32_t clientPort, RealmGameType clientType );
|
NotifyGameDiscovered( sptr_user user );
|
||||||
void Serialize(ByteBuffer &out) const override;
|
void Serialize(ByteBuffer &out) const override;
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user