about summary refs log tree commit diff stats
path: root/data/maps/the_sun_temple/rooms/Temple.txtpb
blob: 4f39737044793685644de121b69ee3a60e080eb5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
generated by cgit-pink 1.4.1 (git 2.36.1) at 2026-01-19 21:00:00 +0000
 


 class="o">>();
    hybrid_areas = file["hybrid_areas"].as<bool>();
    show_hunt_panels = file["show_hunt_panels"].as<bool>();

    if (file["connection_history"]) {
      for (const auto& connection : file["connection_history"]) {
        connection_history.push_back(ConnectionDetails{
          .ap_server = connection["ap_server"].as<std::string>(),
          .ap_player = connection["ap_player"].as<std::string>(),
          .ap_password = connection["ap_password"].as<std::string>()
        });
      }
    }
  } catch (const std::exception&) {
    // It's fine if the file can't be loaded.
  }
}

void TrackerConfig::Save() {
  YAML::Node output;
  output["ap_server"] = connection_details.ap_server;
  output["ap_player"] = connection_details.ap_player;
  output["ap_password"] = connection_details.ap_password;
  output["asked_to_check_for_updates"] = asked_to_check_for_updates;
  output["should_check_for_updates"] = should_check_for_updates;
  output["hybrid_areas"] = hybrid_areas;
  output["show_hunt_panels"] = show_hunt_panels;
  
  output.remove("connection_history");
  for (const ConnectionDetails& details : connection_history) {
    YAML::Node connection;
    connection["ap_server"] = details.ap_server;
    connection["ap_player"] = details.ap_player;
    connection["ap_password"] = details.ap_password;

    output["connection_history"].push_back(connection);
  }

  std::ofstream filewriter(filename_);
  filewriter << output;
}

TrackerConfig& GetTrackerConfig() {
  static TrackerConfig* instance =
      new TrackerConfig(GetAbsolutePath("config.yaml"));
  return *instance;
}