|
7 | 7 | #include <fstream> |
8 | 8 | #include <iomanip> |
9 | 9 |
|
| 10 | +// debug |
| 11 | +static constexpr bool is_debugging = false; |
| 12 | +static constexpr uint32_t debug_map_id = 5; |
| 13 | +static constexpr uint32_t debug_event_id = 130; |
| 14 | + |
10 | 15 | using colors = logger::console_colors; |
11 | 16 |
|
12 | 17 | void RPGMakerScraper::load() { |
@@ -56,12 +61,17 @@ void RPGMakerScraper::load() { |
56 | 61 | void RPGMakerScraper::scrape_maps() { |
57 | 62 |
|
58 | 63 | for (const auto &[map_id, name] : map_info_names) { |
| 64 | + // allow easy debugging |
| 65 | + if (is_debugging && map_id != debug_map_id) { |
| 66 | + continue; |
| 67 | + } |
| 68 | + |
59 | 69 | // give hacky visual progress |
60 | 70 | progress_status = |
61 | 71 | utils::format_string(R"(scraping Map%03d...)", map_id); |
62 | 72 | log_colored_nnl(colors::WHITE, colors::BLACK, "%s", progress_status.data()); |
63 | 73 |
|
64 | | - log_colored_nnl(colors::WHITE, colors::BLACK, "%s", |
| 74 | + log_colored_nnl(colors::WHITE, colors::BLACK, "%s", |
65 | 75 | std::string(progress_status.length(), '\b').data()); |
66 | 76 |
|
67 | 77 | // check if the current map we're scraping exists |
@@ -109,6 +119,10 @@ void RPGMakerScraper::scrape_variables() { |
109 | 119 | for (const auto &[map_id, events] : all_events) { |
110 | 120 | // go over every event |
111 | 121 | for (const auto &event : events) { |
| 122 | + // allow easy debugging |
| 123 | + if (is_debugging && event.id != debug_event_id) { |
| 124 | + continue; |
| 125 | + } |
112 | 126 | // go over event page in each event |
113 | 127 | for (size_t page_num = 0, page_count = event.pages.size(); page_num < page_count; ++page_num) { |
114 | 128 | const auto &page = event.pages[page_num]; |
@@ -463,7 +477,11 @@ bool RPGMakerScraper::scrape_command_script(ResultInformation &result_info, cons |
463 | 477 |
|
464 | 478 | constexpr uint32_t expected_param_count = 1; |
465 | 479 |
|
466 | | - if (!command.parameters.size() != expected_param_count) { |
| 480 | + if (command.parameters.size() != expected_param_count) { |
| 481 | + return false; |
| 482 | + } |
| 483 | + |
| 484 | + if (!std::holds_alternative<std::string>(command.parameters[0])) { |
467 | 485 | return false; |
468 | 486 | } |
469 | 487 |
|
|
0 commit comments