OpenTTD: AIScannerInfo Class Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Protected Member Functions | Private Attributes
AIScannerInfo Class Reference
Inheritance diagram for AIScannerInfo:

## Public Member Functions
void | Initialize ()
class AIInfo * | SelectRandomAI () const
| Select a random AI.
class AIInfo * | FindInfo (const char *nameParam, int versionParam, bool force_exact_match)
| Check if we have an AI by name and version available in our list.
void | SetDummyAI (class AIInfo *info)
| Set the Dummy AI.
Public Member Functions inherited from ScriptScanner
class Squirrel * | GetEngine ()
| Get the engine of the main squirrel handler (it indexes all available scripts).
const char * | GetMainScript ()
| Get the current main script the ScanDir is currently tracking.
const char * | GetTarFile ()
| Get the current tar file the ScanDir is currently tracking.
const ScriptInfoList * | GetInfoList ()
| Get the list of all registered scripts.
const ScriptInfoList * | GetUniqueInfoList ()
| Get the list of the latest version of all registered scripts.
void | RegisterScript (class ScriptInfo *info)
| Register a ScriptInfo to the scanner.
char * | GetConsoleList (char *p, const char *last, bool newest_only) const
| Get the list of registered scripts to print on the console.
bool | HasScript (const struct ContentInfo *ci, bool md5sum)
| Check whether we have a script with the exact characteristics as ci.
const char * | FindMainScript (const ContentInfo *ci, bool md5sum)
| Find a script of a ContentInfo.
bool | AddFile (const char *filename, size_t basepath_length, const char *tar_filename)
| Add a file with the given filename.
void | RescanDir ()
| Rescan the script dir.
Public Member Functions inherited from FileScanner
virtual | ~FileScanner ()
| Destruct the proper one...
uint | Scan (const char *extension, Subdirectory sd, bool tars=true, bool recursive=true)
| Scan for files with the given extension in the given search path.
uint | Scan (const char *extension, const char *directory, bool recursive=true)
| Scan for files with the given extension in the given search path.

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

## Private Attributes
AIInfo * | info_dummy
| The dummy AI.

## Additional Inherited Members
Protected Attributes inherited from ScriptScanner
class Squirrel * | engine
| The engine we're scanning with.
char * | main_script
| The full path of the script.
char * | 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.

## Detailed Description

Definition at line 17 of file ai_scanner.hpp.

## Member Function Documentation

AIInfo * AIScannerInfo::FindInfo | ( | const char * | nameParam,
|  | int | versionParam,
|  | bool | force_exact_match
| ) |  |

Check if we have an AI by name and version available in our list.

Parameters

  nameParam | The name of the AI.
  versionParam | The version of the AI, or -1 if you want the latest.
  force_exact_match | Only match name+version, never latest.

Returns
  NULL if no match found, otherwise the AI that matched.

Definition at line 95 of file ai_scanner.cpp.

References AIInfo::CanLoadFromVersion(), ScriptInfo::GetName(), ScriptInfo::GetVersion(), ScriptScanner::info_list, ScriptScanner::info_single_list, lastof, seprintf(), strecpy(), and strtolower().

Referenced by AI::FindInfo().

AIInfo * AIScannerInfo::SelectRandomAI | ( |  | ) | const

Select a random AI.

Returns
  A random AI from the pool.

Definition at line 61 of file ai_scanner.cpp.

References _networking, DEBUG, info_dummy, ScriptScanner::info_single_list, RandomRange(), and AIInfo::UseAsRandomAI().

Referenced by AI::StartNew().

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

- src/ai/ai_scanner.hpp
- src/ai/ai_scanner.cpp