|
@@ -3635,29 +3635,25 @@ bool GetGlobalVariable(byte param, uint3
|
|
|
return true;
|
|
|
|
|
|
case 0x0B: { // TTDPatch version
|
|
|
uint major = 2;
|
|
|
uint minor = 6;
|
|
|
uint revision = 1; // special case: 2.0.1 is 2.0.10
|
|
|
uint build = 1382;
|
|
|
*value = (major << 24) | (minor << 20) | (revision << 16) | build;
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
case 0x0D: // TTD Version, 00=DOS, 01=Windows
|
|
|
if (_palette_remap_grf[_file_index]) {
|
|
|
*value = !_use_palette;
|
|
|
} else {
|
|
|
*value = _use_palette;
|
|
|
}
|
|
|
*value = _cur_grfconfig->windows_paletted;
|
|
|
return true;
|
|
|
|
|
|
case 0x0E: // Y-offset for train sprites
|
|
|
*value = _traininfo_vehicle_pitch;
|
|
|
return true;
|
|
|
|
|
|
case 0x0F: // Rail track type cost factors
|
|
|
*value = 0;
|
|
|
SB(*value, 0, 8, GetRailTypeInfo(RAILTYPE_RAIL)->cost_multiplier); // normal rail
|
|
|
if (_settings_game.vehicle.disable_elrails) {
|
|
|
/* skip elrail multiplier - disabled */
|
|
|
SB(*value, 8, 8, GetRailTypeInfo(RAILTYPE_MONO)->cost_multiplier); // monorail
|
|
@@ -4091,25 +4087,25 @@ static void GRFInfo(byte *buf, size_t le
|
|
|
|
|
|
if (!check_length(len, 8, "GRFInfo")) return;
|
|
|
buf++;
|
|
|
uint8 version = grf_load_byte(&buf);
|
|
|
uint32 grfid = grf_load_dword(&buf);
|
|
|
const char *name = grf_load_string(&buf, len - 6);
|
|
|
|
|
|
_cur_grffile->grfid = grfid;
|
|
|
_cur_grffile->grf_version = version;
|
|
|
_cur_grfconfig->status = _cur_stage < GLS_RESERVE ? GCS_INITIALISED : GCS_ACTIVATED;
|
|
|
|
|
|
/* Do swap the GRFID for displaying purposes since people expect that */
|
|
|
DEBUG(grf, 1, "GRFInfo: Loaded GRFv%d set %08lX - %s", version, BSWAP32(grfid), name);
|
|
|
DEBUG(grf, 1, "GRFInfo: Loaded GRFv%d set %08lX - %s (palette: %s)", version, BSWAP32(grfid), name, _cur_grfconfig->windows_paletted ? "Windows" : "DOS");
|
|
|
}
|
|
|
|
|
|
/* Action 0x0A */
|
|
|
static void SpriteReplace(byte *buf, size_t len)
|
|
|
{
|
|
|
/* <0A> <num-sets> <set1> [<set2> ...]
|
|
|
* <set>: <num-sprites> <first-sprite>
|
|
|
*
|
|
|
* B num-sets How many sets of sprites to replace.
|
|
|
* Each set:
|
|
|
* B num-sprites How many sprites are in this set
|
|
|
* W first-sprite First sprite number to replace */
|
|
@@ -5885,24 +5881,25 @@ void LoadNewGRFFile(GRFConfig *config, u
|
|
|
|
|
|
if (file_index > LAST_GRF_SLOT) {
|
|
|
DEBUG(grf, 0, "'%s' is not loaded as the maximum number of GRFs has been reached", filename);
|
|
|
config->status = GCS_DISABLED;
|
|
|
config->error = CallocT<GRFError>(1);
|
|
|
config->error->severity = STR_NEWGRF_ERROR_MSG_FATAL;
|
|
|
config->error->message = STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
FioOpenFile(file_index, filename);
|
|
|
_file_index = file_index; // XXX
|
|
|
_palette_remap_grf[_file_index] = (config->windows_paletted != (_use_palette == PAL_WINDOWS));
|
|
|
|
|
|
_cur_grfconfig = config;
|
|
|
|
|
|
DEBUG(grf, 2, "LoadNewGRFFile: Reading NewGRF-file '%s'", filename);
|
|
|
|
|
|
/* Skip the first sprite; we don't care about how many sprites this
|
|
|
* does contain; newest TTDPatches and George's longvehicles don't
|
|
|
* neither, apparently. */
|
|
|
if (FioReadWord() == 4 && FioReadByte() == 0xFF) {
|
|
|
FioReadDword();
|
|
|
} else {
|
|
|
DEBUG(grf, 7, "LoadNewGRFFile: Custom .grf has invalid format");
|