Changeset - r17635:2e67e206a89e
[Not reviewed]
master
0 6 0
frosch - 13 years ago 2011-05-03 20:30:26
frosch@openttd.org
(svn r22417) -Add: an advanced setting to specify the default palette to use for NewGRFs without action 14 palette information; this makes the default choice independent from the used base graphics and '-i' option.
6 files changed with 33 insertions and 15 deletions:
0 comments (0 inline, 0 general)
src/gfxinit.cpp
Show inline comments
 
@@ -181,11 +181,14 @@ static void LoadSpriteTables()
 

	
 
	/* We know the palette of the base set, so if the base NewGRF is not
 
	 * setting one, use the palette of the base set and not the global
 
	 * one which might be the wrong palette for this base NewGRF. */
 
	PaletteType old_palette_type = _use_palette;
 
	_use_palette = used_set->palette;
 
	 * one which might be the wrong palette for this base NewGRF.
 
	 * The value set here might be overridden via action14 later. */
 
	switch (_use_palette) {
 
		case PAL_DOS:     master->palette |= GRFP_GRF_DOS;     break;
 
		case PAL_WINDOWS: master->palette |= GRFP_GRF_WINDOWS; break;
 
		default: break;
 
	}
 
	FillGRFDetails(master, false);
 
	_use_palette = old_palette_type;
 

	
 
	ClrBit(master->flags, GCF_INIT_ONLY);
 
	master->next = top;
 
@@ -263,8 +266,6 @@ static const char * const _graphics_file
 
template <class T, size_t Tnum_files, Subdirectory Tsubdir>
 
/* static */ const char * const *BaseSet<T, Tnum_files, Tsubdir>::file_names = _graphics_file_names;
 

	
 
extern void UpdateNewGRFConfigPalette();
 

	
 
/**
 
 * Determine the palette that has to be used.
 
 *  - forced palette via command line -> leave it that way
 
@@ -289,8 +290,6 @@ extern void UpdateNewGRFConfigPalette();
 
		default:
 
			NOT_REACHED();
 
	}
 

	
 
	UpdateNewGRFConfigPalette();
 
}
 

	
 
template <class Tbase_set>
src/lang/english.txt
Show inline comments
 
@@ -1223,6 +1223,10 @@ STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_N
 
STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_SHORT              :short (31-12-2008)
 
STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_ISO                :ISO (2008-12-31)
 

	
 
STR_CONFIG_SETTING_NEWGRF_DEFAULT_PALETTE                       :{LTBLUE}Default palette to assume for NewGRFs not specifying a palette: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_NEWGRF_DEFAULT_PALETTE_DOS                   :DOS palette
 
STR_CONFIG_SETTING_NEWGRF_DEFAULT_PALETTE_WIN                   :Windows palette
 

	
 
STR_CONFIG_SETTING_PAUSE_ON_NEW_GAME                            :{LTBLUE}Automatically pause when starting a new game: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL                          :{LTBLUE}When paused allow: {ORANGE}{STRING1}
 
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_NO_ACTIONS               :no actions
src/newgrf_config.cpp
Show inline comments
 
@@ -141,7 +141,7 @@ void GRFConfig::SetSuitablePalette()
 
	switch (this->palette & GRFP_GRF_MASK) {
 
		case GRFP_GRF_DOS:     pal = PAL_DOS;      break;
 
		case GRFP_GRF_WINDOWS: pal = PAL_WINDOWS;  break;
 
		default:               pal = _use_palette; break;
 
		default:               pal = _settings_client.gui.newgrf_default_palette == 1 ? PAL_WINDOWS : PAL_DOS; break;
 
	}
 
	SB(this->palette, GRFP_USE_BIT, 1, pal == PAL_WINDOWS ? GRFP_USE_WINDOWS : GRFP_USE_DOS);
 
}
 
@@ -265,16 +265,16 @@ void GRFParameterInfo::SetValue(struct G
 

	
 
/**
 
 * Update the palettes of the graphics from the config file.
 
 * This is needed because the config file gets read and parsed
 
 * before the palette is chosen (one can configure the base
 
 * graphics set governing the palette in the config after all).
 
 * As a result of this we update the settings from the config
 
 * once we have determined the palette.
 
 * Called when changing the default palette in advanced settings.
 
 * @param p1 Unused.
 
 * @return Always true.
 
 */
 
void UpdateNewGRFConfigPalette()
 
bool UpdateNewGRFConfigPalette(int32 p1)
 
{
 
	for (GRFConfig *c = _grfconfig_newgame; c != NULL; c = c->next) c->SetSuitablePalette();
 
	for (GRFConfig *c = _grfconfig_static;  c != NULL; c = c->next) c->SetSuitablePalette();
 
	for (GRFConfig *c = _all_grfs;          c != NULL; c = c->next) c->SetSuitablePalette();
 
	return true;
 
}
 

	
 
/**
src/settings_gui.cpp
Show inline comments
 
@@ -1383,6 +1383,7 @@ static SettingEntry _settings_ui[] = {
 
	SettingEntry("gui.hover_delay"),
 
	SettingEntry("gui.toolbar_pos"),
 
	SettingEntry("gui.statusbar_pos"),
 
	SettingEntry("gui.newgrf_default_palette"),
 
	SettingEntry("gui.pause_on_newgame"),
 
	SettingEntry("gui.advanced_vehicle_list"),
 
	SettingEntry("gui.timetable_in_ticks"),
src/settings_type.h
Show inline comments
 
@@ -125,6 +125,7 @@ struct GUISettings {
 
	bool   ai_developer_tools;               ///< activate AI developer tools
 
	bool   scenario_developer;               ///< activate scenario developer: allow modifying NewGRFs in an existing game
 
	bool   newgrf_show_old_versions;         ///< whether to show old versions in the NewGRF list
 
	uint8  newgrf_default_palette;           ///< default palette to use for NewGRFs without action 14 palette information
 

	
 
	/**
 
	 * Returns true when the user has sufficient privileges to edit newgrfs on a running game
src/table/settings.ini
Show inline comments
 
@@ -38,6 +38,7 @@ static bool InvalidateCompanyLiveryWindo
 
static bool InvalidateNewGRFChangeWindows(int32 p1);
 
static bool InvalidateIndustryViewWindow(int32 p1);
 
static bool RedrawTownAuthority(int32 p1);
 
extern bool UpdateNewGRFConfigPalette(int32 p1);
 

	
 
#ifdef ENABLE_NETWORK
 
static bool UpdateClientName(int32 p1);
 
@@ -2396,6 +2397,18 @@ flags    = SLF_NOT_IN_SAVE | SLF_NO_NETW
 
def      = false
 

	
 
[SDTC_VAR]
 
var      = gui.newgrf_default_palette
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
guiflags = SGF_MULTISTRING
 
def      = 1
 
min      = 0
 
max      = 1
 
str      = STR_CONFIG_SETTING_NEWGRF_DEFAULT_PALETTE
 
strval   = STR_CONFIG_SETTING_NEWGRF_DEFAULT_PALETTE_DOS
 
proc     = UpdateNewGRFConfigPalette
 

	
 
[SDTC_VAR]
 
var      = gui.console_backlog_timeout
 
type     = SLE_UINT16
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
0 comments (0 inline, 0 general)