src/ai/api/ai_cargo.hpp
author rubidium
Sat, 14 Apr 2007 21:57:44 +0000
branchnoai
changeset 9596 8af5a1399842
parent 9594 5009a30f320a
child 9737 ee408edf3851
permissions -rw-r--r--
(svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
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
	 */
df6f3b4b0038 (svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff changeset
    33
	char *GetCargoLabel(CargoID cargo_type);
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
	 */
df6f3b4b0038 (svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff changeset
    40
	bool IsFreight(CargoID cargo_type);
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.
8f3c1bc72204 (svn r9272) [NoAI] -Documentation: made the documentation of the first 3 API files more readable for non-programmers
truelight
parents: 9427
diff changeset
    45
	 * @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
    46
	 * @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
    47
	 * @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
    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
	 */
df6f3b4b0038 (svn r9202) [NoAI] -Add: some initial functions for cargo and industries.
rubidium
parents:
diff changeset
    50
	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
    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 */