From 547904ce9a4804a6ccdf7c0ccc7dedfaa60985c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Wed, 14 Jun 2023 20:14:13 -0300 Subject: [PATCH 32/51] Mark const methods as const in pseudo-generics --- src/common/scripting/core/types.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/common/scripting/core/types.cpp b/src/common/scripting/core/types.cpp index 838275dad..8a4c5bcab 100644 --- a/src/common/scripting/core/types.cpp +++ b/src/common/scripting/core/types.cpp @@ -2239,7 +2239,7 @@ enum OverrideFunctionArgType { OFN_ARG_KEY_VAL, }; -template +template void CreateOverrideFunction(MT *self, FName name) { auto Fn = Create(self->BackingType, name); @@ -2294,7 +2294,7 @@ void CreateOverrideFunction(MT *self, FName name) argnames.Push(NAME_Value); } - Fn->AddVariant(NewPrototype(ret, args), argflags, argnames, *NativeFn->VMPointer, VARF_Method | VARF_Native,SUF_ACTOR | SUF_OVERLAY | SUF_WEAPON | SUF_ITEM); + Fn->AddVariant(NewPrototype(ret, args), argflags, argnames, *NativeFn->VMPointer, VARF_Method | VARF_Native | ExtraFlags, SUF_ACTOR | SUF_OVERLAY | SUF_WEAPON | SUF_ITEM); self->FnOverrides.Insert(name, Fn); } @@ -2304,11 +2304,11 @@ PMap::PMap(PType *keytype, PType *valtype, PStruct *backing, int backing_class) mDescriptiveName.Format("Map<%s, %s>", keytype->DescriptiveName(), valtype->DescriptiveName()); Size = sizeof(ZSFMap); Align = alignof(ZSFMap); - CreateOverrideFunction(this, NAME_Get); - CreateOverrideFunction(this, NAME_CheckKey); - CreateOverrideFunction(this, NAME_Insert); - CreateOverrideFunction(this, NAME_InsertNew); - CreateOverrideFunction(this, NAME_Remove); + CreateOverrideFunction< OFN_RET_VAL , OFN_ARG_KEY > (this, NAME_Get); + CreateOverrideFunction< OFN_RET_BOOL , OFN_ARG_KEY , VARF_ReadOnly> (this, NAME_CheckKey); + CreateOverrideFunction< OFN_RET_VOID , OFN_ARG_KEY_VAL > (this, NAME_Insert); + CreateOverrideFunction< OFN_RET_VOID , OFN_ARG_KEY > (this, NAME_InsertNew); + CreateOverrideFunction< OFN_RET_VOID , OFN_ARG_KEY > (this, NAME_Remove); } //========================================================================== @@ -2770,9 +2770,9 @@ PMapIterator::PMapIterator(PType *keytype, PType *valtype, PStruct *backing, int mDescriptiveName.Format("MapIterator<%s, %s>", keytype->DescriptiveName(), valtype->DescriptiveName()); Size = sizeof(ZSFMap); Align = alignof(ZSFMap); - CreateOverrideFunction(this, NAME_GetKey); - CreateOverrideFunction(this, NAME_GetValue); - CreateOverrideFunction(this, NAME_SetValue); + CreateOverrideFunction(this, NAME_GetKey); + CreateOverrideFunction(this, NAME_GetValue); + CreateOverrideFunction(this, NAME_SetValue); } //========================================================================== -- 2.39.3