author | rubidium |
Thu, 03 Apr 2008 23:01:54 +0000 | |
branch | noai |
changeset 9865 | f241472f09dc |
parent 9843 | 29f34a179daf |
child 10196 | aecabd927420 |
permissions | -rw-r--r-- |
9452
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
1 |
/* $Id$ */ |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
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:
9596
diff
changeset
|
3 |
/** @file ai_accounting.hpp Everything to handle AI accounting things. */ |
9452
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
4 |
|
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
5 |
#ifndef AI_ACCOUNTING_HPP |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
6 |
#define AI_ACCOUNTING_HPP |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
7 |
|
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
8 |
#include "ai_object.hpp" |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
9 |
|
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
10 |
/** |
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9596
diff
changeset
|
11 |
* Class that keeps track of the costs, so you can request how much a block of |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9596
diff
changeset
|
12 |
* commands did cost in total. Works in both Execute as in Test mode. |
9452
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
13 |
* Example: |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
14 |
* { |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
15 |
* local costs = AIAccounting(); |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
16 |
* BuildRoad(from_here, to_here); |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
17 |
* BuildRoad(from_there, to_there); |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
18 |
* print("Costs for route is: " + costs.GetCosts()); |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
19 |
* } |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
20 |
*/ |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
21 |
class AIAccounting : public AIObject { |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
22 |
public: |
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
23 |
static const char *GetClassName() { return "AIAccounting"; } |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
24 |
|
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
25 |
/** |
9452
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
26 |
* Creating instance of this class starts counting the costs of commands |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
27 |
* from zero. |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
28 |
* @note when the instance is destroyed, he restores the costs that was |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
29 |
* current when the instance was created! |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
30 |
*/ |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
31 |
AIAccounting(); |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
32 |
|
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
33 |
/** |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
34 |
* Destroying this instance reset the costs to the value it was |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
35 |
* in when the instance was created. |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
36 |
*/ |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
37 |
~AIAccounting(); |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
38 |
|
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
39 |
/** |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
40 |
* Get the current value of the costs. |
9843
29f34a179daf
(svn r12509) [NoAI] -Fix: add some missing return/parameter documentation; probably not the last, but Doxygen couldn't find these.
rubidium
parents:
9829
diff
changeset
|
41 |
* @return The current costs. |
9452
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
42 |
*/ |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
43 |
int32 GetCosts(); |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
44 |
|
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
45 |
/** |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
46 |
* Reset the costs to zero. |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
47 |
*/ |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
48 |
void ResetCosts(); |
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9596
diff
changeset
|
49 |
|
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9596
diff
changeset
|
50 |
private: |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9596
diff
changeset
|
51 |
int32 last_costs; |
9452
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
52 |
}; |
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
53 |
|
4c5eedbc3ba9
(svn r9282) [NoAI] -Add: added AIAccounting, which tracks the cost of your buying/selling.
truelight
parents:
diff
changeset
|
54 |
#endif /* AI_ACCOUNTING_HPP */ |