diff options
-rw-r--r-- | src/gfxinit.cpp | 15 | ||||
-rw-r--r-- | src/lang/english.txt | 4 | ||||
-rw-r--r-- | src/newgrf_config.cpp | 14 | ||||
-rw-r--r-- | src/settings_gui.cpp | 1 | ||||
-rw-r--r-- | src/settings_type.h | 1 | ||||
-rw-r--r-- | src/table/settings.ini | 13 |
6 files changed, 33 insertions, 15 deletions
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index 4270a102e..404f0a94f 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -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> diff --git a/src/lang/english.txt b/src/lang/english.txt index 7ba24f302..444c73770 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -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 diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 990cdde75..1cde3ab24 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -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; } /** diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 1556e3bc4..9d0ce42b8 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -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"), diff --git a/src/settings_type.h b/src/settings_type.h index 3b8b3242c..5179c7da8 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -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 diff --git a/src/table/settings.ini b/src/table/settings.ini index b5ea7293b..c5fe20ee4 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -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); @@ -2396,6 +2397,18 @@ 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 flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC |