mirror of
https://github.com/HikikoMarmy/Champions-Reborn-Server.git
synced 2026-04-05 08:59:54 -03:00
Send the correct game ID when joining private rooms.
This commit is contained in:
@@ -33,15 +33,24 @@ sptr_generic_response RequestGetGame::ProcessRequest( sptr_user user, sptr_byte_
|
||||
return std::make_shared< ResultGetGame >( this, TIMEOUT );
|
||||
}
|
||||
|
||||
auto host_user = session->m_owner.lock();
|
||||
|
||||
if( host_user == nullptr )
|
||||
{
|
||||
Log::Error( "Game session owner not found! [%S]", m_gameName.c_str() );
|
||||
return std::make_shared< ResultGetGame >( this, TIMEOUT );
|
||||
}
|
||||
|
||||
user->m_isHost = false;
|
||||
user->m_gameId = session->m_gameIndex;
|
||||
|
||||
return std::make_shared< ResultGetGame >( this, SUCCESS );
|
||||
return std::make_shared< ResultGetGame >( this, SUCCESS, session->m_gameIndex );
|
||||
}
|
||||
|
||||
ResultGetGame::ResultGetGame( GenericRequest *request, int32_t reply ) : GenericResponse( *request )
|
||||
ResultGetGame::ResultGetGame( GenericRequest *request, int32_t reply, int32_t gameId ) : GenericResponse( *request )
|
||||
{
|
||||
m_reply = reply;
|
||||
m_gameId = gameId;
|
||||
}
|
||||
|
||||
ByteStream &ResultGetGame::Serialize()
|
||||
@@ -50,9 +59,11 @@ ByteStream &ResultGetGame::Serialize()
|
||||
m_stream.write_u32( m_requestId );
|
||||
m_stream.write_u32( m_reply );
|
||||
|
||||
// TODO: These may come in from the UpdateGameData event
|
||||
m_stream.write_utf16( L"Kelethin" );
|
||||
m_stream.write_utf16( L"OwnerName" );
|
||||
m_stream.write_u32( 0 );
|
||||
|
||||
m_stream.write_u32( m_gameId );
|
||||
|
||||
return m_stream;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
class RequestGetGame : public GenericRequest
|
||||
{
|
||||
class RequestGetGame : public GenericRequest {
|
||||
private:
|
||||
std::wstring m_sessionId;
|
||||
std::wstring m_gameName;
|
||||
@@ -24,8 +23,9 @@ public:
|
||||
class ResultGetGame : public GenericResponse {
|
||||
private:
|
||||
int32_t m_reply;
|
||||
int32_t m_gameId;
|
||||
|
||||
public:
|
||||
ResultGetGame( GenericRequest *request, int32_t reply );
|
||||
ResultGetGame( GenericRequest *request, int32_t reply, int32_t gameId = 0 );
|
||||
ByteStream &Serialize();
|
||||
};
|
||||
Reference in New Issue
Block a user