author | truelight |
Tue, 20 Mar 2007 00:14:29 +0000 | |
branch | noai |
changeset 9490 | 999eb7531205 |
parent 9472 | 063c3f50972a |
child 9520 | f7cf8bea10db |
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 |
/** |
9472
063c3f50972a
(svn r9312) [NoAI] -Codechange: add IsValidCargo.
rubidium
parents:
9447
diff
changeset
|
16 |
* Checks whether the given cargo type is valid. |
063c3f50972a
(svn r9312) [NoAI] -Codechange: add IsValidCargo.
rubidium
parents:
9447
diff
changeset
|
17 |
* @param cargo_type the cargo to check. |
063c3f50972a
(svn r9312) [NoAI] -Codechange: add IsValidCargo.
rubidium
parents:
9447
diff
changeset
|
18 |
* @return true if and only if the cargo type is valid. |
063c3f50972a
(svn r9312) [NoAI] -Codechange: add IsValidCargo.
rubidium
parents:
9447
diff
changeset
|
19 |
*/ |
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
|
20 |
static bool IsValidCargo(CargoID cargo_type); |
9472
063c3f50972a
(svn r9312) [NoAI] -Codechange: add IsValidCargo.
rubidium
parents:
9447
diff
changeset
|
21 |
|
063c3f50972a
(svn r9312) [NoAI] -Codechange: add IsValidCargo.
rubidium
parents:
9447
diff
changeset
|
22 |
/** |
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
|
23 |
* 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
|
24 |
* @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
|
25 |
* @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
|
26 |
* @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
|
27 |
*/ |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
28 |
char *GetCargoLabel(CargoID cargo_type); |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
29 |
|
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
30 |
/** |
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
|
31 |
* 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
|
32 |
* @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
|
33 |
* @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
|
34 |
*/ |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
35 |
bool IsFreight(CargoID cargo_type); |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
36 |
|
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
37 |
/** |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
38 |
* 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
|
39 |
* given distance within the specified time. |
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
40 |
* @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
|
41 |
* @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
|
42 |
* @param cargo_type the cargo to transport. |
8f3c1bc72204
(svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents:
9427
diff
changeset
|
43 |
* @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
|
44 |
*/ |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
45 |
int32 GetCargoIncome(uint32 distance, uint32 days_in_transit, CargoID cargo_type); |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
46 |
}; |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
47 |
|
9425
8eec6d10844a
(svn r9227) [NoAI] -Change: renamed SQUIRREL_CLASS to DEFINE_SQUIRREL_CLASS
truelight
parents:
9422
diff
changeset
|
48 |
#ifdef DEFINE_SQUIRREL_CLASS |
9422
33efcc5f1b09
(svn r9223) [NoAI] -Change: moved squirrel/engine.cpp to squirrel.cpp in root
truelight
parents:
9405
diff
changeset
|
49 |
void SQAICargoRegister(Squirrel *engine) { |
9405
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
50 |
DefSQClass <AICargo> SQAICargo("AICargo"); |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
51 |
SQAICargo.PreRegister(engine); |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
52 |
SQAICargo.AddConstructor(engine); |
9472
063c3f50972a
(svn r9312) [NoAI] -Codechange: add IsValidCargo.
rubidium
parents:
9447
diff
changeset
|
53 |
SQAICargo.DefSQFunction(engine, &AICargo::IsValidCargo, "IsValidCargo"); |
9405
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
54 |
SQAICargo.DefSQFunction(engine, &AICargo::GetCargoLabel, "GetCargoLabel"); |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
55 |
SQAICargo.DefSQFunction(engine, &AICargo::IsFreight, "IsFreight"); |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
56 |
SQAICargo.DefSQFunction(engine, &AICargo::GetCargoIncome, "GetCargoIncome"); |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
57 |
SQAICargo.PostRegister(engine); |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
58 |
} |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
59 |
#endif /* SQUIRREL_CLASS */ |
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
60 |
|
df6f3b4b0038
(svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff
changeset
|
61 |
#endif /* AI_CARGO_HPP */ |