1
0
Fork 0

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

release/1.2
frosch 2011-05-03 20:30:26 +00:00
parent dbfd156eb6
commit bfd09004fe
6 changed files with 33 additions and 15 deletions

View File

@ -181,11 +181,14 @@ static void LoadSpriteTables()
/* We know the palette of the base set, so if the base NewGRF is not /* 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 * setting one, use the palette of the base set and not the global
* one which might be the wrong palette for this base NewGRF. */ * one which might be the wrong palette for this base NewGRF.
PaletteType old_palette_type = _use_palette; * The value set here might be overridden via action14 later. */
_use_palette = used_set->palette; 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); FillGRFDetails(master, false);
_use_palette = old_palette_type;
ClrBit(master->flags, GCF_INIT_ONLY); ClrBit(master->flags, GCF_INIT_ONLY);
master->next = top; 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> template <class T, size_t Tnum_files, Subdirectory Tsubdir>
/* static */ const char * const *BaseSet<T, Tnum_files, Tsubdir>::file_names = _graphics_file_names; /* 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. * Determine the palette that has to be used.
* - forced palette via command line -> leave it that way * - forced palette via command line -> leave it that way
@ -289,8 +290,6 @@ extern void UpdateNewGRFConfigPalette();
default: default:
NOT_REACHED(); NOT_REACHED();
} }
UpdateNewGRFConfigPalette();
} }
template <class Tbase_set> template <class Tbase_set>

View File

@ -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_SHORT :short (31-12-2008)
STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_ISO :ISO (2008-12-31) 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_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 :{LTBLUE}When paused allow: {ORANGE}{STRING1}
STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_NO_ACTIONS :no actions STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_NO_ACTIONS :no actions

View File

@ -141,7 +141,7 @@ void GRFConfig::SetSuitablePalette()
switch (this->palette & GRFP_GRF_MASK) { switch (this->palette & GRFP_GRF_MASK) {
case GRFP_GRF_DOS: pal = PAL_DOS; break; case GRFP_GRF_DOS: pal = PAL_DOS; break;
case GRFP_GRF_WINDOWS: pal = PAL_WINDOWS; 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); 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. * Update the palettes of the graphics from the config file.
* This is needed because the config file gets read and parsed * Called when changing the default palette in advanced settings.
* before the palette is chosen (one can configure the base * @param p1 Unused.
* graphics set governing the palette in the config after all). * @return Always true.
* As a result of this we update the settings from the config
* once we have determined the palette.
*/ */
void UpdateNewGRFConfigPalette() bool UpdateNewGRFConfigPalette(int32 p1)
{ {
for (GRFConfig *c = _grfconfig_newgame; c != NULL; c = c->next) c->SetSuitablePalette(); 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 = _grfconfig_static; c != NULL; c = c->next) c->SetSuitablePalette();
for (GRFConfig *c = _all_grfs; c != NULL; c = c->next) c->SetSuitablePalette();
return true;
} }
/** /**

View File

@ -1383,6 +1383,7 @@ static SettingEntry _settings_ui[] = {
SettingEntry("gui.hover_delay"), SettingEntry("gui.hover_delay"),
SettingEntry("gui.toolbar_pos"), SettingEntry("gui.toolbar_pos"),
SettingEntry("gui.statusbar_pos"), SettingEntry("gui.statusbar_pos"),
SettingEntry("gui.newgrf_default_palette"),
SettingEntry("gui.pause_on_newgame"), SettingEntry("gui.pause_on_newgame"),
SettingEntry("gui.advanced_vehicle_list"), SettingEntry("gui.advanced_vehicle_list"),
SettingEntry("gui.timetable_in_ticks"), SettingEntry("gui.timetable_in_ticks"),

View File

@ -125,6 +125,7 @@ struct GUISettings {
bool ai_developer_tools; ///< activate AI developer tools bool ai_developer_tools; ///< activate AI developer tools
bool scenario_developer; ///< activate scenario developer: allow modifying NewGRFs in an existing game 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 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 * Returns true when the user has sufficient privileges to edit newgrfs on a running game

View File

@ -38,6 +38,7 @@ static bool InvalidateCompanyLiveryWindow(int32 p1);
static bool InvalidateNewGRFChangeWindows(int32 p1); static bool InvalidateNewGRFChangeWindows(int32 p1);
static bool InvalidateIndustryViewWindow(int32 p1); static bool InvalidateIndustryViewWindow(int32 p1);
static bool RedrawTownAuthority(int32 p1); static bool RedrawTownAuthority(int32 p1);
extern bool UpdateNewGRFConfigPalette(int32 p1);
#ifdef ENABLE_NETWORK #ifdef ENABLE_NETWORK
static bool UpdateClientName(int32 p1); static bool UpdateClientName(int32 p1);
@ -2395,6 +2396,18 @@ var = gui.newgrf_show_old_versions
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
def = false 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] [SDTC_VAR]
var = gui.console_backlog_timeout var = gui.console_backlog_timeout
type = SLE_UINT16 type = SLE_UINT16