src/ai/api/ai_sign.hpp
branchnoai
changeset 9838 0839682a601b
parent 9829 80fbe02a4184
child 10090 d6a6cac2fb25
equal deleted inserted replaced
9837:c9ec4f82e0d0 9838:0839682a601b
    14 public:
    14 public:
    15 	static const char *GetClassName() { return "AISign"; }
    15 	static const char *GetClassName() { return "AISign"; }
    16 
    16 
    17 	/**
    17 	/**
    18 	 * Gets the maximum sign index; there are no valid signs with a higher index.
    18 	 * Gets the maximum sign index; there are no valid signs with a higher index.
    19 	 * @return the maximum sign index.
    19 	 * @return The maximum sign index.
    20 	 * @post return value is always non-negative.
    20 	 * @post Return value is always non-negative.
    21 	 */
    21 	 */
    22 	static SignID GetMaxSignID();
    22 	static SignID GetMaxSignID();
    23 
    23 
    24 	/**
    24 	/**
    25 	 * Gets the number of signs. This is different than GetMaxSignID()
    25 	 * Gets the number of signs. This is different than GetMaxSignID()
    26 	 *   because of the way OpenTTD works internally.
    26 	 *   because of the way OpenTTD works internally.
    27 	 * @return the number of signs.
    27 	 * @return The number of signs.
    28 	 * @post return value is always non-negative.
    28 	 * @post Return value is always non-negative.
    29 	 */
    29 	 */
    30 	static int32 GetSignCount();
    30 	static int32 GetSignCount();
    31 
    31 
    32 	/**
    32 	/**
    33 	 * Checks whether the given sign index is valid.
    33 	 * Checks whether the given sign index is valid.
    34 	 * @param sign_id the index to check.
    34 	 * @param sign_id The index to check.
    35 	 * @return true if and only if the sign is valid.
    35 	 * @return True if and only if the sign is valid.
    36 	 */
    36 	 */
    37 	static bool IsValidSign(SignID sign_id);
    37 	static bool IsValidSign(SignID sign_id);
    38 
    38 
    39 	/**
    39 	/**
    40 	 * Get the text on the sign.
    40 	 * Get the text on the sign.
    41 	 * @param sign_id the sign to get the text of.
    41 	 * @param sign_id The sign to get the text of.
    42 	 * @pre sign_id has to be valid (use IsValidSign()).
    42 	 * @pre IsValidSign(sign_id).
    43 	 * @return the text on the sign.
    43 	 * @return The text on the sign.
    44 	 * @note the returned name must be free'd (C++ only).
       
    45 	 */
    44 	 */
    46 	static char *GetText(SignID sign_id);
    45 	static char *GetText(SignID sign_id);
    47 
    46 
    48 	/**
    47 	/**
    49 	 * Gets the location of the sign.
    48 	 * Gets the location of the sign.
    50 	 * @param sign_id the sign to get the location of.
    49 	 * @param sign_id The sign to get the location of.
    51 	 * @pre sign_id has to be valid (use IsValidSign()).
    50 	 * @pre IsValidSign(sign_id).
    52 	 * @return the location of the sign.
    51 	 * @return The location of the sign.
    53 	 * @post return value is always valid with AIMap::IsValidTile().
       
    54 	 */
    52 	 */
    55 	static TileIndex GetLocation(SignID sign_id);
    53 	static TileIndex GetLocation(SignID sign_id);
    56 
    54 
    57 	/**
    55 	/**
    58 	 * Builds a sign on the map.
    56 	 * Builds a sign on the map.
    59 	 * @param location the place to build the sign.
    57 	 * @param location The place to build the sign.
    60 	 * @param text     the text to place on the sign.
    58 	 * @param text The text to place on the sign.
    61 	 * @pre AIMap::IsValidTile(location).
    59 	 * @pre AIMap::IsValidTile(location).
    62 	 * @pre text is not NULL and non-empty, i.e. length is positive.
    60 	 * @return The SignID of the build sign (use IsValidSign() to check for validity).
    63 	 * @return the SignID of the build sign (use IsValidSign() to check for validity).
       
    64 	 *   In test-mode it returns 0 if successful, or any other value to indicate
    61 	 *   In test-mode it returns 0 if successful, or any other value to indicate
    65 	 *   failure.
    62 	 *   failure.
    66 	 */
    63 	 */
    67 	static SignID BuildSign(TileIndex location, const char *text);
    64 	static SignID BuildSign(TileIndex location, const char *text);
    68 
    65 
    69 	/**
    66 	/**
    70 	 * Removes a sign from the map.
    67 	 * Removes a sign from the map.
    71 	 * @param sign_id the sign to remove.
    68 	 * @param sign_id The sign to remove.
    72 	 * @pre sign_id has to be valid (use IsValidSign()).
    69 	 * @pre IsValidSign(sign_id).
    73 	 * @return true if and only if the sign has been removed.
    70 	 * @return True if and only if the sign has been removed.
    74 	 */
    71 	 */
    75 	static bool RemoveSign(SignID sign_id);
    72 	static bool RemoveSign(SignID sign_id);
    76 };
    73 };
    77 
    74 
    78 #endif /* AI_SIGN_HPP */
    75 #endif /* AI_SIGN_HPP */