|
ENTITY* Array.. is that possible?
#333321
07/15/10 19:06
07/15/10 19:06
|
Joined: Apr 2009
Posts: 138 Germany
Toryno
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 138
Germany
|
Hi, I'm trying to use an array of entity pointer. this is the declaration of it: But this line makes a crash everytime:
while(next1[j].connected[i] != 0) { }
So my first question: Is it possible to use such an array? If yes, is there something special with such an array?
Thanks for reading, thinking, answering
|
|
|
Re: ENTITY* Array.. is that possible?
[Re: Toryno]
#333324
07/15/10 19:15
07/15/10 19:15
|
Joined: Sep 2009
Posts: 1,032 Budapest
Aku_Aku
Serious User
|
Serious User
Joined: Sep 2009
Posts: 1,032
Budapest
|
Of course that array should work. Perhaps your skill isn't defined well... Should post relevant parts of your code.
Last edited by Aku_Aku; 07/15/10 19:15.
|
|
|
Re: ENTITY* Array.. is that possible?
[Re: Lukas]
#333325
07/15/10 19:23
07/15/10 19:23
|
Joined: Apr 2009
Posts: 138 Germany
Toryno
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 138
Germany
|
Oh yes there is a define in the manual stands "skill70" can also be written so "skill[70]", so that won't be the problem. I use this in other functions too and they work fine. Could it be that the line at the end of this post is the problem? ent_tmp is a pointer to an entity, too. Is this a misstake?
Last edited by Toryno; 07/15/10 19:47.
Thanks for reading, thinking, answering
|
|
|
Re: ENTITY* Array.. is that possible?
[Re: Toryno]
#333329
07/15/10 19:30
07/15/10 19:30
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
Expert
|
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
look at your code!
#define connect skill
...
while(next1[j].connected[i] != 0) { }
it should be:
#define connect skill
...
while(next1[j].connect[i] != 0) { }
or
#define connected skill
...
while(next1[j].connected[i] != 0) { }
|
|
|
Re: ENTITY* Array.. is that possible?
[Re: MasterQ32]
#333332
07/15/10 19:43
07/15/10 19:43
|
Joined: Apr 2009
Posts: 138 Germany
Toryno
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 138
Germany
|
@Lukas: Now I make the whole array NULL and now it works. Know I will make it with EVERY variable, pointer, array or what ever. Thank you =D @Richi007: I just wrote "#define connected skill" in the editor, only a typing mistake while i posted this post. I will change it if someone read this post later 
Last edited by Toryno; 07/15/10 19:47.
Thanks for reading, thinking, answering
|
|
|
Re: ENTITY* Array.. is that possible?
[Re: Toryno]
#333367
07/15/10 22:21
07/15/10 22:21
|
Joined: Apr 2009
Posts: 138 Germany
Toryno
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 138
Germany
|
I have another mysterious crash. Directly after the declaration of the array the lines work fine but later, when the array has changed always, I want to clear it with this lines but it crashes.
ENTITY* next1[50];
for(i = 0; i < 49; i++) {
next1[i] = NULL; // no problem here
}
...
next1[0] = an_entity // example
...
for(i = 0; i < 49; i++) {
next1[i] = NULL; // here it crashes
}
Last edited by Toryno; 07/15/10 23:03.
Thanks for reading, thinking, answering
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|