(svn r11330) -Add: OTTD version checking for NewGRFs. This allows NewGRFs to do something different for different versions of OpenTTD, like disabling it for too low versions or loading different graphics.

This commit is contained in:
rubidium
2007-10-21 14:59:05 +00:00
parent 93303cffc4
commit f4775d06bb
6 changed files with 75 additions and 8 deletions

View File

@@ -3424,6 +3424,11 @@ static uint32 GetParamVal(byte param, uint32 *cond_val)
case 0x9E: // Miscellaneous GRF features
return _misc_grf_features;
case 0xA1: { // OpenTTD version
extern uint32 _openttd_newgrf_version;
return _openttd_newgrf_version;
}
default:
/* GRF Parameter */
if (param < 0x80) return _cur_grffile->param[param];
@@ -3790,7 +3795,8 @@ static void GRFLoadError(byte *buf, int len)
STR_NEWGRF_ERROR_UNSET_SWITCH,
STR_NEWGRF_ERROR_INVALID_PARAMETER,
STR_NEWGRF_ERROR_LOAD_BEFORE,
STR_NEWGRF_ERROR_LOAD_AFTER
STR_NEWGRF_ERROR_LOAD_AFTER,
STR_NEWGRF_ERROR_OTTD_VERSION_NUMBER,
};
static const StringID sevstr[] = {