author | truebrain |
Sun, 08 Jun 2008 21:20:48 +0000 | |
branch | noai |
changeset 10871 | 326ee226e9d7 |
parent 10668 | 495789401303 |
child 10977 | 6c1a6657c7db |
permissions | -rw-r--r-- |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
1 |
/* $Id$ */ |
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
2 |
|
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9814
diff
changeset
|
3 |
/** @file ai_object.hpp Main object, on which all objects depend. */ |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
4 |
|
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
5 |
#ifndef AI_OBJECT_HPP |
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
6 |
#define AI_OBJECT_HPP |
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
7 |
|
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:
9427
diff
changeset
|
8 |
#include "../../stdafx.h" |
9679
788e083db48b
(svn r10625) [NoAI] -Fix: returning C++ classes, by creating a temp SQ class, had its problems, this should fix them all (double-frees, wrong scope, ..)
truelight
parents:
9629
diff
changeset
|
9 |
#include "../../misc/countedptr.hpp" |
10668
495789401303
(svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents:
10341
diff
changeset
|
10 |
#include "../../road_type.h" |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
11 |
|
10339
ce6cd68d9eb8
(svn r12880) [NoAI] -Add: introduces ai_types.hpp, which has all NNNId like VehicleID. This simplifies the include-mess, and avoids including tons of _type.h for just a single typedef.
truebrain
parents:
9873
diff
changeset
|
12 |
#include "ai_types.hpp" |
9814
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9760
diff
changeset
|
13 |
|
9475
58c20c0e394f
(svn r9320) [NoAI] -Fix: added some doxygen comments to make doxygen happy
truelight
parents:
9473
diff
changeset
|
14 |
/** |
58c20c0e394f
(svn r9320) [NoAI] -Fix: added some doxygen comments to make doxygen happy
truelight
parents:
9473
diff
changeset
|
15 |
* The callback function for Mode-classes. |
58c20c0e394f
(svn r9320) [NoAI] -Fix: added some doxygen comments to make doxygen happy
truelight
parents:
9473
diff
changeset
|
16 |
*/ |
9629 | 17 |
typedef bool (AIModeProc)(TileIndex tile, uint32 p1, uint32 p2, uint procc, CommandCost costs); |
9450
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
18 |
|
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9441
diff
changeset
|
19 |
/** |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9441
diff
changeset
|
20 |
* Uper-parent object of all API classes. You should never use this class in |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9441
diff
changeset
|
21 |
* your AI, as it doesn't publish any public functions. It is used |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9441
diff
changeset
|
22 |
* internally to have a common place to handle general things, like internal |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9441
diff
changeset
|
23 |
* command processing, and command-validation checks. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9441
diff
changeset
|
24 |
*/ |
9679
788e083db48b
(svn r10625) [NoAI] -Fix: returning C++ classes, by creating a temp SQ class, had its problems, this should fix them all (double-frees, wrong scope, ..)
truelight
parents:
9629
diff
changeset
|
25 |
class AIObject : public SimpleCountedObject { |
9450
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
26 |
private: |
10339
ce6cd68d9eb8
(svn r12880) [NoAI] -Add: introduces ai_types.hpp, which has all NNNId like VehicleID. This simplifies the include-mess, and avoids including tons of _type.h for just a single typedef.
truebrain
parents:
9873
diff
changeset
|
27 |
struct AIDoCommandStruct; |
9450
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
28 |
|
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
29 |
/** |
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
30 |
* The current mode of the AI players. |
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
31 |
*/ |
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
32 |
static AIDoCommandStruct *GetDoCommandStruct(PlayerID player); |
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
33 |
|
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
34 |
protected: |
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
35 |
/** |
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
36 |
* Executes a raw DoCommand for the AI. |
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
37 |
*/ |
9695
708f1e3cc4c4
(svn r10936) [NoAI] -Fix: allow water_protection for non-water-building in DoCommand
truelight
parents:
9682
diff
changeset
|
38 |
static bool DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint procc, bool water_protection = true); |
9414
a7f7bbec08da
(svn r9212) [NoAI] -Add: added CmdFailed and CmdSucceeded in AIObject() and used it
truelight
parents:
9388
diff
changeset
|
39 |
|
a7f7bbec08da
(svn r9212) [NoAI] -Add: added CmdFailed and CmdSucceeded in AIObject() and used it
truelight
parents:
9388
diff
changeset
|
40 |
/** |
9452
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
9450
diff
changeset
|
41 |
* Sets the DoCommand costs counter to a value. |
9414
a7f7bbec08da
(svn r9212) [NoAI] -Add: added CmdFailed and CmdSucceeded in AIObject() and used it
truelight
parents:
9388
diff
changeset
|
42 |
*/ |
9629 | 43 |
static void SetDoCommandCosts(Money value); |
9414
a7f7bbec08da
(svn r9212) [NoAI] -Add: added CmdFailed and CmdSucceeded in AIObject() and used it
truelight
parents:
9388
diff
changeset
|
44 |
|
a7f7bbec08da
(svn r9212) [NoAI] -Add: added CmdFailed and CmdSucceeded in AIObject() and used it
truelight
parents:
9388
diff
changeset
|
45 |
/** |
9452
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
9450
diff
changeset
|
46 |
* Increase the current value of the DoCommand costs counter. |
9414
a7f7bbec08da
(svn r9212) [NoAI] -Add: added CmdFailed and CmdSucceeded in AIObject() and used it
truelight
parents:
9388
diff
changeset
|
47 |
*/ |
9629 | 48 |
static void IncreaseDoCommandCosts(Money value); |
9452
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
9450
diff
changeset
|
49 |
|
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
9450
diff
changeset
|
50 |
/** |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
9450
diff
changeset
|
51 |
* Get the current DoCommand costs counter. |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
9450
diff
changeset
|
52 |
*/ |
9629 | 53 |
static Money GetDoCommandCosts(); |
9450
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
54 |
|
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
55 |
/** |
9844
738b8f69675f
(svn r12510) [NoAI] -Add: added AIError, which allows you to catch errors triggered by commands (Morloth)
truebrain
parents:
9841
diff
changeset
|
56 |
* Set the DoCommand last error. |
738b8f69675f
(svn r12510) [NoAI] -Add: added AIError, which allows you to catch errors triggered by commands (Morloth)
truebrain
parents:
9841
diff
changeset
|
57 |
*/ |
9864
4a9b7b610b13
(svn r12554) [NoAI] -Codechange: add more typing information.
rubidium
parents:
9863
diff
changeset
|
58 |
static void SetLastError(AIErrorType last_error); |
9844
738b8f69675f
(svn r12510) [NoAI] -Add: added AIError, which allows you to catch errors triggered by commands (Morloth)
truebrain
parents:
9841
diff
changeset
|
59 |
|
738b8f69675f
(svn r12510) [NoAI] -Add: added AIError, which allows you to catch errors triggered by commands (Morloth)
truebrain
parents:
9841
diff
changeset
|
60 |
/** |
738b8f69675f
(svn r12510) [NoAI] -Add: added AIError, which allows you to catch errors triggered by commands (Morloth)
truebrain
parents:
9841
diff
changeset
|
61 |
* Get the DoCommand last error. |
738b8f69675f
(svn r12510) [NoAI] -Add: added AIError, which allows you to catch errors triggered by commands (Morloth)
truebrain
parents:
9841
diff
changeset
|
62 |
*/ |
9864
4a9b7b610b13
(svn r12554) [NoAI] -Codechange: add more typing information.
rubidium
parents:
9863
diff
changeset
|
63 |
static AIErrorType GetLastError(); |
9844
738b8f69675f
(svn r12510) [NoAI] -Add: added AIError, which allows you to catch errors triggered by commands (Morloth)
truebrain
parents:
9841
diff
changeset
|
64 |
|
738b8f69675f
(svn r12510) [NoAI] -Add: added AIError, which allows you to catch errors triggered by commands (Morloth)
truebrain
parents:
9841
diff
changeset
|
65 |
/** |
10668
495789401303
(svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents:
10341
diff
changeset
|
66 |
* Set the road type. |
495789401303
(svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents:
10341
diff
changeset
|
67 |
*/ |
495789401303
(svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents:
10341
diff
changeset
|
68 |
static void SetRoadType(RoadType road_type); |
495789401303
(svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents:
10341
diff
changeset
|
69 |
|
495789401303
(svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents:
10341
diff
changeset
|
70 |
/** |
495789401303
(svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents:
10341
diff
changeset
|
71 |
* Get the road type. |
495789401303
(svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents:
10341
diff
changeset
|
72 |
*/ |
495789401303
(svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents:
10341
diff
changeset
|
73 |
static RoadType GetRoadType(); |
495789401303
(svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents:
10341
diff
changeset
|
74 |
|
495789401303
(svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents:
10341
diff
changeset
|
75 |
/** |
9450
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
76 |
* Set the current mode of your AI to this proc. |
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
77 |
*/ |
9473
dcbcd1c4496d
(svn r9318) [NoAI] -Add: added new param in ModeCallback: costs
truelight
parents:
9454
diff
changeset
|
78 |
static void SetDoCommandMode(AIModeProc *proc, AIObject *instance); |
9450
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
79 |
|
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
80 |
/** |
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
81 |
* Get the current mode your AI is currently under. |
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
82 |
*/ |
9473
dcbcd1c4496d
(svn r9318) [NoAI] -Add: added new param in ModeCallback: costs
truelight
parents:
9454
diff
changeset
|
83 |
static AIModeProc *GetDoCommandMode(); |
dcbcd1c4496d
(svn r9318) [NoAI] -Add: added new param in ModeCallback: costs
truelight
parents:
9454
diff
changeset
|
84 |
|
dcbcd1c4496d
(svn r9318) [NoAI] -Add: added new param in ModeCallback: costs
truelight
parents:
9454
diff
changeset
|
85 |
/** |
dcbcd1c4496d
(svn r9318) [NoAI] -Add: added new param in ModeCallback: costs
truelight
parents:
9454
diff
changeset
|
86 |
* Get the instance of the current mode your AI is currently under. |
dcbcd1c4496d
(svn r9318) [NoAI] -Add: added new param in ModeCallback: costs
truelight
parents:
9454
diff
changeset
|
87 |
*/ |
dcbcd1c4496d
(svn r9318) [NoAI] -Add: added new param in ModeCallback: costs
truelight
parents:
9454
diff
changeset
|
88 |
static AIObject *GetDoCommandModeInstance(); |
9450
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
89 |
|
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
90 |
/** |
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
91 |
* Set the delay of the DoCommand. |
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
92 |
*/ |
9473
dcbcd1c4496d
(svn r9318) [NoAI] -Add: added new param in ModeCallback: costs
truelight
parents:
9454
diff
changeset
|
93 |
static void SetDoCommandDelay(uint ticks); |
9450
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
94 |
|
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
95 |
/** |
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
96 |
* Get the delay of the DoCommand. |
d675836e865c
(svn r9278) [NoAI] -Add: added AISettings which adds the function to control the Delay-value on DoCommands
truelight
parents:
9448
diff
changeset
|
97 |
*/ |
9473
dcbcd1c4496d
(svn r9318) [NoAI] -Add: added new param in ModeCallback: costs
truelight
parents:
9454
diff
changeset
|
98 |
static uint GetDoCommandDelay(); |
9454
ee6a65b37b82
(svn r9284) [NoAI] -Fix: reset internal static AIObject data per AI on AI startup
truelight
parents:
9452
diff
changeset
|
99 |
|
9496
05ebee9884b3
(svn r9368) [NoAI] -Fix: store _new_vehicle_id directly after successful handling the command in a per-AI-player-safe piece of memory, so we can restore the value when ever we want later in the process
truelight
parents:
9486
diff
changeset
|
100 |
/** |
9760
265fdd2130c3
(svn r12248) [NoAI] -Codechange: last_command_res was in AIThread, while it should be in AIObject, like all other variables like it
truebrain
parents:
9695
diff
changeset
|
101 |
* Get the latest result of a DoCommand. |
265fdd2130c3
(svn r12248) [NoAI] -Codechange: last_command_res was in AIThread, while it should be in AIObject, like all other variables like it
truebrain
parents:
9695
diff
changeset
|
102 |
*/ |
265fdd2130c3
(svn r12248) [NoAI] -Codechange: last_command_res was in AIThread, while it should be in AIObject, like all other variables like it
truebrain
parents:
9695
diff
changeset
|
103 |
static bool GetLastCommandRes(); |
265fdd2130c3
(svn r12248) [NoAI] -Codechange: last_command_res was in AIThread, while it should be in AIObject, like all other variables like it
truebrain
parents:
9695
diff
changeset
|
104 |
|
265fdd2130c3
(svn r12248) [NoAI] -Codechange: last_command_res was in AIThread, while it should be in AIObject, like all other variables like it
truebrain
parents:
9695
diff
changeset
|
105 |
/** |
9496
05ebee9884b3
(svn r9368) [NoAI] -Fix: store _new_vehicle_id directly after successful handling the command in a per-AI-player-safe piece of memory, so we can restore the value when ever we want later in the process
truelight
parents:
9486
diff
changeset
|
106 |
* Get the latest stored new_vehicle_id. |
05ebee9884b3
(svn r9368) [NoAI] -Fix: store _new_vehicle_id directly after successful handling the command in a per-AI-player-safe piece of memory, so we can restore the value when ever we want later in the process
truelight
parents:
9486
diff
changeset
|
107 |
*/ |
05ebee9884b3
(svn r9368) [NoAI] -Fix: store _new_vehicle_id directly after successful handling the command in a per-AI-player-safe piece of memory, so we can restore the value when ever we want later in the process
truelight
parents:
9486
diff
changeset
|
108 |
static VehicleID GetNewVehicleID(); |
05ebee9884b3
(svn r9368) [NoAI] -Fix: store _new_vehicle_id directly after successful handling the command in a per-AI-player-safe piece of memory, so we can restore the value when ever we want later in the process
truelight
parents:
9486
diff
changeset
|
109 |
|
9511 | 110 |
/** |
111 |
* Get the latest stored new_sign_id. |
|
112 |
*/ |
|
113 |
static SignID GetNewSignID(); |
|
114 |
||
9680
5ed7bbfd51c7
(svn r10629) [NoAI] -Fix: on returning a class instance which is NULL, do not make a wrapper SQ, but return a NULL pointer too
truelight
parents:
9679
diff
changeset
|
115 |
/** |
5ed7bbfd51c7
(svn r10629) [NoAI] -Fix: on returning a class instance which is NULL, do not make a wrapper SQ, but return a NULL pointer too
truelight
parents:
9679
diff
changeset
|
116 |
* Get the pointer to store event data in. |
5ed7bbfd51c7
(svn r10629) [NoAI] -Fix: on returning a class instance which is NULL, do not make a wrapper SQ, but return a NULL pointer too
truelight
parents:
9679
diff
changeset
|
117 |
*/ |
9682
d031eb183733
(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents:
9680
diff
changeset
|
118 |
static void *&GetEventPointer(); |
9680
5ed7bbfd51c7
(svn r10629) [NoAI] -Fix: on returning a class instance which is NULL, do not make a wrapper SQ, but return a NULL pointer too
truelight
parents:
9679
diff
changeset
|
119 |
|
9454
ee6a65b37b82
(svn r9284) [NoAI] -Fix: reset internal static AIObject data per AI on AI startup
truelight
parents:
9452
diff
changeset
|
120 |
public: |
ee6a65b37b82
(svn r9284) [NoAI] -Fix: reset internal static AIObject data per AI on AI startup
truelight
parents:
9452
diff
changeset
|
121 |
/** |
9760
265fdd2130c3
(svn r12248) [NoAI] -Codechange: last_command_res was in AIThread, while it should be in AIObject, like all other variables like it
truebrain
parents:
9695
diff
changeset
|
122 |
* Store the latest result of a DoCommand per player. |
265fdd2130c3
(svn r12248) [NoAI] -Codechange: last_command_res was in AIThread, while it should be in AIObject, like all other variables like it
truebrain
parents:
9695
diff
changeset
|
123 |
* @note NEVER use this yourself in your AI! |
9841
f931a10242c9
(svn r12507) [NoAI] -Fix: enable Doxyfile warning about missing params and fix 3 missing params in AIObject
truebrain
parents:
9837
diff
changeset
|
124 |
* @param res The result of the last command. |
9760
265fdd2130c3
(svn r12248) [NoAI] -Codechange: last_command_res was in AIThread, while it should be in AIObject, like all other variables like it
truebrain
parents:
9695
diff
changeset
|
125 |
*/ |
265fdd2130c3
(svn r12248) [NoAI] -Codechange: last_command_res was in AIThread, while it should be in AIObject, like all other variables like it
truebrain
parents:
9695
diff
changeset
|
126 |
static void SetLastCommandRes(bool res); |
265fdd2130c3
(svn r12248) [NoAI] -Codechange: last_command_res was in AIThread, while it should be in AIObject, like all other variables like it
truebrain
parents:
9695
diff
changeset
|
127 |
|
265fdd2130c3
(svn r12248) [NoAI] -Codechange: last_command_res was in AIThread, while it should be in AIObject, like all other variables like it
truebrain
parents:
9695
diff
changeset
|
128 |
/** |
9496
05ebee9884b3
(svn r9368) [NoAI] -Fix: store _new_vehicle_id directly after successful handling the command in a per-AI-player-safe piece of memory, so we can restore the value when ever we want later in the process
truelight
parents:
9486
diff
changeset
|
129 |
* Store a new_vehicle_id per player. |
05ebee9884b3
(svn r9368) [NoAI] -Fix: store _new_vehicle_id directly after successful handling the command in a per-AI-player-safe piece of memory, so we can restore the value when ever we want later in the process
truelight
parents:
9486
diff
changeset
|
130 |
* @note NEVER use this yourself in your AI! |
9841
f931a10242c9
(svn r12507) [NoAI] -Fix: enable Doxyfile warning about missing params and fix 3 missing params in AIObject
truebrain
parents:
9837
diff
changeset
|
131 |
* @param vehicle_id The new VehicleID. |
9496
05ebee9884b3
(svn r9368) [NoAI] -Fix: store _new_vehicle_id directly after successful handling the command in a per-AI-player-safe piece of memory, so we can restore the value when ever we want later in the process
truelight
parents:
9486
diff
changeset
|
132 |
*/ |
9841
f931a10242c9
(svn r12507) [NoAI] -Fix: enable Doxyfile warning about missing params and fix 3 missing params in AIObject
truebrain
parents:
9837
diff
changeset
|
133 |
static void SetNewVehicleID(VehicleID vehicle_id); |
9496
05ebee9884b3
(svn r9368) [NoAI] -Fix: store _new_vehicle_id directly after successful handling the command in a per-AI-player-safe piece of memory, so we can restore the value when ever we want later in the process
truelight
parents:
9486
diff
changeset
|
134 |
|
05ebee9884b3
(svn r9368) [NoAI] -Fix: store _new_vehicle_id directly after successful handling the command in a per-AI-player-safe piece of memory, so we can restore the value when ever we want later in the process
truelight
parents:
9486
diff
changeset
|
135 |
/** |
9511 | 136 |
* Store a new_sign_id per player. |
137 |
* @note NEVER use this yourself in your AI! |
|
9841
f931a10242c9
(svn r12507) [NoAI] -Fix: enable Doxyfile warning about missing params and fix 3 missing params in AIObject
truebrain
parents:
9837
diff
changeset
|
138 |
* @param sign_id The new SignID. |
9511 | 139 |
*/ |
9841
f931a10242c9
(svn r12507) [NoAI] -Fix: enable Doxyfile warning about missing params and fix 3 missing params in AIObject
truebrain
parents:
9837
diff
changeset
|
140 |
static void SetNewSignID(SignID sign_id); |
9511 | 141 |
|
142 |
/** |
|
9454
ee6a65b37b82
(svn r9284) [NoAI] -Fix: reset internal static AIObject data per AI on AI startup
truelight
parents:
9452
diff
changeset
|
143 |
* If an AI starts, some internals needs to be resetted. This function |
ee6a65b37b82
(svn r9284) [NoAI] -Fix: reset internal static AIObject data per AI on AI startup
truelight
parents:
9452
diff
changeset
|
144 |
* takes care of that. |
9496
05ebee9884b3
(svn r9368) [NoAI] -Fix: store _new_vehicle_id directly after successful handling the command in a per-AI-player-safe piece of memory, so we can restore the value when ever we want later in the process
truelight
parents:
9486
diff
changeset
|
145 |
* @note NEVER use this yourself in your AI! |
9454
ee6a65b37b82
(svn r9284) [NoAI] -Fix: reset internal static AIObject data per AI on AI startup
truelight
parents:
9452
diff
changeset
|
146 |
*/ |
ee6a65b37b82
(svn r9284) [NoAI] -Fix: reset internal static AIObject data per AI on AI startup
truelight
parents:
9452
diff
changeset
|
147 |
static void ResetInternalPlayerData(); |
9851
a5f5a7cf2b61
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
truebrain
parents:
9847
diff
changeset
|
148 |
|
a5f5a7cf2b61
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
truebrain
parents:
9847
diff
changeset
|
149 |
/** |
a5f5a7cf2b61
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
truebrain
parents:
9847
diff
changeset
|
150 |
* Get the pointer to store log message in. |
a5f5a7cf2b61
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
truebrain
parents:
9847
diff
changeset
|
151 |
* @note NEVER use this yourself in your AI! |
a5f5a7cf2b61
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
truebrain
parents:
9847
diff
changeset
|
152 |
*/ |
a5f5a7cf2b61
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
truebrain
parents:
9847
diff
changeset
|
153 |
static void *&GetLogPointer(); |
9361
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
154 |
}; |
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
155 |
|
7bb2bd22b16e
(svn r9144) [NoAI] -Change: moved command functions to AIObject, and made AIBase depend on AIObject
truelight
parents:
diff
changeset
|
156 |
#endif /* AI_OBJECT_HPP */ |