author | truebrain |
Wed, 26 Mar 2008 15:17:40 +0000 | |
branch | noai |
changeset 9823 | 0b7f816cf46f |
parent 9814 | be51ea0adc29 |
child 9829 | 80fbe02a4184 |
permissions | -rw-r--r-- |
9405
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
2 |
|
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
3 |
/** @file ai_cargo.hpp Everything to query about cargos */ |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
4 |
|
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
5 |
#ifndef AI_CARGO_HPP |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
6 |
#define AI_CARGO_HPP |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
7 |
|
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
8 |
#include "ai_object.hpp" |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
9 |
|
9447
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
10 |
/** |
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
11 |
* Class that handles all cargo related functions. |
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
12 |
*/ |
9405
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
13 |
class AICargo : public AIObject { |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
14 |
public: |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
15 |
/** |
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
16 |
* The name of the class, needed by several sub-processes. |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
17 |
*/ |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
18 |
static const char *GetClassName() { return "AICargo"; } |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
19 |
|
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
20 |
/** |
9472
063c3f50972a
(svn r9312) [NoAI] -Codechange: add IsValidCargo.
rubidium
parents:
9447
diff
changeset
|
21 |
* Checks whether the given cargo type is valid. |
063c3f50972a
(svn r9312) [NoAI] -Codechange: add IsValidCargo.
rubidium
parents:
9447
diff
changeset
|
22 |
* @param cargo_type the cargo to check. |
063c3f50972a
(svn r9312) [NoAI] -Codechange: add IsValidCargo.
rubidium
parents:
9447
diff
changeset
|
23 |
* @return true if and only if the cargo type is valid. |
063c3f50972a
(svn r9312) [NoAI] -Codechange: add IsValidCargo.
rubidium
parents:
9447
diff
changeset
|
24 |
*/ |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9472
diff
changeset
|
25 |
static bool IsValidCargo(CargoID cargo_type); |
9472
063c3f50972a
(svn r9312) [NoAI] -Codechange: add IsValidCargo.
rubidium
parents:
9447
diff
changeset
|
26 |
|
063c3f50972a
(svn r9312) [NoAI] -Codechange: add IsValidCargo.
rubidium
parents:
9447
diff
changeset
|
27 |
/** |
9447
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
28 |
* Gets the string representation of the cargo label. |
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
29 |
* @param cargo_type to get the string representation of. |
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
30 |
* @return the cargo label. |
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
31 |
* @note the returned cargo label must be free'd (C++ only). |
9405
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
32 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9596
diff
changeset
|
33 |
static char *GetCargoLabel(CargoID cargo_type); |
9405
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
34 |
|
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
35 |
/** |
9447
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
36 |
* Checks whether the give cargo is a freight or not. |
9405
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
37 |
* @param cargo_type is this cargo freight or not? |
9447
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
38 |
* @return true if and only if the cargo is freight. |
9405
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
39 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9596
diff
changeset
|
40 |
static bool IsFreight(CargoID cargo_type); |
9405
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
41 |
|
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
42 |
/** |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
43 |
* Get the income for transporting a piece of cargo over the |
9447
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
44 |
* given distance within the specified time. |
9814
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9737
diff
changeset
|
45 |
* @param cargo_type the cargo to transport. |
9447
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
46 |
* @param distance the distance the cargo travels from begin to end. |
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
47 |
* @param days_in_transit amount of (game) days the cargo is in transit. |
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
48 |
* @return the amount of money that would be earned by this trip. |
9405
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
49 |
*/ |
9814
be51ea0adc29
(svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents:
9737
diff
changeset
|
50 |
static int32 GetCargoIncome(CargoID cargo_type, uint32 distance, uint32 days_in_transit); |
9405
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
51 |
}; |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
52 |
|
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
53 |
#endif /* AI_CARGO_HPP */ |