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

This commit is contained in:
rubidium
2008-09-03 07:51:07 +00:00
parent c620d5e5f0
commit a4cd12274c
7 changed files with 39 additions and 18 deletions

View File

@@ -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);
}