rubidium@9511: /* $Id$ */ rubidium@9511: rubidium@9511: /** @file ai_sign.hpp Everything to query and build signs */ rubidium@9511: rubidium@9511: #ifndef AI_SIGN_HPP rubidium@9511: #define AI_SIGN_HPP rubidium@9511: rubidium@9511: #include "ai_object.hpp" rubidium@9511: rubidium@9511: /** rubidium@9513: * Class that handles all sign related functions. rubidium@9511: */ rubidium@9511: class AISign : public AIObject { rubidium@9511: public: rubidium@9511: /** truelight@9529: * The name of the class, needed by several sub-processes. truelight@9529: */ truelight@9529: static const char *GetClassName() { return "AISign"; } truelight@9529: truelight@9529: /** rubidium@9511: * Gets the maximum sign index; there are no valid signs with a higher index. rubidium@9513: * @return the maximum sign index. rubidium@9511: * @post return value is always non-negative. rubidium@9511: */ truebrain@9737: static SignID GetMaxSignID(); rubidium@9511: rubidium@9511: /** rubidium@9513: * Gets the number of signs. This is different than GetMaxSignID() rubidium@9511: * because of the way OpenTTD works internally. rubidium@9511: * @return the number of signs. rubidium@9511: * @post return value is always non-negative. rubidium@9511: */ truebrain@9737: static int32 GetSignCount(); rubidium@9511: rubidium@9511: /** rubidium@9511: * Checks whether the given sign index is valid. rubidium@9511: * @param sign_id the index to check. rubidium@9511: * @return true if and only if the sign is valid. rubidium@9511: */ rubidium@9511: static bool IsValidSign(SignID sign_id); rubidium@9511: rubidium@9511: /** rubidium@9511: * Get the text on the sign. rubidium@9511: * @param sign_id the sign to get the text of. rubidium@9511: * @pre sign_id has to be valid (use IsValidSign()). rubidium@9511: * @return the text on the sign. rubidium@9511: * @note the returned name must be free'd (C++ only). rubidium@9511: */ truebrain@9737: static char *GetText(SignID sign_id); rubidium@9511: rubidium@9511: /** rubidium@9511: * Gets the location of the sign. rubidium@9511: * @param sign_id the sign to get the location of. rubidium@9511: * @pre sign_id has to be valid (use IsValidSign()). rubidium@9511: * @return the location of the sign. rubidium@9511: * @post return value is always positive and below AIMap::GetMapSize(). rubidium@9511: */ truebrain@9737: static TileIndex GetLocation(SignID sign_id); rubidium@9511: rubidium@9511: /** rubidium@9511: * Removes a sign from the map. rubidium@9511: * @param sign_id the sign to remove. rubidium@9511: * @pre sign_id has to be valid (use IsValidSign()). rubidium@9511: * @return true if and only if the sign has been removed. rubidium@9511: */ truebrain@9737: static bool RemoveSign(SignID sign_id); rubidium@9511: rubidium@9511: /** rubidium@9511: * Builds a sign on the map. rubidium@9511: * @param location the place to build the sign. rubidium@9511: * @param text the text to place on the sign. rubidium@9511: * @pre location is always positive and below AIMap::GetMapSize() rubidium@9511: * @pre text is not NULL and non-empty, i.e. length is positive. rubidium@9511: * @return the SignID of the build sign (use IsValidSign() to check for validity). truelight@9562: * In test-mode it returns 0 if successful, or any other value to indicate truelight@9562: * failure. rubidium@9511: */ truebrain@9737: static SignID BuildSign(TileIndex location, const char *text); rubidium@9511: }; rubidium@9511: rubidium@9511: #endif /* AI_SIGN_HPP */