Changeset - r19888:a6490abb0294
[Not reviewed]
master
0 7 0
frosch - 11 years ago 2012-12-23 21:07:12
frosch@openttd.org
(svn r24843) -Codechange: Move news display options into the general settings framework. (based on patch by eagle_rainbow)
7 files changed with 193 insertions and 124 deletions:
0 comments (0 inline, 0 general)
src/news_func.h
Show inline comments
 
@@ -51,20 +51,18 @@ static inline void AddTileNewsItem(Strin
 

	
 
static inline void AddIndustryNewsItem(StringID string, NewsType type, IndustryID industry)
 
{
 
	AddNewsItem(string, type, NF_NO_TRANSPARENT | NF_SHADE | NF_THIN, NR_INDUSTRY, industry);
 
}
 

	
 
void NewsLoop();
 
void InitNewsItemStructs();
 

	
 
extern const NewsItem *_statusbar_news_item;
 
extern bool _news_ticker_sound;
 

	
 
extern NewsTypeData _news_type_data[];
 

	
 
void DeleteInvalidEngineNews();
 
void DeleteVehicleNews(VehicleID vid, StringID news);
 
void DeleteStationNews(StationID sid);
 
void DeleteIndustryNews(IndustryID iid);
 

	
 
#endif /* NEWS_FUNC_H */
src/news_gui.cpp
Show inline comments
 
@@ -23,24 +23,25 @@
 
#include "town.h"
 
#include "sound_func.h"
 
#include "string_func.h"
 
#include "widgets/dropdown_func.h"
 
#include "statusbar_gui.h"
 
#include "company_manager_face.h"
 
#include "company_func.h"
 
#include "engine_base.h"
 
#include "engine_gui.h"
 
#include "core/geometry_func.hpp"
 
#include "command_func.h"
 
#include "company_base.h"
 
#include "settings_internal.h"
 

	
 
#include "widgets/news_widget.h"
 

	
 
#include "table/strings.h"
 

	
 
const NewsItem *_statusbar_news_item = NULL;
 
bool _news_ticker_sound; ///< Make a ticker sound when a news item is published.
 

	
 
static uint MIN_NEWS_AMOUNT = 30;           ///< prefered minimum amount of news messages
 
static uint _total_news = 0;                ///< current number of news items
 
static NewsItem *_oldest_news = NULL;       ///< head of news items queue
 
static NewsItem *_latest_news = NULL;       ///< tail of news items queue
 
@@ -213,45 +214,58 @@ static const WindowDesc* _news_window_la
 
};
 

	
 
const WindowDesc* GetNewsWindowLayout(NewsFlag flags)
 
{
 
	uint layout = GB(flags, NFB_WINDOW_LAYOUT, NFB_WINDOW_LAYOUT_COUNT);
 
	assert(layout < lengthof(_news_window_layout));
 
	return _news_window_layout[layout];
 
}
 

	
 
/**
 
 * Per-NewsType data
 
 */
 
