author | truebrain |
Mon, 09 Jun 2008 21:24:10 +0000 | |
branch | noai |
changeset 10885 | 415791bee9d7 |
parent 10879 | 79c0d0e0e155 |
child 10889 | ecb77cfc4a10 |
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" |
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
|
9 |
#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
|
10 |
|
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 |
#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
|
12 |
#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
|
13 |
#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
|
14 |
#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
|
15 |
#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
|
16 |
#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
|
17 |
#include "../ai_threads.h" |
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
|
18 |
|
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
|
19 |
/* 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
|
20 |
* 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
|
21 |
#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
|
22 |
#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
|
23 |
#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
|
24 |
#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
|
25 |
#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
|
26 |
#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
|
27 |
#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
|
28 |
#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
|
29 |
#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
|
30 |
#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
|
31 |
#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
|
32 |
#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
|
33 |
#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
|
34 |
#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
|
35 |
#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
|
36 |
#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
|
37 |
#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
|
38 |
#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
|
39 |
#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
|
40 |
#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
|
41 |
#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
|
42 |
#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
|
43 |
#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
|
44 |
#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
|
45 |
#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
|
46 |
#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
|
47 |
#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
|
48 |
#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
|
49 |
#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
|
50 |
#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
|
51 |
#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
|
52 |
#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
|
53 |
#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
|
54 |
#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
|
55 |
#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
|
56 |
#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
|
57 |
#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
|
58 |
#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
|
59 |
#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
|
60 |
#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
|
61 |
#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
|
62 |
|
9782
e8d8d8894f23
(svn r12277) [NoAI] -Change: overlay GlobalPointer with local instance access and create sub-node to contain data
truebrain
parents:
9724
diff
changeset
|
63 |
/* static */ void AIController::Sleep(uint 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
|
64 |
{ |
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
|
65 |
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
|
66 |
} |
9782
e8d8d8894f23
(svn r12277) [NoAI] -Change: overlay GlobalPointer with local instance access and create sub-node to contain data
truebrain
parents:
9724
diff
changeset
|
67 |
|
e8d8d8894f23
(svn r12277) [NoAI] -Change: overlay GlobalPointer with local instance access and create sub-node to contain data
truebrain
parents:
9724
diff
changeset
|
68 |
/* 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
|
69 |
{ |
9851
a5f5a7cf2b61
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
truebrain
parents:
9833
diff
changeset
|
70 |
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
|
71 |
} |
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
|
72 |
|
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
|
73 |
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
|
74 |
{ |
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 |
/* 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
|
76 |
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
|
77 |
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
|
78 |
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
|
79 |
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
|
80 |
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
|
81 |
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
|
82 |
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
|
83 |
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
|
84 |
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
|
85 |
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
|
86 |
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
|
87 |
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
|
88 |
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
|
89 |
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
|
90 |
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
|
91 |
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
|
92 |
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
|
93 |
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
|
94 |
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
|
95 |
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
|
96 |
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
|
97 |
SQAIEventController_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 |
SQAIEventEnginePreview_Register(this->engine); |
10879
79c0d0e0e155
(svn r13430) [NoAI] -Add: added AIEventIndustry(Open|CLose)
glx
parents:
10871
diff
changeset
|
99 |
SQAIEventIndustryClose_Register(this->engine); |
79c0d0e0e155
(svn r13430) [NoAI] -Add: added AIEventIndustry(Open|CLose)
glx
parents:
10871
diff
changeset
|
100 |
SQAIEventIndustryOpen_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
|
101 |
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
|
102 |
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
|
103 |
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
|
104 |
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
|
105 |
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
|
106 |
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
|
107 |
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
|
108 |
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
|
109 |
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
|
110 |
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
|
111 |
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
|
112 |
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
|
113 |
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
|
114 |
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
|
115 |
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
|
116 |
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
|
117 |
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
|
118 |
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
|
119 |
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
|
120 |
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
|
121 |
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
|
122 |
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
|
123 |
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
|
124 |
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
|
125 |
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
|
126 |
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
|
127 |
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
|
128 |
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
|
129 |
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
|
130 |
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
|
131 |
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
|
132 |
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
|
133 |
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
|
134 |
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
|
135 |
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
|
136 |
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
|
137 |
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
|
138 |
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
|
139 |
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
|
140 |
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
|
141 |
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
|
142 |
|
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 |
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
|
144 |
} |
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 |
|
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 |
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
|
147 |
{ |
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 |
/* 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
|
149 |
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
|
150 |
} |
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 |
|
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 |
AIController::AIController(const char *script, const char *class_name) |
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 |
{ |
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 |
this->tick = 0; |
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
|
155 |
this->SQ_instance = 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
|
156 |
|
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 |
/* 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
|
158 |
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
|
159 |
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
|
160 |
this->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
|
161 |
if (!this->engine->LoadScript(script)) { |
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
|
162 |
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
|
163 |
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
|
164 |
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
|
165 |
} |
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
|
166 |
/* 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
|
167 |
this->SQ_instance = MallocT<SQObject>(sizeof(SQObject)); |
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
|
168 |
if (!this->engine->CreateClassInstance(class_name, this, this->SQ_instance)) { |
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
|
169 |
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
|
170 |
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
|
171 |
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
|
172 |
} |
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
|
173 |
} |
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
|
174 |
|
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 |
void AIController::Start() |
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 |
{ |
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
|
177 |
if (this->engine == NULL) return; |
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
|
178 |
|
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
|
179 |
/* 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
|
180 |
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
|
181 |
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
|
182 |
} |
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
|
183 |
/* 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
|
184 |
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
|
185 |
} |
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 |
|
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
|
187 |
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
|
188 |
{ |
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
|
189 |
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
|
190 |
free(this->SQ_instance); |
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
|
191 |
} |
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
|
192 |
|
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
|
193 |
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
|
194 |
{ |
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
|
195 |
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
|
196 |
} |
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
|
197 |
|
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
|
198 |
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
|
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 |
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
|
201 |
} |