If the server is available, ignore the current game in serverinfo

This commit is contained in:
Cameron Gutman 2016-03-10 23:21:51 -08:00
parent f45ecb9edc
commit 0fe15be7b6

View File

@ -42,6 +42,13 @@ NvHTTP.prototype = {
_self.paired = $root.find("PairStatus").text().trim() == 1; _self.paired = $root.find("PairStatus").text().trim() == 1;
_self.currentGame = parseInt($root.find("currentgame").text().trim(), 10); _self.currentGame = parseInt($root.find("currentgame").text().trim(), 10);
_self.serverMajorVersion = parseInt($root.find("appversion").text().trim().substring(0, 1), 10); _self.serverMajorVersion = parseInt($root.find("appversion").text().trim().substring(0, 1), 10);
// GFE 2.8 started keeping currentgame set to the last game played. As a result, it no longer
// has the semantics that its name would indicate. To contain the effects of this change as much
// as possible, we'll force the current game to zero if the server isn't in a streaming session.
if ($root.find("state").text().trim().endsWith("_SERVER_AVAILABLE")) {
_self.currentGame = 0;
}
} }
}); });
}, },