diff options
author | rubidium <rubidium@openttd.org> | 2008-09-03 07:51:07 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-09-03 07:51:07 +0000 |
commit | a4cd12274ca31df58c63b5532bbbb22e155b6a76 (patch) | |
tree | 182c569b77749f62a11b272d146ebd2639ad0c24 /src/newgrf_config.cpp | |
parent | c620d5e5f066e62cf23197d16e40a07c41e2d9f8 (diff) | |
download | openttd-a4cd12274ca31df58c63b5532bbbb22e155b6a76.tar.xz |
(svn r14233) -Feature/Fix [FS#2172]: save the palette of the loaded NewGRFs in the savegame, so joining with a server using Windows palette will make a client with the DOS palette do palette conversion and (thus) not cause a desync due to the different palettes disabling different NewGRFs.
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r-- | src/newgrf_config.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 98ba8d420..b1dd4f0a7 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -14,6 +14,7 @@ #include "string_func.h" #include "gamelog.h" #include "network/network_type.h" +#include "gfx_func.h" #include "fileio_func.h" #include "fios.h" @@ -72,6 +73,8 @@ bool FillGRFDetails(GRFConfig *config, bool is_static) if (HasBit(config->flags, GCF_UNSAFE)) return false; } + config->windows_paletted = (_use_palette == PAL_WINDOWS); + return CalcGRFMD5Sum(config); } @@ -481,11 +484,12 @@ bool GRFConfig::IsOpenTTDBaseGRF() const static const SaveLoad _grfconfig_desc[] = { - SLE_STR(GRFConfig, filename, SLE_STR, 0x40), - SLE_VAR(GRFConfig, grfid, SLE_UINT32), - SLE_ARR(GRFConfig, md5sum, SLE_UINT8, 16), - SLE_ARR(GRFConfig, param, SLE_UINT32, 0x80), - SLE_VAR(GRFConfig, num_params, SLE_UINT8), + SLE_STR(GRFConfig, filename, SLE_STR, 0x40), + SLE_VAR(GRFConfig, grfid, SLE_UINT32), + SLE_ARR(GRFConfig, md5sum, SLE_UINT8, 16), + SLE_ARR(GRFConfig, param, SLE_UINT32, 0x80), + SLE_VAR(GRFConfig, num_params, SLE_UINT8), + SLE_CONDVAR(GRFConfig, windows_paletted, SLE_BOOL, 101, SL_MAX_VERSION), SLE_END() }; @@ -508,6 +512,7 @@ static void Load_NGRF() while (SlIterateArray() != -1) { GRFConfig *c = CallocT<GRFConfig>(1); SlObject(c, _grfconfig_desc); + if (CheckSavegameVersion(101)) c->windows_paletted = (_use_palette == PAL_WINDOWS); AppendToGRFConfigList(&_grfconfig, c); } |