Changeset - r19834:0a601872b900
[Not reviewed]
master
0 9 0
frosch - 11 years ago 2012-12-05 19:36:04
frosch@openttd.org
(svn r24789) -Add: Separate setting to control the default settings of newly added scripts and random AIs.
9 files changed with 33 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_config.cpp
Show inline comments
 
@@ -82,7 +82,7 @@ int AIConfig::GetSetting(const char *nam
 
		SettingValueList::const_iterator it = this->settings.find(name);
 
		if (it == this->settings.end()) {
 
			assert(strcmp("start_date", name) == 0);
 
			switch (GetGameSettings().difficulty.diff_level) {
 
			switch (GetGameSettings().script.settings_profile) {
 
				case SP_EASY:   return AI::START_NEXT_EASY;
 
				case SP_MEDIUM: return AI::START_NEXT_MEDIUM;
 
				case SP_HARD:   return AI::START_NEXT_HARD;
src/lang/english.txt
Show inline comments
 
@@ -1409,6 +1409,12 @@ STR_CONFIG_SETTING_AI_BUILDS_AIRCRAFT_HE
 
STR_CONFIG_SETTING_AI_BUILDS_SHIPS                              :Disable ships for computer: {STRING2}
 
STR_CONFIG_SETTING_AI_BUILDS_SHIPS_HELPTEXT                     :Enabling this setting makes building ships impossible for a computer player
 

	
 
STR_CONFIG_SETTING_AI_PROFILE                                   :Default settings profile: {STRING2}
 
STR_CONFIG_SETTING_AI_PROFILE_HELPTEXT                          :Choose which settings profile to use for random AIs or for initial values when adding a new AI or Game Script
 
STR_CONFIG_SETTING_AI_PROFILE_EASY                              :Easy
 
STR_CONFIG_SETTING_AI_PROFILE_MEDIUM                            :Medium
 
STR_CONFIG_SETTING_AI_PROFILE_HARD                              :Hard
 

	
 
STR_CONFIG_SETTING_AI_IN_MULTIPLAYER                            :Allow AIs in multiplayer: {STRING2}
 
STR_CONFIG_SETTING_AI_IN_MULTIPLAYER_HELPTEXT                   :Allow AI computer players to participate in multiplayer games
 
STR_CONFIG_SETTING_SCRIPT_MAX_OPCODES                           :#opcodes before scripts are suspended: {STRING2}
src/saveload/afterload.cpp
Show inline comments
 
@@ -2755,6 +2755,11 @@ bool AfterLoadGame()
 
		}
 
	}
 

	
 
	if (IsSavegameVersionBefore(178)) {
 
		/* Initialise script settings profile */
 
		_settings_game.script.settings_profile = IsInsideMM(_settings_game.difficulty.diff_level, SP_BEGIN, SP_END) ? _settings_game.difficulty.diff_level : (uint)SP_MEDIUM;
 
	}
 

	
 
	/* Road stops is 'only' updating some caches */
 
	AfterLoadRoadStops();
 
	AfterLoadLabelMaps();
src/saveload/saveload.cpp
Show inline comments
 
@@ -241,8 +241,9 @@
 
 *  175   24136
 
 *  176   24446
 
 *  177   24619
 
 *  178   TODO
 
 */
 
extern const uint16 SAVEGAME_VERSION = 177; ///< Current savegame version of OpenTTD.
 
extern const uint16 SAVEGAME_VERSION = 178; ///< Current savegame version of OpenTTD.
 

	
 
SavegameType _savegame_type; ///< type of savegame we are loading
 

	
src/script/script_info.cpp
Show inline comments
 
@@ -293,7 +293,7 @@ int ScriptInfo::GetSettingDefaultValue(c
 
	for (ScriptConfigItemList::const_iterator it = this->config_list.begin(); it != this->config_list.end(); it++) {
 
		if (strcmp((*it).name, name) != 0) continue;
 
		/* The default value depends on the difficulty level */
 
		switch (GetGameSettings().difficulty.diff_level) {
 
		switch (GetGameSettings().script.settings_profile) {
 
			case SP_EASY:   return (*it).easy_value;
 
			case SP_MEDIUM: return (*it).medium_value;
 
			case SP_HARD:   return (*it).hard_value;
src/settings_gui.cpp
Show inline comments
 
@@ -1845,6 +1845,7 @@ static SettingEntry _settings_economy[] 
 
static SettingsPage _settings_economy_page = {_settings_economy, lengthof(_settings_economy)};
 

	
 
static SettingEntry _settings_ai_npc[] = {
 
	SettingEntry("script.settings_profile"),
 
	SettingEntry("ai.ai_in_multiplayer"),
 
	SettingEntry("ai.ai_disable_veh_train"),
 
	SettingEntry("ai.ai_disable_veh_roadveh"),
src/settings_type.h
Show inline comments
 
@@ -288,6 +288,7 @@ struct AISettings {
 

	
 
/** Settings related to scripts. */
 
struct ScriptSettings {
 
	uint8  settings_profile;                 ///< difficulty profile to set initial settings of scripts, esp. random AIs
 
	uint32 script_max_opcode_till_suspend;   ///< max opcode calls till scripts will suspend
 
};
 

	
src/table/gameopt_settings.ini
Show inline comments
 
@@ -23,6 +23,7 @@ static const char *_savegame_date = "lon
 
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 SettingDesc _gameopt_settings[] = {
 
	/* In version 4 a new difficulty setting has been added to the difficulty settings,
src/table/settings.ini
Show inline comments
 
@@ -1298,6 +1298,21 @@ cat      = SC_EXPERT
 
length   = 1
 
to       = 106
 

	
 
[SDT_OMANY]
 
base     = GameSettings
 
var      = script.settings_profile
 
type     = SLE_UINT8
 
from     = 178
 
guiflags = SGF_MULTISTRING
 
def      = SP_EASY
 
min      = SP_EASY
 
max      = SP_HARD
 
full     = _settings_profiles
 
str      = STR_CONFIG_SETTING_AI_PROFILE
 
strhelp  = STR_CONFIG_SETTING_AI_PROFILE_HELPTEXT
 
strval   = STR_CONFIG_SETTING_AI_PROFILE_EASY
 
cat      = SC_BASIC
 

	
 
[SDT_BOOL]
 
base     = GameSettings
 
var      = ai.ai_in_multiplayer
0 comments (0 inline, 0 general)