NewsTypeData _news_type_data[] = {
 
	/*            name,              age, sound,           display,    description */
 
	NewsTypeData("arrival_player",    60, SND_1D_APPLAUSE, ND_FULL,    STR_NEWS_MESSAGE_TYPE_ARRIVAL_OF_FIRST_VEHICLE_OWN       ),  ///< NT_ARRIVAL_COMPANY
 
	NewsTypeData("arrival_other",     60, SND_1D_APPLAUSE, ND_SUMMARY, STR_NEWS_MESSAGE_TYPE_ARRIVAL_OF_FIRST_VEHICLE_OTHER     ),  ///< NT_ARRIVAL_OTHER
 
	NewsTypeData("accident",          90, SND_BEGIN,       ND_FULL,    STR_NEWS_MESSAGE_TYPE_ACCIDENTS_DISASTERS                ),  ///< NT_ACCIDENT
 
	NewsTypeData("company_info",      60, SND_BEGIN,       ND_FULL,    STR_NEWS_MESSAGE_TYPE_COMPANY_INFORMATION                ),  ///< NT_COMPANY_INFO
 
	NewsTypeData("open",              90, SND_BEGIN,       ND_SUMMARY, STR_NEWS_MESSAGE_TYPE_INDUSTRY_OPEN                      ),  ///< NT_INDUSTRY_OPEN
 
	NewsTypeData("close",             90, SND_BEGIN,       ND_SUMMARY, STR_NEWS_MESSAGE_TYPE_INDUSTRY_CLOSE                     ),  ///< NT_INDUSTRY_CLOSE
 
	NewsTypeData("economy",           30, SND_BEGIN,       ND_FULL,    STR_NEWS_MESSAGE_TYPE_ECONOMY_CHANGES                    ),  ///< NT_ECONOMY
 
	NewsTypeData("production_player", 30, SND_BEGIN,       ND_SUMMARY, STR_NEWS_MESSAGE_TYPE_INDUSTRY_CHANGES_SERVED_BY_COMPANY ),  ///< NT_INDUSTRY_COMPANY
 
	NewsTypeData("production_other",  30, SND_BEGIN,       ND_OFF,     STR_NEWS_MESSAGE_TYPE_INDUSTRY_CHANGES_SERVED_BY_OTHER   ),  ///< NT_INDUSTRY_OTHER
 
	NewsTypeData("production_nobody", 30, SND_BEGIN,       ND_OFF,     STR_NEWS_MESSAGE_TYPE_INDUSTRY_CHANGES_UNSERVED          ),  ///< NT_INDUSTRY_NOBODY
 
	NewsTypeData("advice",           150, SND_BEGIN,       ND_FULL,    STR_NEWS_MESSAGE_TYPE_ADVICE_INFORMATION_ON_COMPANY      ),  ///< NT_ADVICE
 
	NewsTypeData("new_vehicles",      30, SND_1E_OOOOH,    ND_FULL,    STR_NEWS_MESSAGE_TYPE_NEW_VEHICLES                       ),  ///< NT_NEW_VEHICLES
 
	NewsTypeData("acceptance",        90, SND_BEGIN,       ND_FULL,    STR_NEWS_MESSAGE_TYPE_CHANGES_OF_CARGO_ACCEPTANCE        ),  ///< NT_ACCEPTANCE
 
	NewsTypeData("subsidies",        180, SND_BEGIN,       ND_SUMMARY, STR_NEWS_MESSAGE_TYPE_SUBSIDIES                          ),  ///< NT_SUBSIDIES
 
	NewsTypeData("general",           60, SND_BEGIN,       ND_FULL,    STR_NEWS_MESSAGE_TYPE_GENERAL_INFORMATION                ),  ///< NT_GENERAL
 
static NewsTypeData _news_type_data[] = {
 
	/*            name,                           age, sound,          */
 
	NewsTypeData("news_display.arrival_player",    60, SND_1D_APPLAUSE ),  ///< NT_ARRIVAL_COMPANY
 
	NewsTypeData("news_display.arrival_other",     60, SND_1D_APPLAUSE ),  ///< NT_ARRIVAL_OTHER
 
	NewsTypeData("news_display.accident",          90, SND_BEGIN       ),  ///< NT_ACCIDENT
 
	NewsTypeData("news_display.company_info",      60, SND_BEGIN       ),  ///< NT_COMPANY_INFO
 
	NewsTypeData("news_display.open",              90, SND_BEGIN       ),  ///< NT_INDUSTRY_OPEN
 
	NewsTypeData("news_display.close",             90, SND_BEGIN       ),  ///< NT_INDUSTRY_CLOSE
 
	NewsTypeData("news_display.economy",           30, SND_BEGIN       ),  ///< NT_ECONOMY
 
	NewsTypeData("news_display.production_player", 30, SND_BEGIN       ),  ///< NT_INDUSTRY_COMPANY
 
	NewsTypeData("news_display.production_other",  30, SND_BEGIN       ),  ///< NT_INDUSTRY_OTHER
 
	NewsTypeData("news_display.production_nobody", 30, SND_BEGIN       ),  ///< NT_INDUSTRY_NOBODY
 
	NewsTypeData("news_display.advice",           150, SND_BEGIN       ),  ///< NT_ADVICE
 
	NewsTypeData("news_display.new_vehicles",      30, SND_1E_OOOOH    ),  ///< NT_NEW_VEHICLES
 
	NewsTypeData("news_display.acceptance",        90, SND_BEGIN       ),  ///< NT_ACCEPTANCE
 
	NewsTypeData("news_display.subsidies",        180, SND_BEGIN       ),  ///< NT_SUBSIDIES
 
	NewsTypeData("news_display.general",           60, SND_BEGIN       ),  ///< NT_GENERAL
 
};
 

	
 
assert_compile(lengthof(_news_type_data) == NT_END);
 

	
 
/**
 
 * Return the news display option.
 
 * @return display options
 
 */
 
NewsDisplay NewsTypeData::GetDisplay() const
 
{
 
	uint index;
 
	const SettingDesc *sd = GetSettingFromName(this->name, &index);
 
	assert(sd != NULL);
 
	void *ptr = GetVariableAddress(NULL, &sd->save);
 
	return (NewsDisplay)ReadValue(ptr, sd->save.conv);
 
}
 

	
 
/** Window class displaying a news item. */
 
struct NewsWindow : Window {
 
	uint16 chat_height;   ///< Height of the chat window.
 
	uint16 status_height; ///< Height of the status bar window
 
	const NewsItem *ni;   ///< News item to display.
 
	static uint duration; ///< Remaining time for showing current news message (may only be accessed while a news item is displayed).
 

	
 
	NewsWindow(const WindowDesc *desc, const NewsItem *ni) : Window(), ni(ni)
 
	{
 
		NewsWindow::duration = 555;
 
		const Window *w = FindWindowByClass(WC_SEND_NETWORK_MSG);
 
		this->chat_height = (w != NULL) ? w->height : 0;
 
@@ -578,25 +592,25 @@ static void MoveToNextItem()
 
	_forced_news = NULL;
 
	_statusbar_news_item = NULL;
 

	
 
	/* if we're not at the last item, then move on */
 
	if (_current_news != _latest_news) {
 
		_current_news = (_current_news == NULL) ? _oldest_news : _current_news->next;
 
		const NewsItem *ni = _current_news;
 
		const NewsType type = ni->type;
 

	
 
		/* check the date, don't show too old items */
 
		if (_date - _news_type_data[type].age > ni->date) return;
 

	
 
		switch (_news_type_data[type].display) {
 
		switch (_news_type_data[type].GetDisplay()) {
 
			default: NOT_REACHED();
 
			case ND_OFF: // Off - show nothing only a small reminder in the status bar
 
				InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SHOW_REMINDER);
 
				break;
 

	
 
			case ND_SUMMARY: // Summary - show ticker
 
				ShowTicker(ni);
 
				break;
 

	
 
			case ND_FULL: // Full - show newspaper
 
				ShowNewspaper(ni);
 
				break;
 
@@ -898,25 +912,25 @@ void ShowLastNewsMessage()
 
		 * open (which can only be the current one), then show the previous item */
 
		const Window *w = FindWindowById(WC_NEWS_WINDOW, 0);
 
		ni = (w == NULL || (_current_news == _oldest_news)) ? _current_news : _current_news->prev;
 
	} else if (_forced_news == _oldest_news) {
 
		/* We have reached the oldest news, start anew with the latest */
 
		ni = _latest_news;
 
	} else {
 
		/* 'Scrolling' through news history show each one in turn */
 
		ni = _forced_news->prev;
 
	}
 
	bool wrap = false;
 
	for (;;) {
 
		if (_news_type_data[ni->type].display != ND_OFF) {
 
		if (_news_type_data[ni->type].GetDisplay() != ND_OFF) {
 
			ShowNewsMessage(ni);
 
			break;
 
		}
 

	
 
		ni = ni->prev;
 
		if (ni == NULL) {
 
			if (wrap) break;
 
			/* We have reached the oldest news, start anew with the latest */
 
			ni = _latest_news;
 
			wrap = true;
 
		}
 
	}
src/news_type.h
Show inline comments
 
@@ -104,42 +104,39 @@ enum NewsDisplay {
 
	ND_OFF,        ///< Only show a reminder in the status bar
 
	ND_SUMMARY,    ///< Show ticker
 
	ND_FULL,       ///< Show newspaper
 
};
 

	
 
/**
 
 * Per-NewsType data
 
 */
 
struct NewsTypeData {
 
	const char * const name;    ///< Name
 
	const byte age;             ///< Maximum age of news items (in days)
 
	const SoundFx sound;        ///< Sound
 
	NewsDisplay display;        ///< Display mode (off, summary, full)
 
	const StringID description; ///< Description of the news type in news settings window
 

	
 
	/**
 
	 * Construct this entry.
 
	 * @param name The name of the type.
 
	 * @param age The maximum age for these messages.
 
	 * @param sound The sound to play.
 
	 * @param description The description for this type of messages.
 
	 */
 
	NewsTypeData(const char *name, byte age, SoundFx sound, NewsDisplay display, StringID description) :
 
	NewsTypeData(const char *name, byte age, SoundFx sound) :
 
		name(name),
 
		age(age),
 
		sound(sound),
 
		display(display),
 
		description(description)
 
		sound(sound)
 
	{
 
	}
 

	
 
	NewsDisplay GetDisplay() const;
 
};
 

	
 
/** Information about a single item of news. */
 
struct NewsItem {
 
	NewsItem *prev;              ///< Previous news item
 
	NewsItem *next;              ///< Next news item
 
	StringID string_id;          ///< Message text
 
	Date date;                   ///< Date of the news
 
	NewsType type;               ///< Type of the news
 
	NewsFlag flags;              ///< NewsFlags bits @see NewsFlag
 

	
 
	NewsReferenceType reftype1;  ///< Type of ref1
src/settings.cpp
Show inline comments
 
@@ -1234,99 +1234,24 @@ static void HandleOldDiffCustom(bool sav
 
		if (!old_diff_custom_used) return;
 
	}
 

	
 
	for (uint i = 0; i < options_to_load; i++) {
 
		const SettingDesc *sd = &_settings[i];
 
		/* Skip deprecated options */
 
		if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue;
 
		void *var = GetVariableAddress(savegame ? &_settings_game : &_settings_newgame, &sd->save);
 
		Write_ValidateSetting(var, sd, (int32)((i == 4 ? 1000 : 1) * _old_diff_custom[i]));
 
	}
 
}
 

	
 
/**
 
 * 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
 
 */
 
static 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;
 
}
 

	
 
/**
 
 * Load newstype settings from a configuration file.
 
 * @param ini the configuration to read from.
 
 * @param grpname Name of the group containing the news type settings.
 
 */
 
static void NewsDisplayLoadConfig(IniFile *ini, const char *grpname)
 
{
 
	IniGroup *group = ini->GetGroup(grpname);
 
	IniItem *item;
 

	
 
	/* If no group exists, return */
 
	if (group == NULL) return;
 

	
 
	for (item = group->item; item != NULL; item = item->next) {
 
		int news_item = -1;
 
		for (int i = 0; i < NT_END; i++) {
 
			if (strcasecmp(item->name, _news_type_data[i].name) == 0) {
 
				news_item = i;
 
				break;
 
			}
 
		}
 

	
 
		/* the config been read is not within current aceptable config */
 
		if (news_item == -1) {
 
			/* 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;
 
		}
 

	
 
		if (StrEmpty(item->value)) {
 
			DEBUG(misc, 0, "Empty display value for newstype %s", item->name);
 
			continue;
 
		} else if (strcasecmp(item->value, "full") == 0) {
 
			_news_type_data[news_item].display = ND_FULL;
 
		} else if (strcasecmp(item->value, "off") == 0) {
 
			_news_type_data[news_item].display = ND_OFF;
 
		} else if (strcasecmp(item->value, "summarized") == 0) {
 
			_news_type_data[news_item].display = ND_SUMMARY;
 
		} else {
 
			DEBUG(misc, 0, "Invalid display value for newstype %s: %s", item->name, item->value);
 
			continue;
 
		}
 
	}
 
}
 

	
 
static void AILoadConfig(IniFile *ini, const char *grpname)
 
{
 
	IniGroup *group = ini->GetGroup(grpname);
 
	IniItem *item;
 

	
 
	/* Clean any configured AI */
 
	for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
 
		AIConfig::GetConfig(c, AIConfig::SSS_FORCE_NEWGAME)->Change(NULL);
 
	}
 

	
 
	/* If no group exists, return */
 
	if (group == NULL) return;
 
@@ -1438,43 +1363,24 @@ static GRFConfig *GRFLoadConfig(IniFile 
 

	
 
		/* Mark file as static to avoid saving in savegame. */
 
		if (is_static) SetBit(c->flags, GCF_STATIC);
 

	
 
		/* Add item to list */
 
		*curr = c;
 
		curr = &c->next;
 
	}
 

	
 
	return first;
 
}
 

	
 
/**
 
 * Write newstype settings to a configuration file.
 
 * @param ini     The configuration to write to.
 
 * @param grpname Name of the group containing the news type settings.
 
 */
 
static void NewsDisplaySaveConfig(IniFile *ini, const char *grpname)
 
{
 
	IniGroup *group = ini->GetGroup(grpname);
 

	
 
	for (int i = 0; i < NT_END; i++) {
 
		const char *value;
 
		int v = _news_type_data[i].display;
 

	
 
		value = (v == ND_OFF ? "off" : (v == ND_SUMMARY ? "summarized" : "full"));
 

	
 
		group->GetItem(_news_type_data[i].name, true)->SetValue(value);
 
	}
 
}
 

	
 
static void AISaveConfig(IniFile *ini, const char *grpname)
 
{
 
	IniGroup *group = ini->GetGroup(grpname);
 

	
 
	if (group == NULL) return;
 
	group->Clear();
 

	
 
	for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
 
		AIConfig *config = AIConfig::GetConfig(c, AIConfig::SSS_FORCE_NEWGAME);
 
		const char *name;
 
		char value[1024];
 
		config->SettingsToString(value, lengthof(value));
 
@@ -1584,25 +1490,24 @@ static IniFile *IniLoadConfig()
 
 */
 
void LoadFromConfig(bool minimal)
 
{
 
	IniFile *ini = IniLoadConfig();
 
	if (!minimal) ResetCurrencies(false); // Initialize the array of curencies, without preserving the custom one
 

	
 
	/* Load basic settings only during bootstrap, load other settings not during bootstrap */
 
	HandleSettingDescs(ini, IniLoadSettings, IniLoadSettingList, minimal, !minimal);
 

	
 
	if (!minimal) {
 
		_grfconfig_newgame = GRFLoadConfig(ini, "newgrf", false);
 
		_grfconfig_static  = GRFLoadConfig(ini, "newgrf-static", true);
 
		NewsDisplayLoadConfig(ini, "news_display");
 
		AILoadConfig(ini, "ai_players");
 
		GameLoadConfig(ini, "game_scripts");
 

	
 
		PrepareOldDiffCustom();
 
		IniLoadSettings(ini, _gameopt_settings, "gameopt", &_settings_newgame);
 
		HandleOldDiffCustom(false);
 

	
 
		ValidateSettings();
 

	
 
		/* Display sheduled errors */
 
		extern void ScheduleErrorMessage(ErrorList &datas);
 
		ScheduleErrorMessage(_settings_error_list);
 
@@ -1616,25 +1521,24 @@ void LoadFromConfig(bool minimal)
 
void SaveToConfig()
 
{
 
	IniFile *ini = IniLoadConfig();
 

	
 
	/* Remove some obsolete groups. These have all been loaded into other groups. */
 
	ini->RemoveGroup("patches");
 
	ini->RemoveGroup("yapf");
 
	ini->RemoveGroup("gameopt");
 

	
 
	HandleSettingDescs(ini, IniSaveSettings, IniSaveSettingList);
 
	GRFSaveConfig(ini, "newgrf", _grfconfig_newgame);
 
	GRFSaveConfig(ini, "newgrf-static", _grfconfig_static);
 
	NewsDisplaySaveConfig(ini, "news_display");
 
	AISaveConfig(ini, "ai_players");
 
	GameSaveConfig(ini, "game_scripts");
 
	SaveVersionInConfig(ini);
 
	ini->SaveToDisk(_config_file);
 
	delete ini;
 
}
 

	
 
/**
 
 * Get the list of known NewGrf presets.
 
 * @param list[inout] Pointer to list for storing the preset names.
 
 */
 
void GetGRFPresetList(GRFPresetList *list)
src/settings_type.h
Show inline comments
 
@@ -173,24 +173,43 @@ struct MusicSettings {
 
	bool shuffle;      ///< Whether to shuffle the music
 
};
 

	
 
/** Settings related to currency/unit systems. */
 
struct LocaleSettings {
 
	byte   currency;                         ///< currency we currently use
 
	byte   units;                            ///< unit system we show everything
 
	char  *digit_group_separator;            ///< thousand separator for non-currencies
 
	char  *digit_group_separator_currency;   ///< thousand separator for currencies
 
	char  *digit_decimal_separator;          ///< decimal separator
 
};
 

	
 
/** Settings related to news */
 
struct NewsSettings {
 
	uint8 arrival_player;                                 ///< NewsDisplay of vehicles arriving at new stations of current player
 
	uint8 arrival_other;                                  ///< NewsDisplay of vehicles arriving at new stations of other players
 
	uint8 accident;                                       ///< NewsDisplay of accidents that occur
 
	uint8 company_info;                                   ///< NewsDisplay of general company information
 
	uint8 open;                                           ///< NewsDisplay on new industry constructions
 
	uint8 close;                                          ///< NewsDisplay about closing industries
 
	uint8 economy;                                        ///< NewsDisplay on economical changes
 
	uint8 production_player;                              ///< NewsDisplay of production changes of industries affecting current player
 
	uint8 production_other;                               ///< NewsDisplay of production changes of industries affecting competitors
 
	uint8 production_nobody;                              ///< NewsDisplay of production changes of industries affecting no one
 
	uint8 advice;                                         ///< NewsDisplay on advice affecting the player's vehicles
 
	uint8 new_vehicles;                                   ///< NewsDisplay of new vehicles becoming available
 
	uint8 acceptance;                                     ///< NewsDisplay on changes affecting the acceptance of cargo at stations
 
	uint8 subsidies;                                      ///< NewsDisplay of changes on subsidies
 
	uint8 general;                                        ///< NewsDisplay of other topics
 
};
 

	
 
/** All settings related to the network. */
 
struct NetworkSettings {
 
#ifdef ENABLE_NETWORK
 
	uint16 sync_freq;                                     ///< how often do we check whether we are still in-sync
 
	uint8  frame_freq;                                    ///< how often do we send commands to the clients
 
	uint16 commands_per_frame;                            ///< how many commands may be sent each frame_freq frames?
 
	uint16 max_commands_in_queue;                         ///< how many commands may there be in the incoming queue before dropping the connection?
 
	uint16 bytes_per_frame;                               ///< how many bytes may, over a long period, be received per frame?
 
	uint16 bytes_per_frame_burst;                         ///< how many bytes may, over a short period, be received?
 
	uint16 max_init_time;                                 ///< maximum amount of time, in game ticks, a client may take to initiate joining
 
	uint16 max_join_time;                                 ///< maximum amount of time, in game ticks, a client may take to sync up during joining
 
	uint16 max_download_time;                             ///< maximum amount of time, in game ticks, a client may take to download the map
 
@@ -487,24 +506,25 @@ struct GameSettings {
 
	VehicleSettings      vehicle;            ///< options for vehicles
 
	EconomySettings      economy;            ///< settings to change the economy
 
	StationSettings      station;            ///< settings related to station management
 
	LocaleSettings       locale;             ///< settings related to used currency/unit system in the current game
 
};
 

	
 
/** All settings that are only important for the local client. */
 
struct ClientSettings {
 
	GUISettings          gui;                ///< settings related to the GUI
 
	NetworkSettings      network;            ///< settings related to the network
 
	CompanySettings      company;            ///< default values for per-company settings
 
	MusicSettings        music;              ///< settings related to music/sound
 
	NewsSettings         news_display;       ///< news display settings.
 
};
 

	
 
/** The current settings for this game. */
 
extern ClientSettings _settings_client;
 

	
 
/** The current settings for this game. */
 
extern GameSettings _settings_game;
 

	
 
/** The settings values that are used for new games and/or modified in config file. */
 
extern GameSettings _settings_newgame;
 

	
 
/** Old vehicle settings, which were game settings before, and are company settings now. (Needed for savegame conversion) */
src/table/gameopt_settings.ini
Show inline comments
 
@@ -16,24 +16,25 @@ uint8 _old_diff_level;                  
 
static const char *_locale_currencies = "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|RON|RUR|SIT|SEK|YTL|SKK|BRL|EEK|custom";
 
static const char *_locale_units = "imperial|metric|si";
 
static const char *_town_names = "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovak|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan";
 
static const char *_climates = "temperate|arctic|tropic|toyland";
 
static const char *_autosave_interval = "off|monthly|quarterly|half year|yearly";
 
static const char *_roadsides = "left|right";
 
static const char *_savegame_date = "long|short|iso";
 
#ifdef ENABLE_NETWORK
 
static const char *_server_langs = "ANY|ENGLISH|GERMAN|FRENCH|BRAZILIAN|BULGARIAN|CHINESE|CZECH|DANISH|DUTCH|ESPERANTO|FINNISH|HUNGARIAN|ICELANDIC|ITALIAN|JAPANESE|KOREAN|LITHUANIAN|NORWEGIAN|POLISH|PORTUGUESE|ROMANIAN|RUSSIAN|SLOVAK|SLOVENIAN|SPANISH|SWEDISH|TURKISH|UKRAINIAN|AFRIKAANS|CROATIAN|CATALAN|ESTONIAN|GALICIAN|GREEK|LATVIAN";
 
#endif /* ENABLE_NETWORK */
 
static const char *_osk_activation = "disabled|double|single|immediately";
 
static const char *_settings_profiles = "easy|medium|hard";
 
static const char *_news_display = "off|summarized|full";
 

	
 
static const SettingDesc _gameopt_settings[] = {
 
	/* In version 4 a new difficulty setting has been added to the difficulty settings,
 
	 * town attitude towards demolishing. Needs special handling because some dimwit thought
 
	 * it funny to have the GameDifficulty struct be an array while it is a struct of
 
	 * same-sized members
 
	 * XXX - To save file-space and since values are never bigger than about 10? only
 
	 * save the first 16 bits in the savegame. Question is why the values are still int32
 
	 * and why not byte for example?
 
	 * 'SLE_FILE_I16 | SLE_VAR_U16' in "diff_custom" is needed to get around SlArray() hack
 
	 * for savegames version 0 - though it is an array, it has to go through the byteswap process */
 
[post-amble]
src/table/settings.ini
Show inline comments
 
@@ -2960,24 +2960,159 @@ cat      = SC_BASIC
 
[SDTC_BOOL]
 
var      = music.playing
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
def      = true
 
cat      = SC_BASIC
 

	
 
[SDTC_BOOL]
 
var      = music.shuffle
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
def      = false
 
cat      = SC_BASIC
 

	
 
[SDTC_OMANY]
 
var      = news_display.arrival_player
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 2
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.arrival_other
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 1
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.accident
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 2
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.company_info
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 2
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.open
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 1
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.close
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 1
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.economy
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 2
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.production_player
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 1
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.production_other
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 0
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.production_nobody
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 0
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.advice
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 2
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.new_vehicles
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 2
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.acceptance
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 2
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.subsidies
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 1
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_OMANY]
 
var      = news_display.general
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 2
 
max      = 2
 
full     = _news_display
 

	
 
[SDTC_VAR]
 
ifdef    = ENABLE_NETWORK
 
var      = gui.network_chat_box_width
 
type     = SLE_UINT16
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
def      = 620
 
min      = 200
 
max      = 65535
 
cat      = SC_EXPERT
 

	
 
[SDTC_VAR]
 
ifdef    = ENABLE_NETWORK
0 comments (0 inline, 0 general)