Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,435 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Dynamic Array Size #422094
05/02/13 06:11
05/02/13 06:11
Joined: Jul 2008
Posts: 168
8
82RJZAE Offline OP
Member
82RJZAE  Offline OP
Member
8

Joined: Jul 2008
Posts: 168
Hi, I'm not sure if I'm approaching this from the wrong direction, but I have defined a dynamic array via:

ENTITY** spawn_places = sys_malloc(sizeof(ENTITY*)*size);
where size is an integer.

Is there any way for me to determine what size spawn_places is without storing integer size?

Re: Dynamic Array Size [Re: 82RJZAE] #422099
05/02/13 07:14
05/02/13 07:14
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
Yes:

int count = sizeof(spawn_places) / sizeof(ENTITY*);

EDIT: I was just corrected that this does not work, sorry for that! laugh

Last edited by PadMalcom; 05/02/13 07:59.
Re: Dynamic Array Size [Re: PadMalcom] #422137
05/02/13 22:38
05/02/13 22:38
Joined: Jul 2008
Posts: 168
8
82RJZAE Offline OP
Member
82RJZAE  Offline OP
Member
8

Joined: Jul 2008
Posts: 168
Does anyone know what will work?

Re: Dynamic Array Size [Re: 82RJZAE] #422138
05/02/13 22:43
05/02/13 22:43
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
JustSid gave me the following advices:

1. option: Create an own array / list structure and save your pointers in that list. There are some examples in this forum.

2. option: Save the size parameter somewhere! laugh

Re: Dynamic Array Size [Re: 82RJZAE] #422139
05/02/13 22:43
05/02/13 22:43
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Originally Posted By: 82RJZAE
Is there any way for me to determine what size spawn_places is without storing integer size?
No.


Always learn from history, to be sure you make the same mistakes again...

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1