Codechange: replace ClampToI32/U16 with ClampTo<int32_t/uint16_t>

This commit is contained in:
Rubidium
2023-04-29 09:25:51 +02:00
committed by rubidium42
parent 969a3dc0f3
commit 19ec4e8beb
10 changed files with 67 additions and 98 deletions

View File

@@ -146,42 +146,42 @@ SQInteger ScriptInfo::AddSetting(HSQUIRRELVM vm)
} else if (strcmp(key, "min_value") == 0) {
SQInteger res;
if (SQ_FAILED(sq_getinteger(vm, -1, &res))) return SQ_ERROR;
config.min_value = ClampToI32(res);
config.min_value = ClampTo<int32_t>(res);
items |= 0x004;
} else if (strcmp(key, "max_value") == 0) {
SQInteger res;
if (SQ_FAILED(sq_getinteger(vm, -1, &res))) return SQ_ERROR;
config.max_value = ClampToI32(res);
config.max_value = ClampTo<int32_t>(res);
items |= 0x008;
} else if (strcmp(key, "easy_value") == 0) {
SQInteger res;
if (SQ_FAILED(sq_getinteger(vm, -1, &res))) return SQ_ERROR;
config.easy_value = ClampToI32(res);
config.easy_value = ClampTo<int32_t>(res);
items |= 0x010;
} else if (strcmp(key, "medium_value") == 0) {
SQInteger res;
if (SQ_FAILED(sq_getinteger(vm, -1, &res))) return SQ_ERROR;
config.medium_value = ClampToI32(res);
config.medium_value = ClampTo<int32_t>(res);
items |= 0x020;
} else if (strcmp(key, "hard_value") == 0) {
SQInteger res;
if (SQ_FAILED(sq_getinteger(vm, -1, &res))) return SQ_ERROR;
config.hard_value = ClampToI32(res);
config.hard_value = ClampTo<int32_t>(res);
items |= 0x040;
} else if (strcmp(key, "random_deviation") == 0) {
SQInteger res;
if (SQ_FAILED(sq_getinteger(vm, -1, &res))) return SQ_ERROR;
config.random_deviation = ClampToI32(abs(res));
config.random_deviation = ClampTo<int32_t>(abs(res));
items |= 0x200;
} else if (strcmp(key, "custom_value") == 0) {
SQInteger res;
if (SQ_FAILED(sq_getinteger(vm, -1, &res))) return SQ_ERROR;
config.custom_value = ClampToI32(res);
config.custom_value = ClampTo<int32_t>(res);
items |= 0x080;
} else if (strcmp(key, "step_size") == 0) {
SQInteger res;
if (SQ_FAILED(sq_getinteger(vm, -1, &res))) return SQ_ERROR;
config.step_size = ClampToI32(res);
config.step_size = ClampTo<int32_t>(res);
} else if (strcmp(key, "flags") == 0) {
SQInteger res;
if (SQ_FAILED(sq_getinteger(vm, -1, &res))) return SQ_ERROR;