| 511 | }; |
| 512 | |
| 513 | bool GRFFileScanner::AddFile(const std::string &filename, size_t basepath_length, const std::string &) |
| 514 | { |
| 515 | /* Abort if the user stopped the game during a scan. */ |
| 516 | if (_exit_game) return false; |
| 517 | |
| 518 | bool added = false; |
| 519 | auto c = std::make_unique<GRFConfig>(filename.substr(basepath_length)); |
| 520 | GRFConfig *grfconfig = c.get(); |
| 521 | if (FillGRFDetails(*c, false)) { |
| 522 | if (std::ranges::none_of(_all_grfs, [&c](const auto &gc) { return c->ident.grfid == gc->ident.grfid && c->ident.md5sum == gc->ident.md5sum; })) { |
| 523 | _all_grfs.push_back(std::move(c)); |
| 524 | added = true; |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | this->num_scanned++; |
| 529 | |
| 530 | std::string name = grfconfig->GetName(); |
| 531 | UpdateNewGRFScanStatus(this->num_scanned, std::move(name)); |
| 532 | VideoDriver::GetInstance()->GameLoopPause(); |
| 533 | |
| 534 | return added; |
| 535 | } |
| 536 | |
| 537 | /** |
| 538 | * Simple sorter for GRFS |
nothing calls this directly
no test coverage detected