|
|
@ -189,11 +189,17 @@ void ServerFunctions::SetRuleValue(const char *key, double value) noexcept
|
|
|
|
void ServerFunctions::AddDataFileRequirement(const char *dataFilename, const char *checksumString) noexcept
|
|
|
|
void ServerFunctions::AddDataFileRequirement(const char *dataFilename, const char *checksumString) noexcept
|
|
|
|
{
|
|
|
|
{
|
|
|
|
auto &samples = mwmp::Networking::getPtr()->getSamples();
|
|
|
|
auto &samples = mwmp::Networking::getPtr()->getSamples();
|
|
|
|
|
|
|
|
|
|
|
|
auto it = std::find_if(samples.begin(), samples.end(), [&dataFilename](mwmp::PacketPreInit::PluginPair &item) {
|
|
|
|
auto it = std::find_if(samples.begin(), samples.end(), [&dataFilename](mwmp::PacketPreInit::PluginPair &item) {
|
|
|
|
return item.first == dataFilename;
|
|
|
|
return item.first == dataFilename;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (it != samples.end())
|
|
|
|
if (it != samples.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// If this is a filename we've added before, ensure our new checksumString for it isn't empty
|
|
|
|
|
|
|
|
if (strlen(checksumString) != 0)
|
|
|
|
it->second.push_back((unsigned)std::stoul(checksumString));
|
|
|
|
it->second.push_back((unsigned)std::stoul(checksumString));
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mwmp::PacketPreInit::HashList checksumList;
|
|
|
|
mwmp::PacketPreInit::HashList checksumList;
|
|
|
@ -207,9 +213,10 @@ void ServerFunctions::AddDataFileRequirement(const char *dataFilename, const cha
|
|
|
|
}
|
|
|
|
}
|
|
|
|
samples.emplace_back(dataFilename, checksumList);
|
|
|
|
samples.emplace_back(dataFilename, checksumList);
|
|
|
|
|
|
|
|
|
|
|
|
auto mclient = mwmp::Networking::getPtr()->getMasterClient();
|
|
|
|
auto masterClient = mwmp::Networking::getPtr()->getMasterClient();
|
|
|
|
if (mclient)
|
|
|
|
|
|
|
|
mclient->PushPlugin({dataFilename, checksum});
|
|
|
|
if (masterClient)
|
|
|
|
|
|
|
|
masterClient->PushPlugin({dataFilename, checksum});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|