MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / FindScenario

Function FindScenario

src/fios.cpp:664–676  ·  view source on GitHub ↗

* Find a given scenario based on its unique ID. * @param ci The content info to compare it to. * @param md5sum Whether to look at the md5sum or the id. * @return The filename of the file, else \c std::nullopt. */

Source from the content-addressed store, hash-verified

662 * @return The filename of the file, else \c std::nullopt.
663 */
664std::optional<std::string_view> FindScenario(const ContentInfo &ci, bool md5sum)
665{
666 _scanner.Scan(false);
667
668 for (ScenarioIdentifier &id : _scanner) {
669 if (md5sum ? (id.md5sum == ci.md5sum)
670 : (id.scenid == ci.unique_id)) {
671 return id.filename;
672 }
673 }
674
675 return std::nullopt;
676}
677
678/**
679 * Check whether we've got a given scenario based on its unique ID.

Callers 2

HasScenarioFunction · 0.85
GetTextfileMethod · 0.85

Calls 1

ScanMethod · 0.45

Tested by

no test coverage detected