From 237683e6cecd92eda448a6122e6bdcdb0340c17a Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Sun, 6 Aug 2023 21:32:04 +0300 Subject: [PATCH] Update sqratTypes.h --- module/Sqrat/sqratTypes.h | 66 +++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/module/Sqrat/sqratTypes.h b/module/Sqrat/sqratTypes.h index da1e7d43..2ec8c1b2 100644 --- a/module/Sqrat/sqratTypes.h +++ b/module/Sqrat/sqratTypes.h @@ -45,28 +45,28 @@ struct popAsInt T value; popAsInt(HSQUIRRELVM vm, SQInteger idx) { - SQObjectType value_type = sq_gettype(vm, idx); + const SQObjectType value_type = sq_gettype(vm, idx); switch(value_type) { - case OT_BOOL: - SQBool sqValueb; - sq_getbool(vm, idx, &sqValueb); - value = static_cast(sqValueb); + case OT_BOOL: + SQBool sqValueb; + sq_getbool(vm, idx, &sqValueb); + value = static_cast(sqValueb); break; - case OT_INTEGER: - SQInteger sqValue; - sq_getinteger(vm, idx, &sqValue); - value = static_cast(sqValue); + case OT_INTEGER: + SQInteger sqValue; + sq_getinteger(vm, idx, &sqValue); + value = static_cast(sqValue); break; - case OT_FLOAT: - SQFloat sqValuef; - sq_getfloat(vm, idx, &sqValuef); - value = static_cast(static_cast(sqValuef)); + case OT_FLOAT: + SQFloat sqValuef; + sq_getfloat(vm, idx, &sqValuef); + value = static_cast(static_cast(sqValuef)); break; - default: - SQTHROW(vm, FormatTypeError(vm, idx, _SC("integer"))); - value = static_cast(0); + default: + SQTHROW(vm, FormatTypeError(vm, idx, _SC("integer"))); + value = static_cast(0); break; - } + } } }; @@ -86,26 +86,26 @@ struct popAsFloat T value; popAsFloat(HSQUIRRELVM vm, SQInteger idx) { - SQObjectType value_type = sq_gettype(vm, idx); + const SQObjectType value_type = sq_gettype(vm, idx); switch(value_type) { - case OT_BOOL: - SQBool sqValueb; - sq_getbool(vm, idx, &sqValueb); - value = static_cast(sqValueb); + case OT_BOOL: + SQBool sqValueb; + sq_getbool(vm, idx, &sqValueb); + value = static_cast(sqValueb); break; - case OT_INTEGER: - SQInteger sqValue; \ - sq_getinteger(vm, idx, &sqValue); - value = static_cast(sqValue); + case OT_INTEGER: + SQInteger sqValue; \ + sq_getinteger(vm, idx, &sqValue); + value = static_cast(sqValue); break; - case OT_FLOAT: - SQFloat sqValuef; - sq_getfloat(vm, idx, &sqValuef); - value = static_cast(sqValuef); + case OT_FLOAT: + SQFloat sqValuef; + sq_getfloat(vm, idx, &sqValuef); + value = static_cast(sqValuef); break; - default: - SQTHROW(vm, FormatTypeError(vm, idx, _SC("float"))); - value = 0; + default: + SQTHROW(vm, FormatTypeError(vm, idx, _SC("float"))); + value = 0; break; } }