Changeset - r14320:c817132688c6
[Not reviewed]
master
0 3 0
rubidium - 15 years ago 2010-01-21 23:19:50
rubidium@openttd.org
(svn r18883) -Codechange: warn in the difficulty and AI configuration window when setting the number of AIs to non-zero when you don't have AIs
3 files changed with 13 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -1044,48 +1044,49 @@ STR_DISASTER_NORMAL                     
 

	
 
STR_SUBSIDY_X1_5                                                :x1.5
 
STR_SUBSIDY_X2                                                  :x2
 
STR_SUBSIDY_X3                                                  :x3
 
STR_SUBSIDY_X4                                                  :x4
 

	
 
STR_TERRAIN_TYPE_VERY_FLAT                                      :Very Flat
 
STR_TERRAIN_TYPE_FLAT                                           :Flat
 
STR_TERRAIN_TYPE_HILLY                                          :Hilly
 
STR_TERRAIN_TYPE_MOUNTAINOUS                                    :Mountainous
 

	
 
STR_ECONOMY_STEADY                                              :Steady
 
STR_ECONOMY_FLUCTUATING                                         :Fluctuating
 

	
 
STR_REVERSE_AT_END_OF_LINE_AND_AT_STATIONS                      :At end of line, and at stations
 
STR_REVERSE_AT_END_OF_LINE_ONLY                                 :At end of line only
 

	
 
STR_DISASTERS_OFF                                               :Off
 
STR_DISASTERS_ON                                                :On
 

	
 
STR_CITY_APPROVAL_PERMISSIVE                                    :Permissive
 
STR_CITY_APPROVAL_TOLERANT                                      :Tolerant
 
STR_CITY_APPROVAL_HOSTILE                                       :Hostile
 

	
 
STR_WARNING_NO_SUITABLE_AI                                      :{WHITE}No suitable AIs available...{}You can download several AIs via the 'Online Content' system
 
STR_WARNING_DIFFICULTY_TO_CUSTOM                                :{WHITE}This action changed the difficulty level to custom
 

	
 
# Advanced settings window
 
STR_CONFIG_SETTING_CAPTION                                      :{WHITE}Advanced Settings
 

	
 
STR_CONFIG_SETTING_OFF                                          :Off
 
STR_CONFIG_SETTING_ON                                           :On
 
STR_CONFIG_SETTING_DISABLED                                     :disabled
 
