mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 22:36:43 +00:00
[Server] Implement getPluginListSample()
This commit is contained in:
parent
b223d0fa1e
commit
5ddad6a4c6
2 changed files with 30 additions and 0 deletions
|
@ -350,6 +350,33 @@ Networking *Networking::getPtr()
|
||||||
return sThis;
|
return sThis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Networking::PluginListSample Networking::getPluginListSample()
|
||||||
|
{
|
||||||
|
PluginListSample pls;
|
||||||
|
unsigned id = 0;
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
unsigned field = 0;
|
||||||
|
auto name = "";
|
||||||
|
Script::Call<Script::CallbackIdentity("OnRequestPluginList")>(name, id, field);
|
||||||
|
if(strlen(name) == 0)
|
||||||
|
break;
|
||||||
|
HashList hashList;
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
auto hash = "";
|
||||||
|
Script::Call<Script::CallbackIdentity("OnRequestPluginList")>(hash, id, field);
|
||||||
|
if(strlen(hash) == 0)
|
||||||
|
break;
|
||||||
|
hashList.push_back((unsigned)stoul(hash));
|
||||||
|
field++;
|
||||||
|
}
|
||||||
|
pls.push_back({name, hashList});
|
||||||
|
id++;
|
||||||
|
}
|
||||||
|
return pls;
|
||||||
|
}
|
||||||
|
|
||||||
void Networking::stopServer(int code)
|
void Networking::stopServer(int code)
|
||||||
{
|
{
|
||||||
running = false;
|
running = false;
|
||||||
|
|
|
@ -55,7 +55,10 @@ namespace mwmp
|
||||||
static const Networking &get();
|
static const Networking &get();
|
||||||
static Networking *getPtr();
|
static Networking *getPtr();
|
||||||
|
|
||||||
|
typedef std::vector<unsigned> HashList;
|
||||||
|
typedef std::vector<std::pair<std::string, HashList>> PluginListSample;
|
||||||
private:
|
private:
|
||||||
|
PluginListSample getPluginListSample();
|
||||||
std::string serverPassword;
|
std::string serverPassword;
|
||||||
static Networking *sThis;
|
static Networking *sThis;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue