[raknet] Implement RakPeer Set/GetMaximumIncomingConnections

* Implement RakServer Set/GetAllowedPlayers
This commit is contained in:
RD42 2023-12-13 23:32:21 +08:00
parent aad5222e01
commit fd0d61244d
6 changed files with 73 additions and 16 deletions

View File

@ -22,14 +22,27 @@ void RakPeer::vftable_C()
// TODO: RakPeer::vftable_C() (saco W: 10038400) (server W: 44FF00 L: 8076430) (bot W: 403EA0 L: 8072E54)
}
void RakPeer::vftable_10()
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Description:
// Sets how many incoming connections are allowed. If this is less than the number of players currently connected, no
// more players will be allowed to connect. If this is greater than the maximum number of peers allowed, it will be reduced
// to the maximum number of peers allowed. Defaults to 0.
//
// Parameters:
// numberAllowed - Maximum number of incoming connections allowed.
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void RakPeer::SetMaximumIncomingConnections( unsigned short numberAllowed )
{
// TODO: RakPeer::vftable_10() (saco W: 10038410) (server W: 44FF10 L: 806D180) (bot W: 403EB0 L: 8072FD2)
maximumIncomingConnections = numberAllowed;
}
void RakPeer::vftable_14()
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Description:
// Returns the maximum number of incoming connections, which is always <= maxConnections
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
unsigned short RakPeer::GetMaximumIncomingConnections( void ) const
{
// TODO: RakPeer::vftable_14() (saco W: 10038420) (server W: 44FF20 L: 806D1A0) (bot W: 403EC0 L: 8072FEE)
return maximumIncomingConnections;
}
void RakPeer::vftable_18()

View File

@ -14,13 +14,22 @@ public:
void vftable_4();
void vftable_8();
void vftable_C();
void vftable_10();
void vftable_14();
void vftable_18();
void vftable_1C();
void vftable_20();
void vftable_24();
void vftable_28();
/// Sets how many incoming connections are allowed. If this is less than the number of players currently connected,
/// no more players will be allowed to connect. If this is greater than the maximum number of peers allowed,
/// it will be reduced to the maximum number of peers allowed. Defaults to 0.
/// \param[in] numberAllowed Maximum number of incoming connections allowed.
void SetMaximumIncomingConnections( unsigned short numberAllowed );
/// Returns the value passed to SetMaximumIncomingConnections()
/// \return the maximum number of incoming connections, which is always <= maxConnections
unsigned short GetMaximumIncomingConnections( void ) const;
void vftable_2C();
void vftable_30();
void vftable_34();
@ -79,6 +88,12 @@ public:
void vftable_108();
void vftable_10C();
void vftable_110();
protected:
///Store the maximum incoming connection allowed
unsigned short maximumIncomingConnections;
};
#endif

View File

@ -13,13 +13,22 @@ public:
virtual void vftable_4()=0;
virtual void vftable_8()=0;
virtual void vftable_C()=0;
virtual void vftable_10()=0;
virtual void vftable_14()=0;
virtual void vftable_18()=0;
virtual void vftable_1C()=0;
virtual void vftable_20()=0;
virtual void vftable_24()=0;
virtual void vftable_28()=0;
/// Sets how many incoming connections are allowed. If this is less than the number of players currently connected,
/// no more players will be allowed to connect. If this is greater than the maximum number of peers allowed,
/// it will be reduced to the maximum number of peers allowed. Defaults to 0.
/// \param[in] numberAllowed Maximum number of incoming connections allowed.
virtual void SetMaximumIncomingConnections( unsigned short numberAllowed )=0;
/// Returns the value passed to SetMaximumIncomingConnections()
/// \return the maximum number of incoming connections, which is always <= maxConnections
virtual unsigned short GetMaximumIncomingConnections( void ) const=0;
virtual void vftable_2C()=0;
virtual void vftable_30()=0;
virtual void vftable_34()=0;

View File

@ -67,14 +67,14 @@ void RakServer::vftable_30()
// TODO: RakServer::vftable_30() (server W: 45A2D0 L: 807BE80)
}
void RakServer::vftable_34()
void RakServer::SetAllowedPlayers( unsigned short AllowedPlayers )
{
// TODO: RakServer::vftable_34() (server W: 45A2E0 L: 807BEC0)
RakPeer::SetMaximumIncomingConnections( AllowedPlayers );
}
void RakServer::vftable_38()
unsigned short RakServer::GetAllowedPlayers( void ) const
{
// TODO: RakServer::vftable_38() (server W: 45A2F0 L: 807BEE0)
return RakPeer::GetMaximumIncomingConnections();
}
void RakServer::vftable_3C()

View File

@ -28,8 +28,18 @@ public:
void vftable_28();
void vftable_2C();
void vftable_30();
void vftable_34();
void vftable_38();
/// Set how many players are allowed on the server.
/// If more players are currently connected then are allowed then no more players will be allowed to join until the number of players is less than the number of allowed players.
/// \pre The server must be active for this to have meaning
/// \param[in] AllowedPlayers The number of players to allow
void SetAllowedPlayers( unsigned short AllowedPlayers );
/// Return how many players are allowed to connect. This value was set either from Start or from SetAllowedPlayers.
/// \pre The server must be active for this to have meaning
/// \return The number of allowed players
unsigned short GetAllowedPlayers( void ) const;
void vftable_3C();
void vftable_40();
void vftable_44();

View File

@ -25,8 +25,18 @@ public:
virtual void vftable_28()=0;
virtual void vftable_2C()=0;
virtual void vftable_30()=0;
virtual void vftable_34()=0;
virtual void vftable_38()=0;
/// Set how many players are allowed on the server.
/// If more players are currently connected then are allowed then no more players will be allowed to join until the number of players is less than the number of allowed players.
/// \pre The server must be active for this to have meaning
/// \param[in] AllowedPlayers The number of players to allow
virtual void SetAllowedPlayers( unsigned short AllowedPlayers )=0;
/// Return how many players are allowed to connect. This value was set either from Start or from SetAllowedPlayers.
/// \pre The server must be active for this to have meaning
/// \return The number of allowed players
virtual unsigned short GetAllowedPlayers( void ) const=0;
virtual void vftable_3C()=0;
virtual void vftable_40()=0;
virtual void vftable_44()=0;