Raised This Month: $32 Target: $400
 8% 

Dynamic size enum structs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ultralaser1986
New Member
Join Date: Feb 2021
Old 02-22-2021 , 13:09   Dynamic size enum structs
Reply With Quote #1

Hello,

how would I create a dynamically sized enum struct array? Are they even possible or can I do something similar?

My Problem:

Spoiler


So instead I tried storing the struct inside an ArrayList. However all values set are lost inside it:

Spoiler


Does anyone know if I can do something like this?

EDIT:

My above example seems to work, however when there are more properties inside an enum struct it does not change:

Spoiler


EDIT 2:

Alright I figured out that I need to put a blocksize inside the ArrayList constructor.

Working Example:

Spoiler


Sorry for the troubles

Last edited by ultralaser1986; 02-22-2021 at 13:39.
ultralaser1986 is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 02-22-2021 , 15:35   Re: Dynamic size enum structs
Reply With Quote #2

PHP Code:

enum struct ZoneInfo 
{
    
float vecOrigin[3];
    
float vecMins[3];
    
float vecMaxs[3];
}

// arraylist
ArrayList g_List_SolidZones = new ArrayList(sizeof(ZoneInfo));

// normal list
ZoneInfo[] g_List_SolidZones = new ZoneInfo[32]; 
Also, you cannot create dynamic arrays globally.

PHP Code:
ZoneInfo[] g_List_SolidZones = new ZoneInfo[32]; 
This works only inside functions.
__________________

Last edited by Ilusion9; 02-22-2021 at 15:37.
Ilusion9 is offline
ultralaser1986
New Member
Join Date: Feb 2021
Old 02-22-2021 , 17:47   Re: Dynamic size enum structs
Reply With Quote #3

Quote:
Also, you cannot create dynamic arrays globally.
awww, well that's all I needed to know, thanks!

I ended up using the last example with ArrayList
ultralaser1986 is offline
Reply



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 20:49.


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