forked from mirror/openmw-tes3mp
Implement SetModname, SetHostname functions
This commit is contained in:
parent
f510a5583f
commit
e92df0c465
2 changed files with 15 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <apps/openmw-mp/Networking.hpp>
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include <components/openmw-mp/Version.hpp>
|
||||
#include "MasterClient.hpp"
|
||||
|
||||
template<typename... Types>
|
||||
constexpr char TypeString<Types...>::value[];
|
||||
|
@ -138,3 +139,13 @@ int ScriptFunctions::GetAvgPing(unsigned short pid) noexcept
|
|||
GET_PLAYER(pid, player,-1);
|
||||
return mwmp::Networking::get().getAvgPing(player->guid);
|
||||
}
|
||||
|
||||
void ScriptFunctions::SetModname(const char *name) noexcept
|
||||
{
|
||||
mwmp::Networking::getPtr()->getMasterClient()->SetModname(name);
|
||||
}
|
||||
|
||||
void ScriptFunctions::SetHostname(const char *name) noexcept
|
||||
{
|
||||
mwmp::Networking::getPtr()->getMasterClient()->SetHostname(name);
|
||||
}
|
||||
|
|
|
@ -62,6 +62,8 @@ public:
|
|||
static const char *GetServerVersion() noexcept;
|
||||
static const char *GetProtocolVersion() noexcept;
|
||||
static int GetAvgPing(unsigned short pid) noexcept;
|
||||
static void SetModname(const char* name) noexcept;
|
||||
static void SetHostname(const char* name) noexcept;
|
||||
|
||||
static constexpr ScriptFunctionData functions[]{
|
||||
{"CreateTimer", ScriptFunctions::CreateTimer},
|
||||
|
@ -82,6 +84,8 @@ public:
|
|||
{"GetServerVersion", ScriptFunctions::GetServerVersion},
|
||||
{"GetProtocolVersion", ScriptFunctions::GetProtocolVersion},
|
||||
{"GetAvgPing", ScriptFunctions::GetAvgPing},
|
||||
{"SetModname", ScriptFunctions::SetModname},
|
||||
{"SetHostname", ScriptFunctions::SetHostname},
|
||||
|
||||
TRANSLOCATIONFUNCTIONS,
|
||||
STATSFUNCTIONS,
|
||||
|
|
Loading…
Reference in a new issue