Flip order between GetServerMap and GetServerPlaylist

This commit is contained in:
Kawe Mazidjatari 2022-07-01 23:37:27 +02:00
parent 1ce2a920db
commit eca293e551
3 changed files with 21 additions and 21 deletions

View File

@ -162,25 +162,6 @@ namespace VSquirrel
return SQ_OK; return SQ_OK;
} }
//-----------------------------------------------------------------------------
// Purpose: get server's current playlist via serverlist index
//-----------------------------------------------------------------------------
SQRESULT GetServerPlaylist(HSQUIRRELVM v)
{
SQInteger iServer = sq_getinteger(v, 1);
if (iServer >= static_cast<SQInteger>(g_pBrowser->m_vServerList.size()))
{
v_SQVM_RaiseError(v, "Index must be less than %i.\n",
static_cast<SQInteger>(g_pBrowser->m_vServerList.size()));
return SQ_ERROR;
}
string svServerPlaylist = g_pBrowser->m_vServerList[iServer].m_svPlaylist;
sq_pushstring(v, svServerPlaylist.c_str(), -1);
return SQ_OK;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: get server's current map via serverlist index // Purpose: get server's current map via serverlist index
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -200,6 +181,25 @@ namespace VSquirrel
return SQ_OK; return SQ_OK;
} }
//-----------------------------------------------------------------------------
// Purpose: get server's current playlist via serverlist index
//-----------------------------------------------------------------------------
SQRESULT GetServerPlaylist(HSQUIRRELVM v)
{
SQInteger iServer = sq_getinteger(v, 1);
if (iServer >= static_cast<SQInteger>(g_pBrowser->m_vServerList.size()))
{
v_SQVM_RaiseError(v, "Index must be less than %i.\n",
static_cast<SQInteger>(g_pBrowser->m_vServerList.size()));
return SQ_ERROR;
}
string svServerPlaylist = g_pBrowser->m_vServerList[iServer].m_svPlaylist;
sq_pushstring(v, svServerPlaylist.c_str(), -1);
return SQ_OK;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: get server's current player count via serverlist index // Purpose: get server's current player count via serverlist index
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -39,8 +39,8 @@ namespace VSquirrel
{ {
SQRESULT GetServerName(HSQUIRRELVM v); SQRESULT GetServerName(HSQUIRRELVM v);
SQRESULT GetServerDescription(HSQUIRRELVM v); SQRESULT GetServerDescription(HSQUIRRELVM v);
SQRESULT GetServerPlaylist(HSQUIRRELVM v);
SQRESULT GetServerMap(HSQUIRRELVM v); SQRESULT GetServerMap(HSQUIRRELVM v);
SQRESULT GetServerPlaylist(HSQUIRRELVM v);
SQRESULT GetServerCurrentPlayers(HSQUIRRELVM v); SQRESULT GetServerCurrentPlayers(HSQUIRRELVM v);
SQRESULT GetServerMaxPlayers(HSQUIRRELVM v); SQRESULT GetServerMaxPlayers(HSQUIRRELVM v);
SQRESULT GetServerCount(HSQUIRRELVM v); SQRESULT GetServerCount(HSQUIRRELVM v);

View File

@ -83,8 +83,8 @@ void Script_RegisterUIFunctions(CSquirrelVM* pSquirrelVM)
// Functions for retrieving server browser data // Functions for retrieving server browser data
Script_RegisterFunction(pSquirrelVM, "GetServerName", "Script_GetServerName", "Gets the name of the server at the specified index of the server list", "string", "int", &VSquirrel::UI::GetServerName); Script_RegisterFunction(pSquirrelVM, "GetServerName", "Script_GetServerName", "Gets the name of the server at the specified index of the server list", "string", "int", &VSquirrel::UI::GetServerName);
Script_RegisterFunction(pSquirrelVM, "GetServerDescription", "Script_GetServerDescription", "Gets the description of the server at the specified index of the server list", "string", "int", &VSquirrel::UI::GetServerDescription); Script_RegisterFunction(pSquirrelVM, "GetServerDescription", "Script_GetServerDescription", "Gets the description of the server at the specified index of the server list", "string", "int", &VSquirrel::UI::GetServerDescription);
Script_RegisterFunction(pSquirrelVM, "GetServerPlaylist", "Script_GetServerPlaylist", "Gets the playlist of the server at the specified index of the server list", "string", "int", &VSquirrel::UI::GetServerPlaylist);
Script_RegisterFunction(pSquirrelVM, "GetServerMap", "Script_GetServerMap", "Gets the map of the server at the specified index of the server list", "string", "int", &VSquirrel::UI::GetServerMap); Script_RegisterFunction(pSquirrelVM, "GetServerMap", "Script_GetServerMap", "Gets the map of the server at the specified index of the server list", "string", "int", &VSquirrel::UI::GetServerMap);
Script_RegisterFunction(pSquirrelVM, "GetServerPlaylist", "Script_GetServerPlaylist", "Gets the playlist of the server at the specified index of the server list", "string", "int", &VSquirrel::UI::GetServerPlaylist);
Script_RegisterFunction(pSquirrelVM, "GetServerCurrentPlayers", "Script_GetServerCurrentPlayers", "Gets the current player count of the server at the specified index of the server list", "int", "int", &VSquirrel::UI::GetServerCurrentPlayers); Script_RegisterFunction(pSquirrelVM, "GetServerCurrentPlayers", "Script_GetServerCurrentPlayers", "Gets the current player count of the server at the specified index of the server list", "int", "int", &VSquirrel::UI::GetServerCurrentPlayers);
Script_RegisterFunction(pSquirrelVM, "GetServerMaxPlayers", "Script_GetServerMaxPlayers", "Gets the max player count of the server at the specified index of the server list", "int", "int", &VSquirrel::UI::GetServerMaxPlayers); Script_RegisterFunction(pSquirrelVM, "GetServerMaxPlayers", "Script_GetServerMaxPlayers", "Gets the max player count of the server at the specified index of the server list", "int", "int", &VSquirrel::UI::GetServerMaxPlayers);
Script_RegisterFunction(pSquirrelVM, "GetServerCount", "Script_GetServerCount", "Gets the number of public servers", "int", "", &VSquirrel::UI::GetServerCount); Script_RegisterFunction(pSquirrelVM, "GetServerCount", "Script_GetServerCount", "Gets the number of public servers", "int", "", &VSquirrel::UI::GetServerCount);