Skip to content

Commit c197cf8

Browse files
committed
Add client-side getServerIp (Fixes #3360)
1 parent 0a14972 commit c197cf8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Client/mods/deathmatch/logic/luadefs/CLuaNetworkDefs.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,26 @@
88
*****************************************************************************/
99

1010
#include "StdInc.h"
11+
#include "CScriptArgReader.h"
1112

1213
#define MIN_CLIENT_REQ_CALLREMOTE_QUEUE_NAME "1.5.3-9.11270"
1314
#define MIN_CLIENT_REQ_FETCHREMOTE_CONNECT_TIMEOUT "1.3.5"
1415
#define MIN_CLIENT_REQ_CALLREMOTE_OPTIONS_TABLE "1.5.4-9.11342"
1516
#define MIN_CLIENT_REQ_CALLREMOTE_OPTIONS_FORMFIELDS "1.5.4-9.11413"
1617

18+
static auto GetServerIp(std::optional<bool> includePort) -> const char*
19+
{
20+
return g_pNet->GetConnectedServer(includePort.value_or(false));
21+
}
22+
1723
void CLuaNetworkDefs::LoadFunctions()
1824
{
1925
constexpr static const std::pair<const char*, lua_CFunction> functions[]{
2026
{"fetchRemote", FetchRemote},
2127
{"getRemoteRequests", GetRemoteRequests},
2228
{"getRemoteRequestInfo", GetRemoteRequestInfo},
2329
{"abortRemoteRequest", AbortRemoteRequest},
30+
{"getServerIp", ArgumentParser<GetServerIp>},
2431
};
2532

2633
// Add functions

0 commit comments

Comments
 (0)