(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.

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
frosch 13 years ago
parent dbfd156eb6
commit bfd09004fe

@ -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_names[] = { "base", "logos", "arctic",
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>

@ -1223,6 +1223,10 @@ STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_LONG :long (31st Dec
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

@ -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 GRFConfig *config, uint32 value)
/**
* 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;
}
/**

@ -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"),

@ -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

@ -38,6 +38,7 @@ static bool InvalidateCompanyLiveryWindow(int32 p1);
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);
@ -2395,6 +2396,18 @@ var = gui.newgrf_show_old_versions
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
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

Loading…
Cancel
Save