1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Actually expose network statistics functions.

Include an int version just inc ase a 32 bit float would overflow.
This commit is contained in:
Sandu Liviu Catalin 2019-08-13 18:34:09 +03:00
parent 413bf546b6
commit 8ad6a0f500
2 changed files with 24 additions and 4 deletions

View File

@ -402,12 +402,25 @@ void CPlayer::SetOptionEx(Int32 option_id, bool toggle, Int32 header, LightObj &
}
// ------------------------------------------------------------------------------------------------
Float64 CPlayer::GetNetworkStatistics(Int32 option_id) const
SQFloat CPlayer::GetNetworkStatisticsF(Int32 option_id) const
{
// Validate the managed identifier
Validate();
// Return the requested information
return _Func->GetNetworkStatistics(m_ID, static_cast< vcmpNetworkStatisticsOption >(option_id));
// Retrieve the requested information
double value = _Func->GetNetworkStatistics(m_ID, static_cast< vcmpNetworkStatisticsOption >(option_id));
// Return it in the proper type
return static_cast< SQFloat >(value);
}
// ------------------------------------------------------------------------------------------------
SQInteger CPlayer::GetNetworkStatisticsI(Int32 option_id) const
{
// Validate the managed identifier
Validate();
// Retrieve the requested information
double value = _Func->GetNetworkStatistics(m_ID, static_cast< vcmpNetworkStatisticsOption >(option_id));
// Return it in the proper type
return static_cast< SQInteger >(value);
}
// ------------------------------------------------------------------------------------------------
@ -2811,6 +2824,8 @@ void Register_CPlayer(HSQUIRRELVM vm)
.Func(_SC("GetOption"), &CPlayer::GetOption)
.Func(_SC("SetOption"), &CPlayer::SetOption)
.Func(_SC("SetOptionEx"), &CPlayer::SetOptionEx)
.Func(_SC("GetNetworkStatisticsF"), &CPlayer::GetNetworkStatisticsF)
.Func(_SC("GetNetworkStatisticsI"), &CPlayer::GetNetworkStatisticsI)
.Func(_SC("WorldCompatible"), &CPlayer::IsWorldCompatible)
.Func(_SC("SetColor"), &CPlayer::SetColorEx)
.Func(_SC("SetColour"), &CPlayer::SetColorEx)

View File

@ -328,7 +328,12 @@ public:
/* --------------------------------------------------------------------------------------------
* Retrieve network statistics related to the managed player entity.
*/
Float64 GetNetworkStatistics(Int32 option_id) const;
SQFloat GetNetworkStatisticsF(Int32 option_id) const;
/* --------------------------------------------------------------------------------------------
* Retrieve network statistics related to the managed player entity.
*/
SQInteger GetNetworkStatisticsI(Int32 option_id) const;
/* --------------------------------------------------------------------------------------------
* Retrieve the world in which the managed player entity exists.