OpenTTD Source  20241108-master-g80f628063a
AIScannerLibrary Class Reference
Inheritance diagram for AIScannerLibrary:
ScriptScanner FileScanner

Public Member Functions

void Initialize () override
 
class AILibraryFindLibrary (const std::string &library, int version)
 Find a library in the pool. More...
 
- Public Member Functions inherited from ScriptScanner
class SquirrelGetEngine ()
 Get the engine of the main squirrel handler (it indexes all available scripts).
 
std::string GetMainScript ()
 Get the current main script the ScanDir is currently tracking.
 
std::string GetTarFile ()
 Get the current tar file the ScanDir is currently tracking.
 
const ScriptInfoListGetInfoList ()
 Get the list of all registered scripts.
 
const ScriptInfoListGetUniqueInfoList ()
 Get the list of the latest version of all registered scripts.
 
void RegisterScript (class ScriptInfo *info)
 Register a ScriptInfo to the scanner.
 
void GetConsoleList (std::back_insert_iterator< std::string > &output_iterator, bool newest_only) const
 Get the list of registered scripts to print on the console. More...
 
bool HasScript (const struct ContentInfo *ci, bool md5sum)
 Check whether we have a script with the exact characteristics as ci. More...
 
const char * FindMainScript (const ContentInfo *ci, bool md5sum)
 Find a script of a ContentInfo. More...
 
bool AddFile (const std::string &filename, size_t basepath_length, const std::string &tar_filename) override
 Add a file with the given filename. More...
 
void RescanDir ()
 Rescan the script dir.
 
- Public Member Functions inherited from FileScanner
virtual ~FileScanner ()=default
 Destruct the proper one...
 
uint Scan (std::string_view extension, Subdirectory sd, bool tars=true, bool recursive=true)
 Scan for files with the given extension in the given search path. More...
 
uint Scan (std::string_view extension, const std::string &directory, bool recursive=true)
 Scan for files with the given extension in the given search path. More...
 

Protected Member Functions

std::string GetScriptName (ScriptInfo *info) override
 Get the script name how to store the script in memory.
 
const char * GetFileName () const override
 Get the filename to scan for this type of script.
 
Subdirectory GetDirectory () const override
 Get the directory to scan in.
 
const char * GetScannerName () const override
 Get the type of the script, in plural.
 
void RegisterAPI (class Squirrel *engine) override
 Register the API for this ScriptInfo.
 
- Protected Member Functions inherited from ScriptScanner
void Initialize (const char *name)
 Initialize the scanner. More...
 
void Reset ()
 Reset all allocated lists.
 
void ResetEngine ()
 Reset the engine to ensure a clean environment for further steps.
 

Additional Inherited Members

- Protected Attributes inherited from ScriptScanner
class Squirrelengine
 The engine we're scanning with.
 
std::string main_script
 The full path of the script.
 
std::string tar_file
 If, which tar file the script was in.
 
ScriptInfoList info_list
 The list of all script.
 
ScriptInfoList info_single_list
 The list of all unique script. The best script (highest version) is shown.
 
- Protected Attributes inherited from FileScanner
Subdirectory subdir
 The current sub directory we are searching through.
 

Detailed Description

Definition at line 53 of file ai_scanner.hpp.

Member Function Documentation

◆ FindLibrary()

AILibrary * AIScannerLibrary::FindLibrary ( const std::string &  library,
int  version 
)

Find a library in the pool.

Parameters
libraryThe library name to find.
versionThe version the library should have.
Returns
The library if found, nullptr otherwise.

Definition at line 148 of file ai_scanner.cpp.

References ScriptScanner::info_list.

Referenced by AI::FindLibrary().


The documentation for this class was generated from the following files: