[News] JSON use integer instead of std::string

This commit is contained in:
/dev/root 2017-02-13 21:50:43 +01:00
parent 9c66d49f72
commit 1604cf76e3

View File

@ -64,17 +64,12 @@ namespace Components
std::string error;
json11::Json client = json11::Json::parse(_client.data(), error);
if (client["revision"].is_string())
if (client["revision"].is_number())
{
std::string revisionString = client["revision"].string_value();
int revisionNumber = client["revision"].int_value();
if (!revisionString.empty())
{
int revision = atoi(revisionString.data());
Dvar::Var("cl_updateversion").get<Game::dvar_t*>()->current.integer = revision;
Dvar::Var("cl_updateavailable").get<Game::dvar_t*>()->current.boolean = (revision > REVISION);
}
Dvar::Var("cl_updateversion").get<Game::dvar_t*>()->current.integer = revisionNumber;
Dvar::Var("cl_updateavailable").get<Game::dvar_t*>()->current.boolean = (revisionNumber > REVISION);
}
}
}