Skip to content

Commit

Permalink
Add client-side getServerIp (Fixes #3360)
Browse files Browse the repository at this point in the history
  • Loading branch information
botder committed Jan 8, 2025
1 parent 0a14972 commit c197cf8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaNetworkDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,26 @@
*****************************************************************************/

#include "StdInc.h"
#include "CScriptArgReader.h"

#define MIN_CLIENT_REQ_CALLREMOTE_QUEUE_NAME "1.5.3-9.11270"
#define MIN_CLIENT_REQ_FETCHREMOTE_CONNECT_TIMEOUT "1.3.5"
#define MIN_CLIENT_REQ_CALLREMOTE_OPTIONS_TABLE "1.5.4-9.11342"
#define MIN_CLIENT_REQ_CALLREMOTE_OPTIONS_FORMFIELDS "1.5.4-9.11413"

static auto GetServerIp(std::optional<bool> includePort) -> const char*
{
return g_pNet->GetConnectedServer(includePort.value_or(false));
}

void CLuaNetworkDefs::LoadFunctions()
{
constexpr static const std::pair<const char*, lua_CFunction> functions[]{
{"fetchRemote", FetchRemote},
{"getRemoteRequests", GetRemoteRequests},
{"getRemoteRequestInfo", GetRemoteRequestInfo},
{"abortRemoteRequest", AbortRemoteRequest},
{"getServerIp", ArgumentParser<GetServerIp>},
};

// Add functions
Expand Down

0 comments on commit c197cf8

Please sign in to comment.