diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/industry_cmd.cpp | 6 | ||||
-rw-r--r-- | src/lang/english.txt | 3 | ||||
-rw-r--r-- | src/news_gui.cpp | 9 | ||||
-rw-r--r-- | src/news_type.h | 6 | ||||
-rw-r--r-- | src/settings.cpp | 32 |
5 files changed, 46 insertions, 10 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index cabf41db8..19fb92f38 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1688,7 +1688,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) } else { SetDParam(1, ind->town->index); } - AddNewsItem(indspec->new_industry_text, NS_OPENCLOSE, ind->xy, 0); + AddNewsItem(indspec->new_industry_text, NS_INDUSTRY_OPEN, ind->xy, 0); } return CommandCost(EXPENSES_OTHER, indspec->GetConstructionCost()); @@ -1890,7 +1890,7 @@ static void MaybeNewIndustry(void) SetDParam(1, ind->town->index); } AddNewsItem(ind_spc->new_industry_text, - NS_OPENCLOSE, ind->xy, 0); + NS_INDUSTRY_OPEN, ind->xy, 0); } /** @@ -2205,7 +2205,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly) NewsSubtype ns; /* Compute news category */ if (closeit) { - ns = NS_OPENCLOSE; + ns = NS_INDUSTRY_CLOSE; } else { switch (WhoCanServiceIndustry(i)) { case 0: ns = NS_INDUSTRY_NOBODY; break; diff --git a/src/lang/english.txt b/src/lang/english.txt index 3b0b9dd97..aa26e4c57 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -590,7 +590,8 @@ STR_0206_ARRIVAL_OF_FIRST_VEHICLE :{YELLOW}Arrival STR_0207_ARRIVAL_OF_FIRST_VEHICLE :{YELLOW}Arrival of first vehicle at competitor's station STR_0208_ACCIDENTS_DISASTERS :{YELLOW}Accidents / disasters STR_0209_COMPANY_INFORMATION :{YELLOW}Company information -STR_NEWS_OPEN_CLOSE :{YELLOW}Open / close of industries +STR_NEWS_INDUSTRY_OPEN :{YELLOW}Opening of industries +STR_NEWS_INDUSTRY_CLOSE :{YELLOW}Closing of industries STR_020A_ECONOMY_CHANGES :{YELLOW}Economy changes STR_INDUSTRY_CHANGES_SERVED_BY_PLAYER :{YELLOW}Production changes of industries served by the player STR_INDUSTRY_CHANGES_SERVED_BY_OTHER :{YELLOW}Production changes of industries served by competitor(s) diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 82cb11c9e..f2828ef5f 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -132,7 +132,8 @@ static const struct NewsSubtypeData _news_subtype_data[NS_END] = { { NT_COMPANY_INFO, NM_NORMAL, NF_NONE, DrawNewsBankrupcy }, ///< NS_COMPANY_MERGER { NT_COMPANY_INFO, NM_NORMAL, NF_NONE, DrawNewsBankrupcy }, ///< NS_COMPANY_BANKRUPT { NT_COMPANY_INFO, NM_NORMAL, NF_TILE, DrawNewsBankrupcy }, ///< NS_COMPANY_NEW - { NT_OPENCLOSE, NM_THIN, NF_VIEWPORT|NF_TILE, NULL }, ///< NS_OPENCLOSE + { NT_INDUSTRY_OPEN, NM_THIN, NF_VIEWPORT|NF_TILE, NULL }, ///< NS_INDUSTRY_OPEN + { NT_INDUSTRY_CLOSE, NM_THIN, NF_VIEWPORT|NF_TILE, NULL }, ///< NS_INDUSTRY_CLOSE { NT_ECONOMY, NM_NORMAL, NF_NONE, NULL }, ///< NS_ECONOMY { NT_INDUSTRY_PLAYER, NM_THIN, NF_VIEWPORT|NF_TILE, NULL }, ///< NS_INDUSTRY_PLAYER { NT_INDUSTRY_OTHER, NM_THIN, NF_VIEWPORT|NF_TILE, NULL }, ///< NS_INDUSTRY_OTHER @@ -153,7 +154,8 @@ NewsTypeData _news_type_data[NT_END] = { { "arrival_other", 60, SND_1D_APPLAUSE, ND_FULL }, ///< NT_ARRIVAL_OTHER { "accident", 90, SND_BEGIN, ND_FULL }, ///< NT_ACCIDENT { "company_info", 60, SND_BEGIN, ND_FULL }, ///< NT_COMPANY_INFO - { "openclose", 90, SND_BEGIN, ND_FULL }, ///< NT_OPENCLOSE + { "open", 90, SND_BEGIN, ND_FULL }, ///< NT_INDUSTRY_OPEN + { "close", 90, SND_BEGIN, ND_FULL }, ///< NT_INDUSTRY_CLOSE { "economy", 30, SND_BEGIN, ND_FULL }, ///< NT_ECONOMY { "production_player", 30, SND_BEGIN, ND_FULL }, ///< NT_INDUSTRY_PLAYER { "production_other", 30, SND_BEGIN, ND_FULL }, ///< NT_INDUSTRY_OTHER @@ -947,7 +949,8 @@ NEWS_SETTINGS_LINE(26, NT_ARRIVAL_PLAYER, STR_0206_ARRIVAL_OF_FIRST_VEHICLE), NEWS_SETTINGS_LINE(26, NT_ARRIVAL_OTHER, STR_0207_ARRIVAL_OF_FIRST_VEHICLE), NEWS_SETTINGS_LINE(26, NT_ACCIDENT, STR_0208_ACCIDENTS_DISASTERS), NEWS_SETTINGS_LINE(26, NT_COMPANY_INFO, STR_0209_COMPANY_INFORMATION), -NEWS_SETTINGS_LINE(26, NT_OPENCLOSE, STR_NEWS_OPEN_CLOSE), +NEWS_SETTINGS_LINE(26, NT_INDUSTRY_OPEN, STR_NEWS_INDUSTRY_OPEN), +NEWS_SETTINGS_LINE(26, NT_INDUSTRY_CLOSE, STR_NEWS_INDUSTRY_CLOSE), NEWS_SETTINGS_LINE(26, NT_ECONOMY, STR_020A_ECONOMY_CHANGES), NEWS_SETTINGS_LINE(26, NT_INDUSTRY_PLAYER, STR_INDUSTRY_CHANGES_SERVED_BY_PLAYER), NEWS_SETTINGS_LINE(26, NT_INDUSTRY_OTHER, STR_INDUSTRY_CHANGES_SERVED_BY_OTHER), diff --git a/src/news_type.h b/src/news_type.h index b83603ab6..edc3930da 100644 --- a/src/news_type.h +++ b/src/news_type.h @@ -17,7 +17,8 @@ enum NewsType { NT_ARRIVAL_OTHER, ///< Cargo arrived for competitor NT_ACCIDENT, ///< An accident or disaster has occurred NT_COMPANY_INFO, ///< Company info (new companies, bankrupcy messages) - NT_OPENCLOSE, ///< Opening and closing of industries + NT_INDUSTRY_OPEN, ///< Opening of industries + NT_INDUSTRY_CLOSE, ///< Closing of industries NT_ECONOMY, ///< Economic changes (recession, industry up/dowm) NT_INDUSTRY_PLAYER, ///< Production changes of industry serviced by local player NT_INDUSTRY_OTHER, ///< Production changes of industry serviced by competitor(s) @@ -42,7 +43,8 @@ enum NewsSubtype { NS_COMPANY_MERGER, ///< NT_COMPANY_INFO (merger) NS_COMPANY_BANKRUPT, ///< NT_COMPANY_INFO (bankrupt) NS_COMPANY_NEW, ///< NT_COMPANY_INFO (new company) - NS_OPENCLOSE, ///< NT_OPENCLOSE + NS_INDUSTRY_OPEN, ///< NS_INDUSTRY_OPEN + NS_INDUSTRY_CLOSE, ///< NS_INDUSTRY_CLOSE NS_ECONOMY, ///< NT_ECONOMY NS_INDUSTRY_PLAYER, ///< NT_INDUSTRY_PLAYER NS_INDUSTRY_OTHER, ///< NT_INDUSTRY_OTHER diff --git a/src/settings.cpp b/src/settings.cpp index 32eb48797..213c1e716 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1890,6 +1890,30 @@ static void HandleOldDiffCustom(bool savegame) } } +/** tries to convert newly introduced news settings based on old ones + * @param name pointer to the string defining name of the old news config + * @param value pointer to the string defining value of the old news config + * @returns true if conversion could have been made */ +bool ConvertOldNewsSetting(const char *name, const char *value) +{ + if (strcasecmp(name, "openclose") == 0) { + /* openclose has been split in "open" and "close". + * So the job is now to decrypt the value of the old news config + * and give it to the two newly introduced ones*/ + + NewsDisplay display = ND_OFF; //default + if (strcasecmp(value, "full") == 0) { + display = ND_FULL; + } else if (strcasecmp(value, "summarized") == 0) { + display = ND_SUMMARY; + } + /* tranfert of values */ + _news_type_data[NT_INDUSTRY_OPEN].display = display; + _news_type_data[NT_INDUSTRY_CLOSE].display = display; + return true; + } + return false; +} static void NewsDisplayLoadConfig(IniFile *ini, const char *grpname) { @@ -1907,8 +1931,14 @@ static void NewsDisplayLoadConfig(IniFile *ini, const char *grpname) break; } } + + /* the config been read is not within current aceptable config */ if (news_item == -1) { - DEBUG(misc, 0, "Invalid display option: %s", item->name); + /* if the conversion function cannot process it, advice by a debug warning*/ + if (!ConvertOldNewsSetting(item->name, item->value)) { + DEBUG(misc, 0, "Invalid display option: %s", item->name); + } + /* in all cases, there is nothing left to do */ continue; } |