OpenTTD
ai_scanner.hpp
Go to the documentation of this file.
1 /* $Id: ai_scanner.hpp 26487 2014-04-23 21:16:58Z rubidium $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #ifndef AI_SCANNER_HPP
13 #define AI_SCANNER_HPP
14 
15 #include "../script/script_scanner.hpp"
16 
17 class AIScannerInfo : public ScriptScanner {
18 public:
19  AIScannerInfo();
20  ~AIScannerInfo();
21 
22  /* virtual */ void Initialize();
23 
28  class AIInfo *SelectRandomAI() const;
29 
37  class AIInfo *FindInfo(const char *nameParam, int versionParam, bool force_exact_match);
38 
42  void SetDummyAI(class AIInfo *info);
43 
44 protected:
45  /* virtual */ void GetScriptName(ScriptInfo *info, char *name, const char *last);
46  /* virtual */ const char *GetFileName() const { return PATHSEP "info.nut"; }
47  /* virtual */ Subdirectory GetDirectory() const { return AI_DIR; }
48  /* virtual */ const char *GetScannerName() const { return "AIs"; }
49  /* virtual */ void RegisterAPI(class Squirrel *engine);
50 
51 private:
53 };
54 
56 public:
57  /* virtual */ void Initialize();
58 
65  class AILibrary *FindLibrary(const char *library, int version);
66 
67 protected:
68  /* virtual */ void GetScriptName(ScriptInfo *info, char *name, const char *last);
69  /* virtual */ const char *GetFileName() const { return PATHSEP "library.nut"; }
70  /* virtual */ Subdirectory GetDirectory() const { return AI_LIBRARY_DIR; }
71  /* virtual */ const char *GetScannerName() const { return "AI Libraries"; }
72  /* virtual */ void RegisterAPI(class Squirrel *engine);
73 };
74 
75 #endif /* AI_SCANNER_HPP */
int version
Version of the script.
Subdirectory
The different kinds of subdirectories OpenTTD uses.
Definition: fileio_type.h:110
void SetDummyAI(class AIInfo *info)
Set the Dummy AI.
Definition: ai_scanner.cpp:41
Subdirectory GetDirectory() const
Get the directory to scan in.
Definition: ai_scanner.hpp:70
const char * GetScannerName() const
Get the type of the script, in plural.
Definition: ai_scanner.hpp:48
AIInfo * info_dummy
The dummy AI.
Definition: ai_scanner.hpp:52
Scanner to help finding scripts.
All static information from an Script like name, version, etc.
Definition: script_info.hpp:32
const char * GetScannerName() const
Get the type of the script, in plural.
Definition: ai_scanner.hpp:71
void GetScriptName(ScriptInfo *info, char *name, const char *last)
Get the script name how to store the script in memory.
Definition: ai_scanner.cpp:51
All static information from an AI library like name, version, etc.
Definition: ai_info.hpp:60
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.
Definition: ai_scanner.cpp:95
const char * GetFileName() const
Get the filename to scan for this type of script.
Definition: ai_scanner.hpp:69
Subdirectory GetDirectory() const
Get the directory to scan in.
Definition: ai_scanner.hpp:47
const char * name
Full name of the script.
Subdirectory for all AI libraries.
Definition: fileio_type.h:122
All static information from an AI like name, version, etc.
Definition: ai_info.hpp:18
Subdirectory for all AI files.
Definition: fileio_type.h:121
class AIInfo * SelectRandomAI() const
Select a random AI.
Definition: ai_scanner.cpp:61
const char * GetFileName() const
Get the filename to scan for this type of script.
Definition: ai_scanner.hpp:46
class Squirrel * engine
The engine we&#39;re scanning with.
void RegisterAPI(class Squirrel *engine)
Register the API for this ScriptInfo.
Definition: ai_scanner.cpp:56