author | truebrain |
Fri, 13 Jun 2008 20:19:00 +0000 | |
branch | noai |
changeset 10958 | 65088d587094 |
parent 10871 | 326ee226e9d7 |
child 11043 | e44adcf4ed4d |
permissions | -rw-r--r-- |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
1 |
/* $Id$ */ |
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
2 |
|
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9782
diff
changeset
|
3 |
/** @file ai_controller.hpp The controller of the AI. */ |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
4 |
|
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
5 |
#ifndef AI_CONTROLLER_HPP |
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
6 |
#define AI_CONTROLLER_HPP |
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
7 |
|
10958
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
8 |
#include <map> |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
9 |
#ifndef AI_SQUIRREL_HPP |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
10 |
struct ltstr { bool operator()(const char *s1, const char *s2) const { return strcmp(s1, s2) < 0; } }; |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
11 |
#endif /* AI_SQUIRREL_HPP */ |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
12 |
|
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
13 |
/** |
10643
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
14 |
* The Controller, the class each AI should extend. It creates the AI, makes |
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
15 |
* sure the logic kicks in correctly, and that GetTick() has a valid value. |
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
16 |
*/ |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
17 |
class AIController { |
10958
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
18 |
friend class AISquirrel; |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
19 |
|
9372
bd60b398f92b
(svn r9159) [NoAI] -Change: moved 'tick' from public to private. Use GetTick() to get its value.
truelight
parents:
9364
diff
changeset
|
20 |
public: |
10643
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
21 |
static const char *GetClassName() { return "AIController"; } |
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
22 |
|
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
23 |
/** |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
24 |
* Initializer of the AIController. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
25 |
*/ |
10643
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
26 |
AIController(const char *script, const char *class_name); |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
27 |
|
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
28 |
/** |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
29 |
* Destructor of the AIController. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
30 |
*/ |
10643
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
31 |
~AIController(); |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
32 |
|
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
33 |
/** |
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
34 |
* This function is called to start your AI. Your AI starts here. If you |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
35 |
* return from this function, your AI dies, so make sure that doesn't |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
36 |
* happen. It is okay to use while() {} loops, as long as you put a |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
37 |
* Sleep() in it to give the rest of the game time to do things. Also |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
38 |
* don't keep the system busy for too long, as people will consider |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
39 |
* that annoying. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
40 |
* @note Cannot be called from within your AI. |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
41 |
*/ |
10643
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
42 |
void Start(); |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
43 |
|
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
44 |
/** |
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
45 |
* Increase the internal ticker. You should never call this yourself, |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
46 |
* as it is called by the OpenTTD system itself. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
47 |
* @note Cannot be called from within your AI. |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
48 |
*/ |
10643
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
49 |
void IncreaseTick(); |
9372
bd60b398f92b
(svn r9159) [NoAI] -Change: moved 'tick' from public to private. Use GetTick() to get its value.
truelight
parents:
9364
diff
changeset
|
50 |
|
bd60b398f92b
(svn r9159) [NoAI] -Change: moved 'tick' from public to private. Use GetTick() to get its value.
truelight
parents:
9364
diff
changeset
|
51 |
/** |
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
52 |
* Find at which tick your AI currently is. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
53 |
* @return returns the current tick. |
9372
bd60b398f92b
(svn r9159) [NoAI] -Change: moved 'tick' from public to private. Use GetTick() to get its value.
truelight
parents:
9364
diff
changeset
|
54 |
*/ |
10643
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
55 |
uint GetTick(); |
9441
03da911c8d5f
(svn r9255) [NoAI] -Add: each AI now runs in a seperate thread. The main thread is suspended if any AI thread is running, only one AI thread runs at the time.
truelight
parents:
9439
diff
changeset
|
56 |
|
03da911c8d5f
(svn r9255) [NoAI] -Add: each AI now runs in a seperate thread. The main thread is suspended if any AI thread is running, only one AI thread runs at the time.
truelight
parents:
9439
diff
changeset
|
57 |
/** |
03da911c8d5f
(svn r9255) [NoAI] -Add: each AI now runs in a seperate thread. The main thread is suspended if any AI thread is running, only one AI thread runs at the time.
truelight
parents:
9439
diff
changeset
|
58 |
* Sleep for X ticks. The code continues after this line when the X AI ticks |
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
59 |
* are passed. Mind that an AI tick is different from in-game ticks and |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
60 |
* differ per AI speed. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
61 |
* @param ticks the ticks to wait |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
62 |
* @post the value of GetTick() will be changed exactly 'ticks' in value after |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9444
diff
changeset
|
63 |
* calling this. |
9441
03da911c8d5f
(svn r9255) [NoAI] -Add: each AI now runs in a seperate thread. The main thread is suspended if any AI thread is running, only one AI thread runs at the time.
truelight
parents:
9439
diff
changeset
|
64 |
*/ |
9782
e8d8d8894f23
(svn r12277) [NoAI] -Change: overlay GlobalPointer with local instance access and create sub-node to contain data
truebrain
parents:
9607
diff
changeset
|
65 |
static void Sleep(uint ticks); |
e8d8d8894f23
(svn r12277) [NoAI] -Change: overlay GlobalPointer with local instance access and create sub-node to contain data
truebrain
parents:
9607
diff
changeset
|
66 |
|
e8d8d8894f23
(svn r12277) [NoAI] -Change: overlay GlobalPointer with local instance access and create sub-node to contain data
truebrain
parents:
9607
diff
changeset
|
67 |
/** |
9851
a5f5a7cf2b61
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
truebrain
parents:
9829
diff
changeset
|
68 |
* When Squirrel triggers a print, this function is called. |
a5f5a7cf2b61
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
truebrain
parents:
9829
diff
changeset
|
69 |
* Squirrel calls this when 'print' is used, or when the script made an error. |
a5f5a7cf2b61
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
truebrain
parents:
9829
diff
changeset
|
70 |
* @param error_msg If true, it is a Squirrel error message. |
a5f5a7cf2b61
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
truebrain
parents:
9829
diff
changeset
|
71 |
* @param message The message Squirrel logged. |
a5f5a7cf2b61
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
truebrain
parents:
9829
diff
changeset
|
72 |
* @note Use AILog.Info/Warning/Error instead of 'print'. |
9782
e8d8d8894f23
(svn r12277) [NoAI] -Change: overlay GlobalPointer with local instance access and create sub-node to contain data
truebrain
parents:
9607
diff
changeset
|
73 |
*/ |
e8d8d8894f23
(svn r12277) [NoAI] -Change: overlay GlobalPointer with local instance access and create sub-node to contain data
truebrain
parents:
9607
diff
changeset
|
74 |
static void Print(bool error_msg, const char *message); |
10643
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
75 |
|
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
76 |
private: |
10958
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
77 |
typedef std::map<const char *, const char *, ltstr> LoadedLibraryList; |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
78 |
|
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
79 |
uint tick; |
10643
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
80 |
class Squirrel *engine; |
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
81 |
HSQOBJECT *SQ_instance; |
10958
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
82 |
LoadedLibraryList loaded_library; |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
83 |
int loaded_library_count; |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
84 |
const char *script; |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
85 |
const char *class_name; |
10643
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
86 |
|
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
87 |
/** |
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
88 |
* Register all classes that are known inside the NoAI API. |
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
89 |
*/ |
970417eef395
(svn r13187) [NoAI] -Codechange: rewrote the AI register part; C++ AIs are completely impossible now, and registration happens directly via AISquirrel. This cleans up the registration flow, and makes everything readable again, as sure I made a mess out of it :)
truebrain
parents:
9851
diff
changeset
|
90 |
void RegisterClasses(); |
10958
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
91 |
|
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
92 |
/** |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
93 |
* Check if a library is already loaded. If found, fake_class_name is filled |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
94 |
* with the fake class name as given via AddLoadedLibrary. If not found, |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
95 |
* next_number is set to the next number available for the fake namespace. |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
96 |
* @param library_name The library to check if already loaded. |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
97 |
* @param next_number The next available number for a library if not already loaded. |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
98 |
* @param fake_class_name The name the library has if already loaded. |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
99 |
* @param fake_class_name_len The maximum length of fake_class_name. |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
100 |
* @return True if the library is already loaded. |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
101 |
*/ |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
102 |
bool LoadedLibrary(const char *library_name, int *next_number, char *fake_class_name, int fake_class_name_len); |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
103 |
|
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
104 |
/** |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
105 |
* Add a library as loaded. |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
106 |
*/ |
65088d587094
(svn r13512) [NoAI] -Fix: don't load a library over and over, but keep track of which libraries we have loaded (per AI) and re-use it where possible (reduces memory-footprint)
truebrain
parents:
10871
diff
changeset
|
107 |
void AddLoadedLibrary(const char *library_name, const char *fake_class_name); |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
108 |
}; |
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
109 |
|
9439
b0482f81af3c
(svn r9250) [NoAI] -Fix (r9247): some parts of the ai_controller weren't header protected on purpose, however it wasn't made evident.
rubidium
parents:
9436
diff
changeset
|
110 |
#endif /* AI_CONTROLLER_HPP */ |