OpenTTD Source
20240919-master-gdf0233f4c2
|
Go to the documentation of this file.
10 #include "../stdafx.h"
12 #include "../script/squirrel_class.hpp"
16 #include "../3rdparty/fmt/format.h"
18 #include "../safeguards.h"
21 void GameScannerInfo::Initialize()
23 ScriptScanner::Initialize(
"GSScanner");
38 if (this->
info_list.empty())
return nullptr;
39 if (name.empty())
return nullptr;
48 if (force_exact_match) {
50 std::string name_with_version = fmt::format(
"{}.{}", name, version);
51 auto it = this->
info_list.find(name_with_version);
57 int highest_version = -1;
61 for (
const auto &item : this->
info_list) {
73 void GameScannerLibrary::Initialize()
75 ScriptScanner::Initialize(
"GSScanner");
92 std::string library_name = fmt::format(
"{}.{}", library, version);
95 ScriptInfoList::iterator it = this->
info_list.find(library_name);
96 if (it == this->
info_list.end())
return nullptr;
std::string GetScriptName(ScriptInfo *info) override
Get the script name how to store the script in memory.
class GameLibrary * FindLibrary(const std::string &library, int version)
Find a library in the pool.
class Squirrel * engine
The engine we're scanning with.
const std::string & GetCategory() const
Get the category this library is in.
void RegisterAPI(class Squirrel *engine) override
Register the API for this ScriptInfo.
bool CanLoadFromVersion(int version) const
Check if we can start this Game.
const std::string & GetName() const
Get the Name of the script.
static void RegisterAPI(Squirrel *engine)
Register the functions of this class.
static void RegisterAPI(Squirrel *engine)
Register the functions of this class.
ScriptInfoList info_list
The list of all script.
int GetVersion() const
Get the version of the script.
std::string GetScriptName(ScriptInfo *info) override
Get the script name how to store the script in memory.
All static information from an Game like name, version, etc.
bool StrEqualsIgnoreCase(const std::string_view str1, const std::string_view str2)
Compares two string( view)s for equality, while ignoring the case of the characters.
class GameInfo * FindInfo(const std::string &name, int version, bool force_exact_match)
Check if we have a game by name and version available in our list.
void RegisterAPI(class Squirrel *engine) override
Register the API for this ScriptInfo.
All static information from an Game library like name, version, etc.
const std::string & GetInstanceName() const
Get the name of the instance of the script to create.
All static information from an Script like name, version, etc.
ScriptInfoList info_single_list
The list of all unique script. The best script (highest version) is shown.