Changeset - r19366:08e6508de827
[Not reviewed]
master
0 5 0
frosch - 12 years ago 2012-05-26 14:15:46
frosch@openttd.org
(svn r24281) -Cleanup: Merge all company news subtypes into a single one; they all behave the same.
5 files changed with 9 insertions and 18 deletions:
0 comments (0 inline, 0 general)
src/company_cmd.cpp
Show inline comments
 
@@ -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 til
 
			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);
src/economy.cpp
Show inline comments
 
@@ -541,7 +541,7 @@ static void CompanyCheckBankrupt(Company
 
			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));
 

	
src/news_func.h
Show inline comments
 
@@ -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);
 
}
 

	
 
/**
src/news_gui.cpp
Show inline comments
 
@@ -218,10 +218,7 @@ static const NewsSubtypeData _news_subty
 
	{ 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 
 

	
 
	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. */
src/news_type.h
Show inline comments
 
@@ -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
0 comments (0 inline, 0 general)