Large array?

Hello, Im having a little issue with my 'roguelike' im working on, basicly I have this:

1
2
3
4
5
6
7
8
9
10
11
12
int MapArray[123][123] = {ETC}

void DrawMap( void )
{
	for ( int y = 0; y < MAP_HEIGHT; y++)
	{
		console.SetPosition( 0, y );

		for( int x =0; x < MAP_WIDTH; x++)
		{
			switch(MapArray[y][x])
			{


And i want to do something like this:

1
2
3
4
5
6
7
8
9
10
11
12
Map=MapArray;

void DrawMap( void )
{
	for ( int y = 0; y < MAP_HEIGHT; y++)
	{
		console.SetPosition( 0, y );

		for( int x =0; x < MAP_WIDTH; x++)
		{
			switch(Map[y][x])
			{


I have try'd many things, even that ^, But i cant work my head around it, any help will be appreciated
Thanks

-RetrO
Last edited on
You want a map class? That's how it should be done, but what is your problem?
My problem is as show above, switching maps, for instance, instead of having to do this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
If(Map==1)
{
void DrawMap( void )
{
	for ( int y = 0; y < MAP_HEIGHT; y++)
	{
		console.SetPosition( 0, y );

		for( int x =0; x < MAP_WIDTH; x++)
		{
			switch(MapArrayA[y][x])
			{
if(Map==2)
{
etc

I want to be able to do this
1
2
3
4
5
6
7
8
9
10
void DrawMap( void )
{
	for ( int y = 0; y < MAP_HEIGHT; y++)
	{
		console.SetPosition( 0, y );

		for( int x =0; x < MAP_WIDTH; x++)
		{
			switch(Map[y][x])
			{


And to change the map all i'd need to do is change the 'Map' for instance
int Map=MapArrayA;
But that does not work, see my problem? Sorry im fairly new to this...

-RetrO
Yeah, I see. You really should make a map class to make things easier.
But even when using raw arrays, you can pass in the map array you want to draw as a parameter:

1
2
3
void DrawMap(int Map[][123])
{
  //rest as usual 
Haha ok, im new and that confused me :P

-RetrO
Topic archived. No new replies allowed.