mirror of https://github.com/OpenTTD/OpenTTD
(svn r15047) -Fix [NoAI]: AICONFIG_BOOLEAN (in AddSetting) doesn't require (or even allow) a min/max setting .. it is always 0/1 (Yexo)
parent
e06e372529
commit
c9d20bfd47
|
@ -206,6 +206,7 @@ SQInteger AIInfo::AddSetting(HSQUIRRELVM vm)
|
||||||
{
|
{
|
||||||
AIConfigItem config;
|
AIConfigItem config;
|
||||||
memset(&config, 0, sizeof(config));
|
memset(&config, 0, sizeof(config));
|
||||||
|
config.max_value = 1;
|
||||||
int items = 0;
|
int items = 0;
|
||||||
|
|
||||||
/* Read the table, and find all properties we care about */
|
/* Read the table, and find all properties we care about */
|
||||||
|
@ -277,9 +278,10 @@ SQInteger AIInfo::AddSetting(HSQUIRRELVM vm)
|
||||||
sq_pop(vm, 1);
|
sq_pop(vm, 1);
|
||||||
|
|
||||||
/* Make sure all properties are defined */
|
/* Make sure all properties are defined */
|
||||||
if (items != 0x1FF) {
|
uint mask = (config.flags & AICONFIG_BOOLEAN) ? 0x1F3 : 0x1FF;
|
||||||
|
if (items != mask) {
|
||||||
char error[1024];
|
char error[1024];
|
||||||
snprintf(error, sizeof(error), "please define all properties of a setting");
|
snprintf(error, sizeof(error), "please define all properties of a setting (min/max not allowed for booleans)");
|
||||||
this->engine->ThrowError(error);
|
this->engine->ThrowError(error);
|
||||||
return SQ_ERROR;
|
return SQ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue