This topic is now archived and is closed to further replies.

the origin

need landscape array

Recommended Posts

hi i need a landscapearray: an array world[100][100]=............. <- here i need a line of 10000 numbers, which are the y-level of 10000 points in my landscape (they should not be randomized) when i use this array i should be a landscape and not a field of "up and down" the typ does not matter (int, float) the array is used in this way (i show it at a smaler array)
 int world[5][3] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};

and the landscapepoints are made in this way:

 1  2  3  4  5  
 6  7  8  9  10
 11 12 13 14 15


Share this post

Link to post
Share on other sites
I doubt many people have an array filled with landscape heigh values sitting around, so why dont you load a file containing the heights. Loading from raw files is very easy.

void LoadRawFile(LPSTR strName, int nSize, BYTE *pHeightMap)
FILE *pFile = NULL;

// Open The File In Read / Binary Mode.

pFile = fopen( strName, "rb" );

if ( pFile == NULL )
MessageBox(NULL, "Can''t Find The Height Map!", "Error", MB_OK);
// only Reading In ''1'', size Is (Width * Height)

fread( pHeightMap, 1, nSize, pFile );

// everything read correctly?

int result = ferror( pFile );

// error received?

if (result)
MessageBox(NULL, "Failed To Get Data!", "Error", MB_OK);


You could load the data into the array. Alternatively you could write the height data out to a text file. (If you still want to read that data and copy it into an array ''visually'' within your compiler; but that''s seemingly pointless).

Share this post

Link to post
Share on other sites