Page 1 of 1

Global AI API question

Posted: 21 Jul 2005, 21:47
by munch
OK, so looking at the Global AI API, there are quite a few methods for getting various maps like height map, LOS map etc. and they return like a char* or a float* or something like that, instead of char ** or float **.

What I want to know is, how is the data arranged? Is it really a 1D array, or is it actaully a 2D array written down as a 1D array. Or am I missing something? (probably)

Can someone please explain how to use the return values from these functions? Example code would be good. I'm looking for something like this:

Code: Select all

unsigned char ** metalMap =  (unsigned char **)  GetMetalMap()
Which is my best guess, but probably wrong.

Ta.

Munch

Posted: 21 Jul 2005, 21:52
by AF
yuk, Fear the 4 functions of map do I above all globalAI callback functions. Napalm said something about just using it as an array...

Posted: 22 Jul 2005, 00:31
by SJ
//the following functions are used to get information about the map
//dont modify or delete any of the pointers returned
//the maps are stored from top left and each data position is 8*8 in size
//to get info about a position x,y look at location
//(int(y/8))*GetMapWidth()+(int(x/8))
//some of the maps are stored in a lower resolution than this though

right from the .h file

Posted: 22 Jul 2005, 00:43
by [K.B.] Napalm Cobra
y/ 8) ?

Posted: 22 Jul 2005, 02:11
by FLOZi
(int ( y / 8 ) )

Posted: 22 Jul 2005, 21:11
by munch
SJ wrote://the following functions are used to get information about the map
//dont modify or delete any of the pointers returned
//the maps are stored from top left and each data position is 8*8 in size
//to get info about a position x,y look at location
//(int(y/8))*GetMapWidth()+(int(x/8))
//some of the maps are stored in a lower resolution than this though

right from the .h file
LOL thanks SJ. I hate it when I bother writing decent comments and folk don't read 'em... and here I am guilty of just that. Apologies, and thanks for leaving good comments!

Cheers

Munch