about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ap_state.cpp9
-rw-r--r--src/area_popup.cpp7
-rw-r--r--src/game_data.cpp29
-rw-r--r--src/game_data.h1
-rw-r--r--src/main.cpp2
-rw-r--r--src/tracker_panel.cpp23
-rw-r--r--src/updater.cpp33
-rw-r--r--src/updater.h1
-rw-r--r--src/version.h2
9 files changed, 40 insertions, 67 deletions
diff --git a/src/ap_state.cpp b/src/ap_state.cpp index a969892..8438649 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp
@@ -29,8 +29,8 @@
29#include "tracker_state.h" 29#include "tracker_state.h"
30 30
31constexpr int AP_MAJOR = 0; 31constexpr int AP_MAJOR = 0;
32constexpr int AP_MINOR = 4; 32constexpr int AP_MINOR = 6;
33constexpr int AP_REVISION = 5; 33constexpr int AP_REVISION = 1;
34 34
35constexpr const char* CERT_STORE_PATH = "cacert.pem"; 35constexpr const char* CERT_STORE_PATH = "cacert.pem";
36constexpr int ITEM_HANDLING = 7; // <- all 36constexpr int ITEM_HANDLING = 7; // <- all
@@ -503,8 +503,9 @@ struct APState {
503 : kSUNWARP_ACCESS_NORMAL; 503 : kSUNWARP_ACCESS_NORMAL;
504 sunwarp_shuffle = slot_data.contains("shuffle_sunwarps") && 504 sunwarp_shuffle = slot_data.contains("shuffle_sunwarps") &&
505 slot_data["shuffle_sunwarps"].get<int>() == 1; 505 slot_data["shuffle_sunwarps"].get<int>() == 1;
506 postgame_shuffle = slot_data.contains("shuffle_postgame") && 506 postgame_shuffle = slot_data.contains("shuffle_postgame")
507 slot_data["shuffle_postgame"].get<int>() == 1; 507 ? (slot_data["shuffle_postgame"].get<int>() == 1)
508 : true;
508 509
509 if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) { 510 if (painting_shuffle && slot_data.contains("painting_entrance_to_exit")) {
510 painting_mapping.clear(); 511 painting_mapping.clear();
diff --git a/src/area_popup.cpp b/src/area_popup.cpp index 8ec4dd1..c95e492 100644 --- a/src/area_popup.cpp +++ b/src/area_popup.cpp
@@ -50,11 +50,8 @@ void AreaPopup::ResetIndicators() {
50 for (int section_id = 0; section_id < map_area.locations.size(); 50 for (int section_id = 0; section_id < map_area.locations.size();
51 section_id++) { 51 section_id++) {
52 const Location& location = map_area.locations.at(section_id); 52 const Location& location = map_area.locations.at(section_id);
53 if (IsLocationPostgame(location.ap_location_id)) { 53 if ((!AP_IsLocationVisible(location.classification) ||
54 continue; 54 IsLocationPostgame(location.ap_location_id)) &&
55 }
56
57 if (!AP_IsLocationVisible(location.classification) &&
58 !(location.hunt && 55 !(location.hunt &&
59 GetTrackerConfig().visible_panels == TrackerConfig::kHUNT_PANELS) && 56 GetTrackerConfig().visible_panels == TrackerConfig::kHUNT_PANELS) &&
60 !(location.single_panel && 57 !(location.single_panel &&
diff --git a/src/game_data.cpp b/src/game_data.cpp index 7ce1fb6..94b9888 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp
@@ -29,7 +29,6 @@ struct GameData {
29 std::map<std::string, int> painting_by_id_; 29 std::map<std::string, int> painting_by_id_;
30 30
31 std::vector<int> door_definition_order_; 31 std::vector<int> door_definition_order_;
32 std::vector<int> room_definition_order_;
33 32
34 std::map<std::string, int> room_by_painting_; 33 std::map<std::string, int> room_by_painting_;
35 std::map<int, int> room_by_sunwarp_; 34 std::map<int, int> room_by_sunwarp_;
@@ -92,7 +91,6 @@ struct GameData {
92 91
93 for (const auto &room_it : lingo_config) { 92 for (const auto &room_it : lingo_config) {
94 int room_id = AddOrGetRoom(room_it.first.as<std::string>()); 93 int room_id = AddOrGetRoom(room_it.first.as<std::string>());
95 room_definition_order_.push_back(room_id);
96 94
97 for (const auto &entrance_it : room_it.second["entrances"]) { 95 for (const auto &entrance_it : room_it.second["entrances"]) {
98 int from_room_id = AddOrGetRoom(entrance_it.first.as<std::string>()); 96 int from_room_id = AddOrGetRoom(entrance_it.first.as<std::string>());
@@ -780,31 +778,6 @@ struct GameData {
780 } 778 }
781 } 779 }
782 780
783 // As a workaround for a generator bug in 0.5.1, we are going to remove the
784 // panel door requirement on panels that are defined earlier in the file than
785 // the panel door is. This results in logic that matches the generator, even
786 // if it is not true to how the game should work. This will be reverted once
787 // the logic bug is fixed and released.
788 // See: https://github.com/ArchipelagoMW/Archipelago/pull/4342
789 for (Panel& panel : panels_) {
790 if (panel.panel_door == -1) {
791 continue;
792 }
793 const PanelDoor &panel_door = panel_doors_[panel.panel_door];
794 for (int room_id : room_definition_order_) {
795 if (room_id == panel_door.room) {
796 // The panel door was defined first (or at the same time as the panel),
797 // so we're good.
798 break;
799 } else if (room_id == panel.room) {
800 // The panel was defined first, so we have to pretend the panel door is
801 // not required for this panel.
802 panel.panel_door = -1;
803 break;
804 }
805 }
806 }
807
808 // Report errors. 781 // Report errors.
809 for (const std::string &area : malconfigured_areas_) { 782 for (const std::string &area : malconfigured_areas_) {
810 TrackerLog(fmt::format("Area data not found for: {}", area)); 783 TrackerLog(fmt::format("Area data not found for: {}", area));
@@ -937,7 +910,7 @@ struct GameData {
937 if (!panel_doors_by_id_.count(full_name)) { 910 if (!panel_doors_by_id_.count(full_name)) {
938 int panel_door_id = panel_doors_.size(); 911 int panel_door_id = panel_doors_.size();
939 panel_doors_by_id_[full_name] = panel_door_id; 912 panel_doors_by_id_[full_name] = panel_door_id;
940 panel_doors_.push_back({.room = AddOrGetRoom(room)}); 913 panel_doors_.push_back({});
941 } 914 }
942 915
943 return panel_doors_by_id_[full_name]; 916 return panel_doors_by_id_[full_name];
diff --git a/src/game_data.h b/src/game_data.h index 44084d9..ac911e5 100644 --- a/src/game_data.h +++ b/src/game_data.h
@@ -86,7 +86,6 @@ struct Door {
86}; 86};
87 87
88struct PanelDoor { 88struct PanelDoor {
89 int room;
90 int ap_item_id = -1; 89 int ap_item_id = -1;
91 int group_ap_item_id = -1; 90 int group_ap_item_id = -1;
92 std::vector<ProgressiveRequirement> progressives; 91 std::vector<ProgressiveRequirement> progressives;
diff --git a/src/main.cpp b/src/main.cpp index 1d7cc9e..574b6df 100644 --- a/src/main.cpp +++ b/src/main.cpp
@@ -10,7 +10,7 @@
10 10
11class TrackerApp : public wxApp { 11class TrackerApp : public wxApp {
12 public: 12 public:
13 virtual bool OnInit() { 13 virtual bool OnInit() override {
14 GetTrackerConfig().Load(); 14 GetTrackerConfig().Load();
15 15
16 TrackerFrame *frame = new TrackerFrame(); 16 TrackerFrame *frame = new TrackerFrame();
diff --git a/src/tracker_panel.cpp b/src/tracker_panel.cpp index 0a756e6..ddb4df9 100644 --- a/src/tracker_panel.cpp +++ b/src/tracker_panel.cpp
@@ -55,15 +55,13 @@ void TrackerPanel::UpdateIndicators(bool reset) {
55 for (AreaIndicator &area : areas_) { 55 for (AreaIndicator &area : areas_) {
56 const MapArea &map_area = GD_GetMapArea(area.area_id); 56 const MapArea &map_area = GD_GetMapArea(area.area_id);
57 57
58 if (IsAreaPostgame(area.area_id)) { 58 if ((!AP_IsLocationVisible(map_area.classification) ||
59 area.active = false; 59 IsAreaPostgame(area.area_id)) &&
60 } else if (!AP_IsLocationVisible(map_area.classification) && 60 !(map_area.hunt &&
61 !(map_area.hunt && GetTrackerConfig().visible_panels == 61 GetTrackerConfig().visible_panels == TrackerConfig::kHUNT_PANELS) &&
62 TrackerConfig::kHUNT_PANELS) && 62 !(map_area.has_single_panel &&
63 !(map_area.has_single_panel && 63 GetTrackerConfig().visible_panels == TrackerConfig::kALL_PANELS) &&
64 GetTrackerConfig().visible_panels == 64 !(AP_IsPaintingShuffle() && !map_area.paintings.empty())) {
65 TrackerConfig::kALL_PANELS) &&
66 !(AP_IsPaintingShuffle() && !map_area.paintings.empty())) {
67 area.active = false; 65 area.active = false;
68 } else { 66 } else {
69 area.active = true; 67 area.active = true;
@@ -233,11 +231,10 @@ void TrackerPanel::Redraw() {
233 bool has_unreachable_unchecked = false; 231 bool has_unreachable_unchecked = false;
234 for (const Location &section : map_area.locations) { 232 for (const Location &section : map_area.locations) {
235 bool has_unchecked = false; 233 bool has_unchecked = false;
236 if (IsLocationPostgame(section.ap_location_id)) { 234 if (IsLocationWinCondition(section)) {
237 // Nope.
238 } else if (IsLocationWinCondition(section)) {
239 has_unchecked = !AP_HasReachedGoal(); 235 has_unchecked = !AP_HasReachedGoal();
240 } else if (AP_IsLocationVisible(section.classification)) { 236 } else if (AP_IsLocationVisible(section.classification) &&
237 !IsLocationPostgame(section.ap_location_id)) {
241 has_unchecked = !AP_HasCheckedGameLocation(section.ap_location_id); 238 has_unchecked = !AP_HasCheckedGameLocation(section.ap_location_id);
242 } else if ((section.hunt && GetTrackerConfig().visible_panels == 239 } else if ((section.hunt && GetTrackerConfig().visible_panels ==
243 TrackerConfig::kHUNT_PANELS) || 240 TrackerConfig::kHUNT_PANELS) ||
diff --git a/src/updater.cpp b/src/updater.cpp index 67d5f31..2b05daf 100644 --- a/src/updater.cpp +++ b/src/updater.cpp
@@ -36,7 +36,7 @@ std::string CalculateStringSha256(const wxString& data) {
36 36
37 char output[65] = {0}; 37 char output[65] = {0};
38 for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) { 38 for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) {
39 sprintf(output + (i * 2), "%02x", hash[i]); 39 snprintf(output + (i * 2), 3, "%02x", hash[i]);
40 } 40 }
41 41
42 return std::string(output); 42 return std::string(output);
@@ -172,26 +172,33 @@ void Updater::InstallUpdate(std::string url, std::string checksum,
172 return; 172 return;
173 } 173 }
174 174
175 package_path_.clear(); 175 bool download_issue = false;
176 package_path_.resize(L_tmpnam + 1);
177 tmpnam_s(package_path_.data(), L_tmpnam);
178 176
179 { 177 wxFileName package_path;
180 wxFileOutputStream writeOut(package_path_); 178 package_path.AssignTempFileName("");
179
180 if (!package_path.IsOk()) {
181 download_issue = true;
182 } else {
183 wxFileOutputStream writeOut(package_path.GetFullPath());
181 wxString fileData = packageRequest.GetResponse().AsString(); 184 wxString fileData = packageRequest.GetResponse().AsString();
182 writeOut.WriteAll(fileData.c_str(), fileData.length()); 185 writeOut.WriteAll(fileData.c_str(), fileData.length());
183 186
184 std::string downloadedChecksum = CalculateStringSha256(fileData); 187 std::string downloadedChecksum = CalculateStringSha256(fileData);
185 if (downloadedChecksum != checksum) { 188 if (downloadedChecksum != checksum) {
186 if (wxMessageBox("There was an issue downloading the update. Would you " 189 download_issue = true;
187 "like to manually download it instead?",
188 "Error", wxYES_NO | wxICON_ERROR) == wxID_YES) {
189 wxLaunchDefaultBrowser(kChangelogUrl);
190 }
191 return;
192 } 190 }
193 } 191 }
194 192
193 if (download_issue) {
194 if (wxMessageBox("There was an issue downloading the update. Would you "
195 "like to manually download it instead?",
196 "Error", wxYES_NO | wxICON_ERROR) == wxID_YES) {
197 wxLaunchDefaultBrowser(kChangelogUrl);
198 }
199 return;
200 }
201
195 std::filesystem::path newArea = GetExecutableDirectory(); 202 std::filesystem::path newArea = GetExecutableDirectory();
196 std::filesystem::path oldArea = newArea / "old"; 203 std::filesystem::path oldArea = newArea / "old";
197 std::set<std::filesystem::path> folders; 204 std::set<std::filesystem::path> folders;
@@ -241,7 +248,7 @@ void Updater::InstallUpdate(std::string url, std::string checksum,
241 } 248 }
242 } 249 }
243 250
244 wxFileInputStream fileInputStream(package_path_); 251 wxFileInputStream fileInputStream(package_path.GetFullPath());
245 wxZipInputStream zipStream(fileInputStream); 252 wxZipInputStream zipStream(fileInputStream);
246 std::unique_ptr<wxZipEntry> zipEntry; 253 std::unique_ptr<wxZipEntry> zipEntry;
247 while ((zipEntry = std::unique_ptr<wxZipEntry>(zipStream.GetNextEntry())) != 254 while ((zipEntry = std::unique_ptr<wxZipEntry>(zipStream.GetNextEntry())) !=
diff --git a/src/updater.h b/src/updater.h index 2d2f746..c604a49 100644 --- a/src/updater.h +++ b/src/updater.h
@@ -41,7 +41,6 @@ class Updater : public wxEvtHandler {
41 41
42 wxFrame* parent_; 42 wxFrame* parent_;
43 UpdateState update_state_ = UpdateState::GetVersionInvisible; 43 UpdateState update_state_ = UpdateState::GetVersionInvisible;
44 std::string package_path_;
45}; 44};
46 45
47#endif /* end of include guard: UPDATER_H_809E7381 */ 46#endif /* end of include guard: UPDATER_H_809E7381 */
diff --git a/src/version.h b/src/version.h index 544d563..3439fda 100644 --- a/src/version.h +++ b/src/version.h
@@ -36,6 +36,6 @@ struct Version {
36 } 36 }
37}; 37};
38 38
39constexpr const Version kTrackerVersion = Version(1, 0, 0); 39constexpr const Version kTrackerVersion = Version(2, 0, 2);
40 40
41#endif /* end of include guard: VERSION_H_C757E53C */ \ No newline at end of file 41#endif /* end of include guard: VERSION_H_C757E53C */ \ No newline at end of file