Mail Archives: djgpp/1998/07/16/12:26:17
Hi Joel,
16.07.98, you wrote:
> I've declared my map array like this:
> int map[MAP_HEIGHT][MAP_WIDTH];
> And I'm trying to write to it like this:
> map =
> {
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,
[skipped]
> 1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,
> 1,1
> };
> But DJGPP gives me this:
> tile.cpp: In method `void Tile_Map::Initialize()':
> tile.cpp:14: parse error before `]'
> What am I doing wrong?
Brief: You're declared two dimensional array but tried to initialize
it with one dimensional data.
Solution:
map = { {1,1,1,1,1,....,1,1}, /* First Line */
{1,1,1,1,1,....,1,1}, /* Second Line */
....
{1,1,1,1,1,....,1,1} /* Last Line */
};
Regards,
Alexander Bokovoy, <bokovoy AT bspu DOT unibel DOT by>
--=== The Soft Age coming soon ===--
- Raw text -