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:
52 AIInfo *info_dummy;
53 };
54
55 class AIScannerLibrary : public ScriptScanner {
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 */
ScriptInfo::version
int version
Version of the script.
Definition: script_info.hpp:165
Subdirectory
Subdirectory
The different kinds of subdirectories OpenTTD uses.
Definition: fileio_type.h:110
AIScannerInfo::SetDummyAI
void SetDummyAI(class AIInfo *info)
Set the Dummy AI.
Definition: ai_scanner.cpp:41
AIScannerLibrary::GetDirectory
Subdirectory GetDirectory() const
Get the directory to scan in.
Definition: ai_scanner.hpp:70
AIScannerInfo
Definition: ai_scanner.hpp:17
AIScannerInfo::GetScannerName
const char * GetScannerName() const
Get the type of the script, in plural.
Definition: ai_scanner.hpp:48
AIScannerInfo::info_dummy
AIInfo * info_dummy
The dummy AI.
Definition: ai_scanner.hpp:52
ScriptScanner
Scanner to help finding scripts.
Definition: script_scanner.hpp:22
ScriptInfo
All static information from an Script like name, version, etc.
Definition: script_info.hpp:32
AIScannerLibrary::GetScannerName
const char * GetScannerName() const
Get the type of the script, in plural.
Definition: ai_scanner.hpp:71
AIScannerInfo::GetScriptName
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
AILibrary
All static information from an AI library like name, version, etc.
Definition: ai_info.hpp:60
AIScannerInfo::FindInfo
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
AIScannerLibrary::GetFileName
const char * GetFileName() const
Get the filename to scan for this type of script.
Definition: ai_scanner.hpp:69
AIScannerInfo::GetDirectory
Subdirectory GetDirectory() const
Get the directory to scan in.
Definition: ai_scanner.hpp:47
ScriptInfo::name
const char * name
Full name of the script.
Definition: script_info.hpp:160
AI_LIBRARY_DIR
Subdirectory for all AI libraries.
Definition: fileio_type.h:122
AIInfo
All static information from an AI like name, version, etc.
Definition: ai_info.hpp:18
AI_DIR
Subdirectory for all AI files.
Definition: fileio_type.h:121
Squirrel
Definition: squirrel.hpp:23
AIScannerInfo::SelectRandomAI
class AIInfo * SelectRandomAI() const
Select a random AI.
Definition: ai_scanner.cpp:61
AIScannerInfo::GetFileName
const char * GetFileName() const
Get the filename to scan for this type of script.
Definition: ai_scanner.hpp:46
ScriptScanner::engine
class Squirrel * engine
The engine we&#39;re scanning with.
Definition: script_scanner.hpp:88
AIScannerInfo::RegisterAPI
void RegisterAPI(class Squirrel *engine)
Register the API for this ScriptInfo.
Definition: ai_scanner.cpp:56
AIScannerLibrary
Definition: ai_scanner.hpp:55