author | truebrain |
Sat, 21 Jun 2008 13:35:29 +0000 | |
branch | noai |
changeset 11043 | e44adcf4ed4d |
parent 10973 | 8577bc56132c |
child 11051 | 00251d01f070 |
permissions | -rw-r--r-- |
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:
diff
changeset
|
1 |
/* $Id$ */ |
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:
diff
changeset
|
2 |
|
9833
89a64246458f
(svn r12496) [NoAI] -Documentation: give the .cpp files a nice uniform format too
truebrain
parents:
9782
diff
changeset
|
3 |
/** @file ai_controller.cpp Implementation of AIControler. */ |
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:
diff
changeset
|
4 |
|
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:
diff
changeset
|
5 |
#include "../../stdafx.h" |
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:
diff
changeset
|
6 |
#include "../../openttd.h" |
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9444
diff
changeset
|
7 |
#include "../../player_func.h" |
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
|
8 |
#include "../../core/alloc_func.hpp" |
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:
10902
diff
changeset
|
9 |
#include "../../string_func.h" |
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
|
10 |
#include "table/strings.h" |
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
|
11 |
|
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
|
12 |
#include <squirrel.h> |
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
|
13 |
#include "../../squirrel.hpp" |
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 |
#include "../../squirrel_helper.hpp" |
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 |
#include "../../squirrel_class.hpp" |
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
|
16 |
#include "../../squirrel_std.hpp" |
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
|
17 |
#include "ai_controller.hpp" |
9444
fd27df7ca2a0
(svn r9260) [NoAI] -Codechange: do the AI threading properly using a mutex and condition signalling.
rubidium
parents:
9441
diff
changeset
|
18 |
#include "../ai_threads.h" |
10889
ecb77cfc4a10
(svn r13440) [NoAI] -Add: introducing ai/library, a method to load libraries into your AI.
truebrain
parents:
10885
diff
changeset
|
19 |
#include "../ai_info.hpp" |
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:
diff
changeset
|
20 |
|
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 |
/* Convert all AI related classes to Squirrel data. |
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 |
* Note: this line a marker in squirrel_export.sh. Do not change! */ |
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
|
23 |
#include "ai_abstractlist.hpp.sq" |
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
|
24 |
#include "ai_accounting.hpp.sq" |
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
|
25 |
#include "ai_airport.hpp.sq" |
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 |
#include "ai_base.hpp.sq" |
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
|
27 |
#include "ai_bridge.hpp.sq" |
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
|
28 |
#include "ai_bridgelist.hpp.sq" |
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
|
29 |
#include "ai_cargo.hpp.sq" |
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
|
30 |
#include "ai_cargolist.hpp.sq" |
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 |
#include "ai_company.hpp.sq" |
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
|
32 |
#include "ai_controller.hpp.sq" |
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
|
33 |
#include "ai_date.hpp.sq" |
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
|
34 |
#include "ai_engine.hpp.sq" |
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
|
35 |
#include "ai_enginelist.hpp.sq" |
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
|
36 |
#include "ai_error.hpp.sq" |
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
|
37 |
#include "ai_event.hpp.sq" |
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
|
38 |
#include "ai_event_types.hpp.sq" |
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
|
39 |
#include "ai_execmode.hpp.sq" |
10852
f02afc46afa8
(svn r13403) [NoAI] -Add: wrapper to read the game settings directly without *any* promises on the results being stable in the future when OpenTTD changes the semantics.
rubidium
parents:
10650
diff
changeset
|
40 |
#include "ai_gamesettings.hpp.sq" |
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
|
41 |
#include "ai_industry.hpp.sq" |
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 |
#include "ai_industrylist.hpp.sq" |
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
|
43 |
#include "ai_list.hpp.sq" |
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
|
44 |
#include "ai_log.hpp.sq" |
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
|
45 |
#include "ai_map.hpp.sq" |
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
|
46 |
#include "ai_marine.hpp.sq" |
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
|
47 |
#include "ai_order.hpp.sq" |
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
|
48 |
#include "ai_road.hpp.sq" |
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 |
#include "ai_settings.hpp.sq" |
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
|
50 |
#include "ai_sign.hpp.sq" |
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
|
51 |
#include "ai_station.hpp.sq" |
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
|
52 |
#include "ai_stationlist.hpp.sq" |
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
|
53 |
#include "ai_subsidy.hpp.sq" |
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
|
54 |
#include "ai_subsidylist.hpp.sq" |
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 |
#include "ai_testmode.hpp.sq" |
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
|
56 |
#include "ai_tile.hpp.sq" |
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
|
57 |
#include "ai_tilelist.hpp.sq" |
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
|
58 |
#include "ai_town.hpp.sq" |
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
|
59 |
#include "ai_townlist.hpp.sq" |
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
|
60 |
#include "ai_transactionmode.hpp.sq" |
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
|
61 |
#include "ai_tunnel.hpp.sq" |
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
|
62 |
#include "ai_vehicle.hpp.sq" |
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
|
63 |
#include "ai_vehiclelist.hpp.sq" |
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
|
64 |
|
11043
e44adcf4ed4d
(svn r13599) [NoAI] -Fix: AIController::Sleep() should always have a value > 0. Warn people if the value is 0 or lower.
truebrain
parents:
10973
diff
changeset
|
65 |
/* static */ void AIController::Sleep(int ticks) |
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:
diff
changeset
|
66 |
{ |
11043
e44adcf4ed4d
(svn r13599) [NoAI] -Fix: AIController::Sleep() should always have a value > 0. Warn people if the value is 0 or lower.
truebrain
parents:
10973
diff
changeset
|
67 |
if (ticks <= 0) { |
e44adcf4ed4d
(svn r13599) [NoAI] -Fix: AIController::Sleep() should always have a value > 0. Warn people if the value is 0 or lower.
truebrain
parents:
10973
diff
changeset
|
68 |
AILog::Warning("Sleep() value should be > 0. Assuming value 1."); |
e44adcf4ed4d
(svn r13599) [NoAI] -Fix: AIController::Sleep() should always have a value > 0. Warn people if the value is 0 or lower.
truebrain
parents:
10973
diff
changeset
|
69 |
ticks = 1; |
e44adcf4ed4d
(svn r13599) [NoAI] -Fix: AIController::Sleep() should always have a value > 0. Warn people if the value is 0 or lower.
truebrain
parents:
10973
diff
changeset
|
70 |
} |
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:
diff
changeset
|
71 |
AI_SuspendPlayer(_current_player, ticks); |
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:
diff
changeset
|
72 |
} |
9782
e8d8d8894f23
(svn r12277) [NoAI] -Change: overlay GlobalPointer with local instance access and create sub-node to contain data
truebrain
parents:
9724
diff
changeset
|
73 |
|
e8d8d8894f23
(svn r12277) [NoAI] -Change: overlay GlobalPointer with local instance access and create sub-node to contain data
truebrain
parents:
9724
diff
changeset
|
74 |
/* static */ void AIController::Print(bool error_msg, const char *message) |
e8d8d8894f23
(svn r12277) [NoAI] -Change: overlay GlobalPointer with local instance access and create sub-node to contain data
truebrain
parents:
9724
diff
changeset
|
75 |
{ |
9851
a5f5a7cf2b61
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
truebrain
parents:
9833
diff
changeset
|
76 |
AILog::Log(error_msg ? AILog::LOG_SQ_ERROR : AILog::LOG_SQ_INFO, message); |
9782
e8d8d8894f23
(svn r12277) [NoAI] -Change: overlay GlobalPointer with local instance access and create sub-node to contain data
truebrain
parents:
9724
diff
changeset
|
77 |
} |
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
|
78 |
|
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
|
79 |
void AIController::RegisterClasses() |
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 |
{ |
10902
57b380ee1607
(svn r13453) [NoAI] -Fix: allow import inside a library (or class, for that matter)
truebrain
parents:
10889
diff
changeset
|
81 |
this->engine->AddMethod("import", &AILibrary::Import, 4, "?ssi"); |
10889
ecb77cfc4a10
(svn r13440) [NoAI] -Add: introducing ai/library, a method to load libraries into your AI.
truebrain
parents:
10885
diff
changeset
|
82 |
|
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
|
83 |
/* Register all classes */ |
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
|
84 |
squirrel_register_std(this->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
|
85 |
SQAIAbstractList_Register(this->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
|
86 |
SQAIAccounting_Register(this->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
|
87 |
SQAIAirport_Register(this->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
|
88 |
SQAIBase_Register(this->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
|
89 |
SQAIBridge_Register(this->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
|
90 |
SQAIBridgeList_Register(this->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
|
91 |
SQAIBridgeList_Length_Register(this->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
|
92 |
SQAICargo_Register(this->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
|
93 |
SQAICargoList_Register(this->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
|
94 |
SQAICompany_Register(this->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
|
95 |
SQAIController_Register(this->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
|
96 |
SQAIDate_Register(this->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
|
97 |
SQAIEngine_Register(this->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
|
98 |
SQAIEngineList_Register(this->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
|
99 |
SQAIError_Register(this->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
|
100 |
SQAIEvent_Register(this->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
|
101 |
SQAIEventCompanyBankrupt_Register(this->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
|
102 |
SQAIEventCompanyInTrouble_Register(this->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
|
103 |
SQAIEventCompanyMerger_Register(this->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
|
104 |
SQAIEventCompanyNew_Register(this->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
|
105 |
SQAIEventController_Register(this->engine); |
10971
aaf89f8c59b9
(svn r13525) [NoAI] -Add: added AIEventEngineAvailable and AIEventStationFirstVehicle
glx
parents:
10958
diff
changeset
|
106 |
SQAIEventEngineAvailable_Register(this->engine); |
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
|
107 |
SQAIEventEnginePreview_Register(this->engine); |
10879
79c0d0e0e155
(svn r13430) [NoAI] -Add: added AIEventIndustry(Open|CLose)
glx
parents:
10871
diff
changeset
|
108 |
SQAIEventIndustryClose_Register(this->engine); |
79c0d0e0e155
(svn r13430) [NoAI] -Add: added AIEventIndustry(Open|CLose)
glx
parents:
10871
diff
changeset
|
109 |
SQAIEventIndustryOpen_Register(this->engine); |
10973
8577bc56132c
(svn r13527) [NoAI] -Fix (r13525): squirrel_export doesn't like extra semicolon
glx
parents:
10971
diff
changeset
|
110 |
SQAIEventStationFirstVehicle_Register(this->engine); |
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
|
111 |
SQAIEventSubsidyAwarded_Register(this->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
|
112 |
SQAIEventSubsidyExpired_Register(this->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
|
113 |
SQAIEventSubsidyOffer_Register(this->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
|
114 |
SQAIEventSubsidyOfferExpired_Register(this->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
|
115 |
SQAIEventTest_Register(this->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
|
116 |
SQAIEventVehicleCrash_Register(this->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
|
117 |
SQAIEventVehicleLost_Register(this->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
|
118 |
SQAIEventVehicleUnprofitable_Register(this->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
|
119 |
SQAIEventVehicleWaitingInDepot_Register(this->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
|
120 |
SQAIExecMode_Register(this->engine); |
10852
f02afc46afa8
(svn r13403) [NoAI] -Add: wrapper to read the game settings directly without *any* promises on the results being stable in the future when OpenTTD changes the semantics.
rubidium
parents:
10650
diff
changeset
|
121 |
SQAIGameSettings_Register(this->engine); |
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
|
122 |
SQAIIndustry_Register(this->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
|
123 |
SQAIIndustryList_Register(this->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
|
124 |
SQAIIndustryList_CargoAccepting_Register(this->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
|
125 |
SQAIIndustryList_CargoProducing_Register(this->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
|
126 |
SQAIList_Register(this->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
|
127 |
SQAILog_Register(this->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
|
128 |
SQAIMap_Register(this->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
|
129 |
SQAIMarine_Register(this->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
|
130 |
SQAIOrder_Register(this->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
|
131 |
SQAIRoad_Register(this->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
|
132 |
SQAISettings_Register(this->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
|
133 |
SQAISign_Register(this->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
|
134 |
SQAIStation_Register(this->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
|
135 |
SQAIStationList_Register(this->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
|
136 |
SQAIStationList_Vehicle_Register(this->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
|
137 |
SQAISubsidy_Register(this->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
|
138 |
SQAISubsidyList_Register(this->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
|
139 |
SQAITestMode_Register(this->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
|
140 |
SQAITile_Register(this->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
|
141 |
SQAITileList_Register(this->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
|
142 |
SQAITileList_IndustryAccepting_Register(this->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
|
143 |
SQAITileList_IndustryProducing_Register(this->engine); |
10864
9a6616a1dce6
(svn r13415) [NoAI] -Add: added AITileList_StationType, giving all the tiles on which a station of your requested type is, for a given station
truebrain
parents:
10852
diff
changeset
|
144 |
SQAITileList_StationType_Register(this->engine); |
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
|
145 |
SQAITown_Register(this->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
|
146 |
SQAITownList_Register(this->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
|
147 |
SQAITransactionMode_Register(this->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
|
148 |
SQAITunnel_Register(this->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
|
149 |
SQAIVehicle_Register(this->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
|
150 |
SQAIVehicleList_Register(this->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
|
151 |
SQAIVehicleList_Station_Register(this->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
|
152 |
|
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
|
153 |
this->engine->SetGlobalPointer(this->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
|
154 |
} |
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
|
155 |
|
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
|
156 |
static void PrintFunc(bool error_msg, const SQChar *message) |
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
|
157 |
{ |
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
|
158 |
/* Convert to OpenTTD internal capable string */ |
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
|
159 |
AIController::Print(error_msg, FS2OTTD(message)); |
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
|
160 |
} |
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
|
161 |
|
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:
10902
diff
changeset
|
162 |
AIController::AIController(const char *script, const char *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:
10902
diff
changeset
|
163 |
tick(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:
10902
diff
changeset
|
164 |
engine(NULL), |
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:
10902
diff
changeset
|
165 |
SQ_instance(NULL), |
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:
10902
diff
changeset
|
166 |
loaded_library_count(0) |
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
|
167 |
{ |
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:
10902
diff
changeset
|
168 |
this->script = strdup(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:
10902
diff
changeset
|
169 |
this->class_name = strdup(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:
10902
diff
changeset
|
170 |
} |
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:
10902
diff
changeset
|
171 |
|
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:
10902
diff
changeset
|
172 |
void AIController::Start() |
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:
10902
diff
changeset
|
173 |
{ |
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:
10902
diff
changeset
|
174 |
assert(this->engine == NULL); |
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
|
175 |
|
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
|
176 |
/* Create the Squirrel Engine and assign all required classes and settings */ |
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
|
177 |
this->engine = new Squirrel(); |
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
|
178 |
this->engine->SetPrintFunction(&PrintFunc); |
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
|
179 |
this->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:
10902
diff
changeset
|
180 |
if (!this->engine->LoadScript(this->script)) { |
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
|
181 |
delete this->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
|
182 |
this->engine = NULL; |
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
|
183 |
return; |
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
|
184 |
} |
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
|
185 |
/* Create the main-class */ |
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
|
186 |
this->SQ_instance = MallocT<SQObject>(sizeof(SQObject)); |
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:
10902
diff
changeset
|
187 |
if (!this->engine->CreateClassInstance(this->class_name, this, this->SQ_instance)) { |
10650
30fc5395b1b8
(svn r13194) [NoAI] -Change [API CHANGE]: split 'main.nut' in 'info.nut' and 'main.nut'. The first contains the information about the AI, the second the AI. This avoid several problems we had. It also speeds up OpenTTD start-up.
truebrain
parents:
10643
diff
changeset
|
188 |
delete this->engine; |
30fc5395b1b8
(svn r13194) [NoAI] -Change [API CHANGE]: split 'main.nut' in 'info.nut' and 'main.nut'. The first contains the information about the AI, the second the AI. This avoid several problems we had. It also speeds up OpenTTD start-up.
truebrain
parents:
10643
diff
changeset
|
189 |
this->engine = NULL; |
30fc5395b1b8
(svn r13194) [NoAI] -Change [API CHANGE]: split 'main.nut' in 'info.nut' and 'main.nut'. The first contains the information about the AI, the second the AI. This avoid several problems we had. It also speeds up OpenTTD start-up.
truebrain
parents:
10643
diff
changeset
|
190 |
return; |
30fc5395b1b8
(svn r13194) [NoAI] -Change [API CHANGE]: split 'main.nut' in 'info.nut' and 'main.nut'. The first contains the information about the AI, the second the AI. This avoid several problems we had. It also speeds up OpenTTD start-up.
truebrain
parents:
10643
diff
changeset
|
191 |
} |
10885
415791bee9d7
(svn r13436) [NoAI] -Change: call the constructor of the SQ when the ->Start() is called of AIController. This makes sure the SQ code is always executed inside the thread, and not inside the main-thread. This has no change what so ever for AIs.
truebrain
parents:
10879
diff
changeset
|
192 |
|
415791bee9d7
(svn r13436) [NoAI] -Change: call the constructor of the SQ when the ->Start() is called of AIController. This makes sure the SQ code is always executed inside the thread, and not inside the main-thread. This has no change what so ever for AIs.
truebrain
parents:
10879
diff
changeset
|
193 |
/* Run the constructor first */ |
415791bee9d7
(svn r13436) [NoAI] -Change: call the constructor of the SQ when the ->Start() is called of AIController. This makes sure the SQ code is always executed inside the thread, and not inside the main-thread. This has no change what so ever for AIs.
truebrain
parents:
10879
diff
changeset
|
194 |
if (this->engine->MethodExists(*this->SQ_instance, "constructor")) { |
415791bee9d7
(svn r13436) [NoAI] -Change: call the constructor of the SQ when the ->Start() is called of AIController. This makes sure the SQ code is always executed inside the thread, and not inside the main-thread. This has no change what so ever for AIs.
truebrain
parents:
10879
diff
changeset
|
195 |
this->engine->CallMethod(*this->SQ_instance, "constructor"); |
415791bee9d7
(svn r13436) [NoAI] -Change: call the constructor of the SQ when the ->Start() is called of AIController. This makes sure the SQ code is always executed inside the thread, and not inside the main-thread. This has no change what so ever for AIs.
truebrain
parents:
10879
diff
changeset
|
196 |
} |
415791bee9d7
(svn r13436) [NoAI] -Change: call the constructor of the SQ when the ->Start() is called of AIController. This makes sure the SQ code is always executed inside the thread, and not inside the main-thread. This has no change what so ever for AIs.
truebrain
parents:
10879
diff
changeset
|
197 |
/* When that is done, start the Start() function */ |
415791bee9d7
(svn r13436) [NoAI] -Change: call the constructor of the SQ when the ->Start() is called of AIController. This makes sure the SQ code is always executed inside the thread, and not inside the main-thread. This has no change what so ever for AIs.
truebrain
parents:
10879
diff
changeset
|
198 |
this->engine->CallMethod(*this->SQ_instance, "Start"); |
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
|
199 |
} |
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
|
200 |
|
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
|
201 |
AIController::~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
|
202 |
{ |
10650
30fc5395b1b8
(svn r13194) [NoAI] -Change [API CHANGE]: split 'main.nut' in 'info.nut' and 'main.nut'. The first contains the information about the AI, the second the AI. This avoid several problems we had. It also speeds up OpenTTD start-up.
truebrain
parents:
10643
diff
changeset
|
203 |
if (this->engine != NULL) delete this->engine; |
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
|
204 |
free(this->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:
10902
diff
changeset
|
205 |
free((void *)this->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:
10902
diff
changeset
|
206 |
free((void *)this->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:
10902
diff
changeset
|
207 |
|
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:
10902
diff
changeset
|
208 |
for (LoadedLibraryList::iterator iter = this->loaded_library.begin(); iter != this->loaded_library.end(); iter++) { |
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:
10902
diff
changeset
|
209 |
free((void *)(*iter).second); |
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:
10902
diff
changeset
|
210 |
free((void *)(*iter).first); |
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:
10902
diff
changeset
|
211 |
} |
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:
10902
diff
changeset
|
212 |
|
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:
10902
diff
changeset
|
213 |
this->loaded_library.clear(); |
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
|
214 |
} |
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
|
215 |
|
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
|
216 |
void AIController::IncreaseTick() |
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
|
217 |
{ |
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
|
218 |
this->tick++; |
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
|
219 |
} |
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
|
220 |
|
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
|
221 |
uint AIController::GetTick() |
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
|
222 |
{ |
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
|
223 |
return this->tick; |
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
|
224 |
} |
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:
10902
diff
changeset
|
225 |
|
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:
10902
diff
changeset
|
226 |
bool AIController::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:
10902
diff
changeset
|
227 |
{ |
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:
10902
diff
changeset
|
228 |
LoadedLibraryList::iterator iter = this->loaded_library.find(library_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:
10902
diff
changeset
|
229 |
if (iter == this->loaded_library.end()) { |
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:
10902
diff
changeset
|
230 |
*next_number = ++this->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:
10902
diff
changeset
|
231 |
return false; |
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:
10902
diff
changeset
|
232 |
} |
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:
10902
diff
changeset
|
233 |
|
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:
10902
diff
changeset
|
234 |
ttd_strlcpy(fake_class_name, (*iter).second, 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:
10902
diff
changeset
|
235 |
return true; |
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:
10902
diff
changeset
|
236 |
} |
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:
10902
diff
changeset
|
237 |
|
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:
10902
diff
changeset
|
238 |
void AIController::AddLoadedLibrary(const char *library_name, const char *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:
10902
diff
changeset
|
239 |
{ |
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:
10902
diff
changeset
|
240 |
this->loaded_library[strdup(library_name)] = strdup(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:
10902
diff
changeset
|
241 |
} |