summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-05-26 14:15:46 +0000
committerfrosch <frosch@openttd.org>2012-05-26 14:15:46 +0000
commitc796801c4d6c87c554e84312b1c3afd866e0e49c (patch)
tree591a8966fdacb5f7025b7fe0fb2f4b7094e30dbe
parent806e5f33d4daa7d571af580b6f8bf5897e7a5b0b (diff)
downloadopenttd-c796801c4d6c87c554e84312b1c3afd866e0e49c.tar.xz
(svn r24281) -Cleanup: Merge all company news subtypes into a single one; they all behave the same.
-rw-r--r--src/company_cmd.cpp4
-rw-r--r--src/economy.cpp4
-rw-r--r--src/news_func.h4
-rw-r--r--src/news_gui.cpp10
-rw-r--r--src/news_type.h5
5 files changed, 9 insertions, 18 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index 1ea293833..1137fe0d2 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -375,7 +375,7 @@ set_name:;
SetDParam(1, STR_NEWS_COMPANY_LAUNCH_DESCRIPTION);
SetDParamStr(2, cni->company_name);
SetDParam(3, t->index);
- AddNewsItem(STR_MESSAGE_NEWS_FORMAT, NS_COMPANY_NEW, NR_TILE, c->last_build_coordinate, NR_NONE, UINT32_MAX, cni);
+ AddNewsItem(STR_MESSAGE_NEWS_FORMAT, NS_COMPANY_INFO, NR_TILE, c->last_build_coordinate, NR_NONE, UINT32_MAX, cni);
}
return;
}
@@ -921,7 +921,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
SetDParam(0, STR_NEWS_COMPANY_BANKRUPT_TITLE);
SetDParam(1, STR_NEWS_COMPANY_BANKRUPT_DESCRIPTION);
SetDParamStr(2, cni->company_name);
- AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, NS_COMPANY_BANKRUPT, cni);
+ AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, cni);
/* Remove the company */
ChangeOwnershipOfCompanyItems(c->index, INVALID_OWNER);
diff --git a/src/economy.cpp b/src/economy.cpp
index 2311015da..f65dbcf92 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -541,7 +541,7 @@ static void CompanyCheckBankrupt(Company *c)
SetDParam(0, STR_NEWS_COMPANY_IN_TROUBLE_TITLE);
SetDParam(1, STR_NEWS_COMPANY_IN_TROUBLE_DESCRIPTION);
SetDParamStr(2, cni->company_name);
- AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, NS_COMPANY_TROUBLE, cni);
+ AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, cni);
AI::BroadcastNewEvent(new ScriptEventCompanyInTrouble(c->index));
Game::NewEvent(new ScriptEventCompanyInTrouble(c->index));
break;
@@ -1650,7 +1650,7 @@ static void DoAcquireCompany(Company *c)
SetDParamStr(2, cni->company_name);
SetDParamStr(3, cni->other_company_name);
SetDParam(4, c->bankrupt_value);
- AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, NS_COMPANY_MERGER, cni);
+ AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, cni);
AI::BroadcastNewEvent(new ScriptEventCompanyMerger(ci, _current_company));
Game::NewEvent(new ScriptEventCompanyMerger(ci, _current_company));
diff --git a/src/news_func.h b/src/news_func.h
index 4ee7ae000..542a307e4 100644
--- a/src/news_func.h
+++ b/src/news_func.h
@@ -19,9 +19,9 @@
void AddNewsItem(StringID string, NewsSubtype subtype, NewsReferenceType reftype1 = NR_NONE, uint32 ref1 = UINT32_MAX, NewsReferenceType reftype2 = NR_NONE, uint32 ref2 = UINT32_MAX, void *free_data = NULL);
-static inline void AddCompanyNewsItem(StringID string, NewsSubtype subtype, CompanyNewsInformation *cni)
+static inline void AddCompanyNewsItem(StringID string, CompanyNewsInformation *cni)
{
- AddNewsItem(string, subtype, NR_NONE, UINT32_MAX, NR_NONE, UINT32_MAX, cni);
+ AddNewsItem(string, NS_COMPANY_INFO, NR_NONE, UINT32_MAX, NR_NONE, UINT32_MAX, cni);
}
/**
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index 4b3bdf175..d7d9fc702 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -218,10 +218,7 @@ static const NewsSubtypeData _news_subtype_data[] = {
{ NT_ARRIVAL_COMPANY, (NF_NO_TRANSPARENT | NF_SHADE), &_thin_news_desc }, ///< NS_ARRIVAL_COMPANY
{ NT_ARRIVAL_OTHER, (NF_NO_TRANSPARENT | NF_SHADE), &_thin_news_desc }, ///< NS_ARRIVAL_OTHER
{ NT_ACCIDENT, (NF_NO_TRANSPARENT | NF_SHADE), &_thin_news_desc }, ///< NS_ACCIDENT
- { NT_COMPANY_INFO, NF_NONE, &_company_news_desc }, ///< NS_COMPANY_TROUBLE
- { NT_COMPANY_INFO, NF_NONE, &_company_news_desc }, ///< NS_COMPANY_MERGER
- { NT_COMPANY_INFO, NF_NONE, &_company_news_desc }, ///< NS_COMPANY_BANKRUPT
- { NT_COMPANY_INFO, NF_NONE, &_company_news_desc }, ///< NS_COMPANY_NEW
+ { NT_COMPANY_INFO, NF_NONE, &_company_news_desc }, ///< NS_COMPANY_INFO
{ NT_INDUSTRY_OPEN, (NF_NO_TRANSPARENT | NF_SHADE), &_thin_news_desc }, ///< NS_INDUSTRY_OPEN
{ NT_INDUSTRY_CLOSE, (NF_NO_TRANSPARENT | NF_SHADE), &_thin_news_desc }, ///< NS_INDUSTRY_CLOSE
{ NT_ECONOMY, NF_NONE, &_normal_news_desc }, ///< NS_ECONOMY
@@ -734,10 +731,7 @@ CommandCost CmdCustomNewsItem(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
switch (subtype) {
/* These sub types require more parameters that are never passed. */
- case NS_COMPANY_TROUBLE:
- case NS_COMPANY_MERGER:
- case NS_COMPANY_BANKRUPT:
- case NS_COMPANY_NEW:
+ case NS_COMPANY_INFO:
return CMD_ERROR;
/* This one only accepts engines. */
diff --git a/src/news_type.h b/src/news_type.h
index ea3cb7011..811ac49d9 100644
--- a/src/news_type.h
+++ b/src/news_type.h
@@ -59,10 +59,7 @@ enum NewsSubtype {
NS_ARRIVAL_COMPANY, ///< NT_ARRIVAL_COMPANY
NS_ARRIVAL_OTHER, ///< NT_ARRIVAL_OTHER
NS_ACCIDENT, ///< NT_ACCIDENT
- NS_COMPANY_TROUBLE, ///< NT_COMPANY_INFO (trouble)
- NS_COMPANY_MERGER, ///< NT_COMPANY_INFO (merger)
- NS_COMPANY_BANKRUPT, ///< NT_COMPANY_INFO (bankrupt)
- NS_COMPANY_NEW, ///< NT_COMPANY_INFO (new company)
+ NS_COMPANY_INFO, ///< NT_COMPANY_INFO
NS_INDUSTRY_OPEN, ///< NT_INDUSTRY_OPEN
NS_INDUSTRY_CLOSE, ///< NT_INDUSTRY_CLOSE
NS_ECONOMY, ///< NT_ECONOMY