Raised This Month: $ Target: $400

Passing dynamic array of enum structs to functions

Post New Thread Reply   
Thread Tools Display Modes
Author Message
Join Date: Aug 2020
Old 10-27-2023 , 05:28   Passing dynamic array of enum structs to functions
Reply With Quote #1

So to begin with, I got a simple structure to help simply my code a bit, where there's a function accepting a dynamic array of enum struct:
PHP Code:
enum struct SDKCallParamsWrapper {
SDKType type;
SDKPassMethod pass;
int decflags;
int encflags;

methodmap GameDataWrapper GameData {
Handle CreateSDKCallOrFail(
SDKCallType type,
SDKFuncConfSource src,
char[] name,
SDKCallParamsWrapper[] params = {},
int numParams 0,
bool hasReturnValue false,
SDKCallParamsWrapper ret = {}) {
        static const 
char k_sSDKFuncConfSource[SDKFuncConfSource][] = { "offset""signature""address" };
Handle result;
        if (!
SetFailState("Missing %s \"%s\""k_sSDKFuncConfSource[src], name);
        for (
int i 0numParams; ++i)
        if (
        if (!(
result EndPrepSDKCall()))
SetFailState("Failed to prep sdkcall \"%s\""name);

Should be clear that SDKCall setups are really static, so the following style is preferred in my opinion:
PHP Code:
"a function",
        { {
SDKType_CBasePlayerSDKPass_Pointer} },
However, it will end up a compile error: must be a constant expression; assumed zero, as well as a warning: tag mismatch (expected "SDKType", got "SDKPassMethod"), from the same line.

I tried to correct any error I could find but not really there seems to be, and things get weird when the following compiles:
PHP Code:
SDKCallParamsWrapper params[] = {
gd.CreateSDKCallOrFail(SDKCall_EntitySDKConf_Virtual"a function"paramssizeof(params)); 
Although it looks clean but still requires a unique variable name.

I'm assuming there're still some issues with SM enum struct, or anyone could tell if I just messed up?
Forgetest is offline

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -4. The time now is 07:01.

Powered by vBulletin®
Copyright ©2000 - 2023, vBulletin Solutions, Inc.
Theme made by Freecode