mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-21 15:41:35 +02:00
Simplify Startup.json parsing slightly
The lambdas were originally there to allow for different ways to determine whether the version offered by the website is indeed an update. The lambdas became identical in a9cbd784f7
however, which is when this change should have been made.
This commit is contained in:
@@ -46,7 +46,7 @@ namespace http
|
||||
if constexpr (!IGNORE_UPDATES)
|
||||
{
|
||||
auto &versions = document["Updates"];
|
||||
auto parseUpdate = [this, &versions, &startupInfo](ByteString key, UpdateInfo::Channel channel, std::function<bool (int)> updateAvailableFunc) {
|
||||
auto parseUpdate = [this, &versions, &startupInfo](ByteString key, UpdateInfo::Channel channel) {
|
||||
if (!versions.isMember(key))
|
||||
{
|
||||
return;
|
||||
@@ -64,7 +64,7 @@ namespace http
|
||||
return info[key].asInt();
|
||||
};
|
||||
auto build = getOr(key == "Snapshot" ? "Snapshot" : "Build", 0);
|
||||
if (!updateAvailableFunc(build))
|
||||
if (size_t(build) <= APP_VERSION.build)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -79,20 +79,14 @@ namespace http
|
||||
};
|
||||
if constexpr (SNAPSHOT || MOD)
|
||||
{
|
||||
parseUpdate("Snapshot", UpdateInfo::channelSnapshot, [](int build) -> bool {
|
||||
return size_t(build) > APP_VERSION.build;
|
||||
});
|
||||
parseUpdate("Snapshot", UpdateInfo::channelSnapshot);
|
||||
}
|
||||
else
|
||||
{
|
||||
parseUpdate("Stable", UpdateInfo::channelStable, [](int build) -> bool {
|
||||
return size_t(build) > APP_VERSION.build;
|
||||
});
|
||||
parseUpdate("Stable", UpdateInfo::channelStable);
|
||||
if (!startupInfo.updateInfo.has_value())
|
||||
{
|
||||
parseUpdate("Beta", UpdateInfo::channelBeta, [](int build) -> bool {
|
||||
return size_t(build) > APP_VERSION.build;
|
||||
});
|
||||
parseUpdate("Beta", UpdateInfo::channelBeta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user