[News] String version fallback

This commit is contained in:
momo5502 2017-02-13 22:36:29 +01:00
parent 954cd227ce
commit 07b19aed3e

View File

@ -64,15 +64,22 @@ namespace Components
std::string error;
json11::Json client = json11::Json::parse(_client.data(), error);
int revisionNumber = 0;
if (client["revision"].is_number())
{
int revisionNumber = client["revision"].int_value();
revisionNumber = client["revision"].int_value();
}
else if (client["revision"].is_string())
{
revisionNumber = atoi(client["revision"].string_value().data());
}
else return;
Dvar::Var("cl_updateversion").get<Game::dvar_t*>()->current.integer = revisionNumber;
Dvar::Var("cl_updateavailable").get<Game::dvar_t*>()->current.boolean = (revisionNumber > REVISION);
}
}
}
void News::LaunchUpdater(std::string params)
{