diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-14 12:53:59 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-14 12:53:59 -0400 |
commit | bee4194f9e12c9d2210a5ecba7249bdfe3f3deda (patch) | |
tree | 1212b2f05cea09e4fbf8f1a3c57418fb3e92fc36 /src/game_data.cpp | |
parent | dff1d7382f2af91e50561bfdb9eb83773ac7c010 (diff) | |
download | lingo-ap-tracker-bee4194f9e12c9d2210a5ecba7249bdfe3f3deda.tar.gz lingo-ap-tracker-bee4194f9e12c9d2210a5ecba7249bdfe3f3deda.tar.bz2 lingo-ap-tracker-bee4194f9e12c9d2210a5ecba7249bdfe3f3deda.zip |
Switch to wx logging
Diffstat (limited to 'src/game_data.cpp')
-rw-r--r-- | src/game_data.cpp | 59 |
1 files changed, 21 insertions, 38 deletions
diff --git a/src/game_data.cpp b/src/game_data.cpp index 74f872c..7bc3134 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp | |||
@@ -31,9 +31,7 @@ LingoColor GetColorForString(const std::string &str) { | |||
31 | } else if (str == "purple") { | 31 | } else if (str == "purple") { |
32 | return LingoColor::kPurple; | 32 | return LingoColor::kPurple; |
33 | } else { | 33 | } else { |
34 | std::ostringstream errmsg; | 34 | wxLogError("Invalid color: %s", str); |
35 | errmsg << "Invalid color: " << str; | ||
36 | TrackerLog(errmsg.str()); | ||
37 | 35 | ||
38 | return LingoColor::kNone; | 36 | return LingoColor::kNone; |
39 | } | 37 | } |
@@ -83,9 +81,7 @@ struct GameData { | |||
83 | ap_id_by_color_[GetColorForString(input_name)] = | 81 | ap_id_by_color_[GetColorForString(input_name)] = |
84 | ids_config["special_items"][color_name].as<int>(); | 82 | ids_config["special_items"][color_name].as<int>(); |
85 | } else { | 83 | } else { |
86 | std::ostringstream errmsg; | 84 | wxLogError("Missing AP item ID for color %s", color_name); |
87 | errmsg << "Missing AP item ID for color " << color_name; | ||
88 | TrackerLog(errmsg.str()); | ||
89 | } | 85 | } |
90 | }; | 86 | }; |
91 | 87 | ||
@@ -160,8 +156,9 @@ struct GameData { | |||
160 | } | 156 | } |
161 | default: { | 157 | default: { |
162 | // This shouldn't happen. | 158 | // This shouldn't happen. |
163 | std::cout << "Error reading game data: " << entrance_it | 159 | std::ostringstream formatted; |
164 | << std::endl; | 160 | formatted << entrance_it; |
161 | wxLogError("Error reading game data: %s", formatted.str()); | ||
165 | break; | 162 | break; |
166 | } | 163 | } |
167 | } | 164 | } |
@@ -281,10 +278,8 @@ struct GameData { | |||
281 | [panels_[panel_id].name] | 278 | [panels_[panel_id].name] |
282 | .as<int>(); | 279 | .as<int>(); |
283 | } else { | 280 | } else { |
284 | std::ostringstream errmsg; | 281 | wxLogError("Missing AP location ID for panel %s - %s", |
285 | errmsg << "Missing AP location ID for panel " | 282 | rooms_[room_id].name, panels_[panel_id].name); |
286 | << rooms_[room_id].name << " - " << panels_[panel_id].name; | ||
287 | TrackerLog(errmsg.str()); | ||
288 | } | 283 | } |
289 | } | 284 | } |
290 | } | 285 | } |
@@ -347,10 +342,8 @@ struct GameData { | |||
347 | [doors_[door_id].name]["item"] | 342 | [doors_[door_id].name]["item"] |
348 | .as<int>(); | 343 | .as<int>(); |
349 | } else { | 344 | } else { |
350 | std::ostringstream errmsg; | 345 | wxLogError("Missing AP item ID for door %s - %s", |
351 | errmsg << "Missing AP item ID for door " << rooms_[room_id].name | 346 | rooms_[room_id].name, doors_[door_id].name); |
352 | << " - " << doors_[door_id].name; | ||
353 | TrackerLog(errmsg.str()); | ||
354 | } | 347 | } |
355 | } | 348 | } |
356 | 349 | ||
@@ -364,10 +357,8 @@ struct GameData { | |||
364 | ids_config["door_groups"][doors_[door_id].group_name] | 357 | ids_config["door_groups"][doors_[door_id].group_name] |
365 | .as<int>(); | 358 | .as<int>(); |
366 | } else { | 359 | } else { |
367 | std::ostringstream errmsg; | 360 | wxLogError("Missing AP item ID for door group %s", |
368 | errmsg << "Missing AP item ID for door group " | 361 | doors_[door_id].group_name); |
369 | << doors_[door_id].group_name; | ||
370 | TrackerLog(errmsg.str()); | ||
371 | } | 362 | } |
372 | } | 363 | } |
373 | 364 | ||
@@ -377,13 +368,11 @@ struct GameData { | |||
377 | } else if (!door_it.second["skip_location"] && | 368 | } else if (!door_it.second["skip_location"] && |
378 | !door_it.second["event"]) { | 369 | !door_it.second["event"]) { |
379 | if (has_external_panels) { | 370 | if (has_external_panels) { |
380 | std::ostringstream errmsg; | 371 | wxLogError( |
381 | errmsg | 372 | "%s - %s has panels from other rooms but does not have an " |
382 | << rooms_[room_id].name << " - " << doors_[door_id].name | 373 | "explicit location name and is not marked skip_location or " |
383 | << " has panels from other rooms but does not have an " | 374 | "event", |
384 | "explicit " | 375 | rooms_[room_id].name, doors_[door_id].name); |
385 | "location name and is not marked skip_location or event"; | ||
386 | TrackerLog(errmsg.str()); | ||
387 | } | 376 | } |
388 | 377 | ||
389 | doors_[door_id].location_name = | 378 | doors_[door_id].location_name = |
@@ -403,10 +392,8 @@ struct GameData { | |||
403 | [doors_[door_id].name]["location"] | 392 | [doors_[door_id].name]["location"] |
404 | .as<int>(); | 393 | .as<int>(); |
405 | } else { | 394 | } else { |
406 | std::ostringstream errmsg; | 395 | wxLogError("Missing AP location ID for door %s - %s", |
407 | errmsg << "Missing AP location ID for door " | 396 | rooms_[room_id].name, doors_[door_id].name); |
408 | << rooms_[room_id].name << " - " << doors_[door_id].name; | ||
409 | TrackerLog(errmsg.str()); | ||
410 | } | 397 | } |
411 | } | 398 | } |
412 | 399 | ||
@@ -472,10 +459,8 @@ struct GameData { | |||
472 | progressive_item_id = | 459 | progressive_item_id = |
473 | ids_config["progression"][progressive_item_name].as<int>(); | 460 | ids_config["progression"][progressive_item_name].as<int>(); |
474 | } else { | 461 | } else { |
475 | std::ostringstream errmsg; | 462 | wxLogError("Missing AP item ID for progressive item %s", |
476 | errmsg << "Missing AP item ID for progressive item " | 463 | progressive_item_name); |
477 | << progressive_item_name; | ||
478 | TrackerLog(errmsg.str()); | ||
479 | } | 464 | } |
480 | 465 | ||
481 | int index = 1; | 466 | int index = 1; |
@@ -606,9 +591,7 @@ struct GameData { | |||
606 | 591 | ||
607 | // Report errors. | 592 | // Report errors. |
608 | for (const std::string &area : malconfigured_areas_) { | 593 | for (const std::string &area : malconfigured_areas_) { |
609 | std::ostringstream errstr; | 594 | wxLogError("Area data not found for: %s", area); |
610 | errstr << "Area data not found for: " << area; | ||
611 | TrackerLog(errstr.str()); | ||
612 | } | 595 | } |
613 | 596 | ||
614 | // Read in subway items. | 597 | // Read in subway items. |