3 registered members (TipmyPip, AndrewAMD, dBc),
18,430
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Arrays, pointers, vectors, oh my!
[Re: Tai]
#304965
01/12/10 09:10
01/12/10 09:10
|
Joined: Feb 2009
Posts: 84 Deutschland/Niedersachsen
GorNaKosh
Junior Member
|
Junior Member
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
|
I think you want to store the vector over a longer time. For this you have to allocate some memory to hold the values:
VECTOR* crowd_pos[100];
void main() {
//initialize the vector
crowd_pos[0] = malloc(sizeof(VECTOR));
//now the struct is ready to use
vec_set(crowd_pos[0], vector(1,2,3));
}
For saving vectors temporary (manipulation in one function or passing them to another function etc) you can use this:
VECTOR* crowd_pos[100];
void main() {
//assign a temporary vector
crowd_pos[0] = vector(1,2,3);
//...
}
from the manual: The vector pointers have a limited lifetime because there are only 64 different vectors available for this function, that are used cyclic.So use this only for passing temporary vectors to functions, but not for permanent vector pointers.
|
|
|
Entire Thread
|
Arrays, pointers, vectors, oh my!
|
Tai
|
01/12/10 03:59
|
Re: Arrays, pointers, vectors, oh my!
|
GorNaKosh
|
01/12/10 09:10
|
Re: Arrays, pointers, vectors, oh my!
|
Spirit
|
01/12/10 09:23
|
Re: Arrays, pointers, vectors, oh my!
|
Tai
|
01/12/10 17:08
|
Re: Arrays, pointers, vectors, oh my!
|
Tobias
|
01/12/10 17:17
|
Re: Arrays, pointers, vectors, oh my!
|
Tai
|
01/12/10 23:54
|
Re: Arrays, pointers, vectors, oh my!
|
Nidhogg
|
01/13/10 06:43
|
Re: Arrays, pointers, vectors, oh my!
|
Tai
|
01/13/10 16:28
|
Re: Arrays, pointers, vectors, oh my!
|
Widi
|
01/13/10 16:36
|
Re: Arrays, pointers, vectors, oh my!
|
Tai
|
01/13/10 16:44
|
Re: Arrays, pointers, vectors, oh my!
|
Quad
|
01/13/10 16:47
|
Re: Arrays, pointers, vectors, oh my!
|
Tai
|
01/13/10 16:54
|
Re: Arrays, pointers, vectors, oh my!
|
Tobias
|
01/13/10 17:42
|
Re: Arrays, pointers, vectors, oh my!
|
Widi
|
01/14/10 10:20
|
Re: Arrays, pointers, vectors, oh my!
|
JibbSmart
|
01/14/10 12:09
|
|
|