summaryrefslogtreecommitdiff
path: root/src/script/api/script_news.hpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2015-02-22 17:25:29 +0000
committeralberth <alberth@openttd.org>2015-02-22 17:25:29 +0000
commit0143f486f29d1e72082bcb3ac6c1d16c695b09af (patch)
tree7d8a4e4f144a78a36a597cfd8770562b2e9017b9 /src/script/api/script_news.hpp
parentc639fb0d8eb0371a95c39027a986636f1ca8f764 (diff)
downloadopenttd-0143f486f29d1e72082bcb3ac6c1d16c695b09af.tar.xz
(svn r27164) -Add: [NoGo] Game scripts can point to a location, station, industry, or town when publishing news.
Diffstat (limited to 'src/script/api/script_news.hpp')
-rw-r--r--src/script/api/script_news.hpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/script/api/script_news.hpp b/src/script/api/script_news.hpp
index 8defa3a85..ca0656608 100644
--- a/src/script/api/script_news.hpp
+++ b/src/script/api/script_news.hpp
@@ -36,15 +36,36 @@ public:
};
/**
- * Create a news messages for a company.
+ * Reference to a game element.
+ */
+ enum NewsReferenceType {
+ /* Selection of useful game elements to refer to. */
+ NR_NONE = ::NR_NONE, ///< No reference supplied.
+ NR_TILE = ::NR_TILE, ///< Reference location, scroll to the location when clicking on the news.
+ NR_STATION = ::NR_STATION, ///< Reference station, scroll to the station when clicking on the news. Delete news when the station is deleted.
+ NR_INDUSTRY = ::NR_INDUSTRY, ///< Reference industry, scrolls to the industry when clicking on the news. Delete news when the industry is deleted.
+ NR_TOWN = ::NR_TOWN, ///< Reference town, scroll to the town when clicking on the news.
+ };
+
+ /**
+ * Create a news message for everybody, or for one company.
* @param type The type of the news.
* @param text The text message to show (can be either a raw string, or a ScriptText object).
* @param company The company, or COMPANY_INVALID for all companies.
+ * @param ref_type Type of referred game element.
+ * @param reference The referenced game element of \a ref_type.
+ * - For #NR_NONE this parameter is ignored.
+ * - For #NR_TILE this parameter should be a valid location (ScriptMap::IsValidTile).
+ * - For #NR_STATION this parameter should be a valid stationID (ScriptStation::IsValidStation).
+ * - For #NR_INDUSTRY this parameter should be a valid industryID (ScriptIndustry::IsValidIndustry).
+ * - For #NR_TOWN this parameter should be a valid townID (ScriptTown::IsValidTown).
* @return True if the action succeeded.
+ * @pre type must be #NT_ECONOMY, #NT_SUBSIDIES, or #NT_GENERAL.
* @pre text != NULL.
* @pre company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.
+ * @pre The \a reference condition must be fulfilled.
*/
- static bool Create(NewsType type, Text *text, ScriptCompany::CompanyID company);
+ static bool Create(NewsType type, Text *text, ScriptCompany::CompanyID company, NewsReferenceType ref_type, uint32 reference);
};
#endif /* SCRIPT_NEWS_HPP */