STR_CONFIG_SETTING_VEHICLESPEED                                 :{LTBLUE}Show vehicle speed in status bar: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_BUILDONSLOPES                                :{LTBLUE}Allow building on slopes and coasts: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_AUTOSLOPE                                    :{LTBLUE}Allow terraforming under buildings, tracks, etc. (autoslope): {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_CATCHMENT                                    :{LTBLUE}Allow more realistically sized catchment areas: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_EXTRADYNAMITE                                :{LTBLUE}Allow removal of more town-owned roads, bridges, etc: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_MAMMOTHTRAINS                                :{LTBLUE}Enable building very long trains: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL                     :{LTBLUE}Train acceleration model: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL_ORIGINAL            :Original
 
STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL_REALISTIC           :Realistic
 
STR_CONFIG_SETTING_TRAIN_SLOPE_STEEPNESS                        :{LTBLUE}Slope steepness for trains {ORANGE}{STRING1}%
 
STR_CONFIG_SETTING_FORBID_90_DEG                                :{LTBLUE}Forbid trains and ships to make 90 deg turns: {ORANGE}{STRING1} {LTBLUE} (not with OPF)
 
STR_CONFIG_SETTING_JOINSTATIONS                                 :{LTBLUE}Join train stations built next to each other: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS                        :{LTBLUE}Allow to join stations not directly adjacent: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_IMPROVEDLOAD                                 :{LTBLUE}Use improved loading algorithm: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_GRADUAL_LOADING                              :{LTBLUE}Load vehicles gradually: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_INFLATION                                    :{LTBLUE}Inflation: {ORANGE}{STRING1}
src/settings.cpp
Show inline comments
 
@@ -37,48 +37,49 @@
 
#include "news_func.h"
 
#include "window_func.h"
 
#include "strings_func.h"
 
#include "vehicle_func.h"
 
#include "sound_func.h"
 
#include "company_func.h"
 
#include "rev.h"
 
#ifdef WITH_FREETYPE
 
#include "fontcache.h"
 
#endif
 
#include "textbuf_gui.h"
 
#include "rail_gui.h"
 
#include "elrail_func.h"
 
#include "gui.h"
 
#include "town.h"
 
#include "video/video_driver.hpp"
 
#include "sound/sound_driver.hpp"
 
#include "music/music_driver.hpp"
 
#include "blitter/factory.hpp"
 
#include "base_media_base.h"
 
#include "gamelog.h"
 
#include "settings_func.h"
 
#include "ini_type.h"
 
#include "ai/ai_config.hpp"
 
#include "ai/ai.hpp"
 
#include "newgrf.h"
 
#include "ship.h"
 
#include "company_base.h"
 
#include "engine_base.h"
 

	
 
#include "void_map.h"
 
#include "station_base.h"
 

	
 
#include "table/strings.h"
 
#include "table/settings.h"
 

	
 
ClientSettings _settings_client;
 
GameSettings _settings_game;
 
GameSettings _settings_newgame;
 
VehicleDefaultSettings _old_vds; ///< Used for loading default vehicles settings from old savegames
 

	
 
typedef void SettingDescProc(IniFile *ini, const SettingDesc *desc, const char *grpname, void *object);
 
typedef void SettingDescProcList(IniFile *ini, const char *grpname, StringList *list);
 

	
 
static bool IsSignedVarMemType(VarType vt);
 

	
 
/**
 
 * Groups in openttd.cfg that are actually lists.
 
 */
 
@@ -830,48 +831,53 @@ static void CheckDifficultyLevels()
 
{
 
	if (_settings_newgame.difficulty.diff_level != 3) {
 
		SetDifficultyLevel(_settings_newgame.difficulty.diff_level, &_settings_newgame.difficulty);
 
	}
 
}
 

	
 
static bool DifficultyReset(int32 level)
 
{
 
	SetDifficultyLevel(level, (_game_mode == GM_MENU) ? &_settings_newgame.difficulty : &_settings_game.difficulty);
 
	return true;
 
}
 

	
 
static bool DifficultyChange(int32)
 
{
 
	if (_game_mode == GM_MENU) {
 
		if (_settings_newgame.difficulty.diff_level != 3) {
 
			ShowErrorMessage(STR_WARNING_DIFFICULTY_TO_CUSTOM, INVALID_STRING_ID, 0, 0);
 
			_settings_newgame.difficulty.diff_level = 3;
 
		}
 
		SetWindowClassesDirty(WC_SELECT_GAME);
 
	} else {
 
		_settings_game.difficulty.diff_level = 3;
 
	}
 

	
 
	if (((_game_mode == GM_MENU) ? _settings_newgame.difficulty : _settings_game.difficulty).max_no_competitors != 0 &&
 
			AI::GetInfoList()->size() == 0 && (!_networking || _network_server)) {
 
		ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, 0, 0, true);
 
	}
 

	
 
	/* If we are a network-client, update the difficult setting (if it is open).
 
	 * Use this instead of just dirtying the window because we need to load in
 
	 * the new difficulty settings */
 
	if (_networking && FindWindowById(WC_GAME_OPTIONS, 0) != NULL) {
 
		ShowGameDifficulty();
 
	}
 

	
 
	return true;
 
}
 

	
 
static bool DifficultyNoiseChange(int32 i)
 
{
 
	if (_game_mode == GM_NORMAL) {
 
		UpdateAirportsNoise();
 
		if (_settings_game.economy.station_noise_level) {
 
			InvalidateWindowClassesData(WC_TOWN_VIEW, 0);
 
		}
 
	}
 

	
 
	return DifficultyChange(i);
 
}
 

	
 
