Fix handling of extended-data in offline mode

This commit is contained in:
2024-03-12 10:42:10 -05:00
parent 0ab616f48b
commit 7fdb406588
2 changed files with 3 additions and 2 deletions

View File

@@ -35,10 +35,11 @@ class W3DHub
color = @data[:"extended-data"].find { |h| h[:name] == "colour" }[:value].sub("#", "")
color = color.sub("ff", "") if color.length == 8
@color = "ff#{color}".to_i(16)
cfg = @data[:"extended-data"].find { |h| h[:name] == "usesEngineCfg" }
@uses_engine_cfg = (cfg && cfg[:value].downcase.strip == "true") == true # explicit truthy compare to prevent return `nil`
@uses_engine_cfg = (cfg && cfg[:value].to_s.downcase.strip == "true") == true # explicit truthy compare to prevent return `nil`
end
def uses_engine_cfg?