|
1 /* $Id$ */ |
|
2 |
|
3 /** @file ai_cargo.hpp Everything to query about cargos */ |
|
4 |
|
5 #ifndef AI_CARGO_HPP |
|
6 #define AI_CARGO_HPP |
|
7 |
|
8 #include "ai_object.hpp" |
|
9 |
|
10 class AICargo : public AIObject { |
|
11 public: |
|
12 /** |
|
13 * Gets the string representation of the cargo label |
|
14 * @param cargo_type to get the string representation of |
|
15 * @return the cargo label |
|
16 * @note the returned cargo label must be freed |
|
17 */ |
|
18 char *GetCargoLabel(CargoID cargo_type); |
|
19 |
|
20 /** |
|
21 * Checks whether the give cargo is a freight or not |
|
22 * @param cargo_type is this cargo freight or not? |
|
23 * @return true if and only if the cargo is freight |
|
24 */ |
|
25 bool IsFreight(CargoID cargo_type); |
|
26 |
|
27 /** |
|
28 * Get the income for transporting a piece of cargo over the |
|
29 * given distance within the specified time. |
|
30 * @param distance the distance the cargo travels from begin to end |
|
31 * @param days_in_transit amount of (game) days the cargo is in transit |
|
32 * @param cargo_type the cargo to transport |
|
33 * @return the amount of money that would be made by this trip |
|
34 */ |
|
35 int32 GetCargoIncome(uint32 distance, uint32 days_in_transit, CargoID cargo_type); |
|
36 }; |
|
37 |
|
38 #ifdef SQUIRREL_CLASS |
|
39 void SQAICargoRegister(SquirrelEngine *engine) { |
|
40 DefSQClass <AICargo> SQAICargo("AICargo"); |
|
41 SQAICargo.PreRegister(engine); |
|
42 SQAICargo.AddConstructor(engine); |
|
43 SQAICargo.DefSQFunction(engine, &AICargo::GetCargoLabel, "GetCargoLabel"); |
|
44 SQAICargo.DefSQFunction(engine, &AICargo::IsFreight, "IsFreight"); |
|
45 SQAICargo.DefSQFunction(engine, &AICargo::GetCargoIncome, "GetCargoIncome"); |
|
46 SQAICargo.PostRegister(engine); |
|
47 } |
|
48 #endif /* SQUIRREL_CLASS */ |
|
49 |
|
50 #endif /* AI_CARGO_HPP */ |