/**
 
 * Check whether the road side may be changed.
src/settings_gui.cpp
Show inline comments
 
@@ -10,48 +10,49 @@
 
/** @file settings_gui.cpp GUI for settings. */
 

	
 
#include "stdafx.h"
 
#include "currency.h"
 
#include "gui.h"
 
#include "textbuf_gui.h"
 
#include "command_func.h"
 
#include "screenshot.h"
 
#include "network/network.h"
 
#include "town.h"
 
#include "settings_internal.h"
 
#include "newgrf_townname.h"
 
#include "strings_func.h"
 
#include "window_func.h"
 
#include "string_func.h"
 
#include "widgets/dropdown_type.h"
 
#include "widgets/dropdown_func.h"
 
#include "openttd.h"
 
#include "highscore.h"
 
#include "base_media_base.h"
 
#include "company_base.h"
 
#include "company_func.h"
 
#include "viewport_func.h"
 
#include "core/geometry_func.hpp"
 
#include "ai/ai.hpp"
 
#include <map>
 

	
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
static const StringID _units_dropdown[] = {
 
	STR_GAME_OPTIONS_MEASURING_UNITS_IMPERIAL,
 
	STR_GAME_OPTIONS_MEASURING_UNITS_METRIC,
 
	STR_GAME_OPTIONS_MEASURING_UNITS_SI,
 
	INVALID_STRING_ID
 
};
 

	
 
static const StringID _driveside_dropdown[] = {
 
	STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT,
 
	STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_RIGHT,
 
	INVALID_STRING_ID
 
};
 

	
 
static const StringID _autosave_dropdown[] = {
 
	STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_OFF,
 
	STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_1_MONTH,
 
	STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_3_MONTHS,
 
	STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_6_MONTHS,
 
	STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_12_MONTHS,
 
@@ -632,48 +633,53 @@ public:
 

	
 
			/* Don't allow clients to make any changes */
 
			if (_networking && !_network_server) return;
 

	
 
			uint i;
 
			const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i) + (widget / 3);
 
			const SettingDescBase *sdb = &sd->desc;
 

	
 
			int32 val = (int32)ReadValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv);
 
			if (widget % 3 == 1) {
 
				/* Increase button clicked */
 
				val = min(val + sdb->interval, (int32)sdb->max);
 
			} else {
 
				/* Decrease button clicked */
 
				val -= sdb->interval;
 
				val = max(val, sdb->min);
 
			}
 

	
 
			/* save value in temporary variable */
 
			WriteValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv, val);
 
			this->RaiseWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level);
 
			SetDifficultyLevel(3, &this->opt_mod_temp.difficulty); // set difficulty level to custom
 
			this->LowerWidget(GDW_LVL_CUSTOM);
 
			this->InvalidateData();
 

	
 
			if (widget / 3 == 0 && this->opt_mod_temp.difficulty.max_no_competitors != 0 &&
 
					AI::GetInfoList()->size() == 0) {
 
				ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, 0, 0, true);
 
			}
 
			return;
 
		}
 

	
 
		switch (widget) {
 
			case GDW_LVL_EASY:
 
			case GDW_LVL_MEDIUM:
 
			case GDW_LVL_HARD:
 
			case GDW_LVL_CUSTOM:
 
				/* temporarily change difficulty level */
 
				this->RaiseWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level);
 
				SetDifficultyLevel(widget - GDW_LVL_EASY, &this->opt_mod_temp.difficulty);
 
				this->LowerWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level);
 
				this->InvalidateData();
 
				break;
 

	
 
			case GDW_HIGHSCORE: // Highscore Table
 
				ShowHighscoreTable(this->opt_mod_temp.difficulty.diff_level, -1);
 
				break;
 

	
 
			case GDW_ACCEPT: { // Save button - save changes
 
				GameSettings *opt_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game;
 

	
 
				uint i;
 
				GetSettingFromName("difficulty.diff_level", &i);
0 comments (0 inline, 0 general)