convert char array to int array

My entire program can be found here:
https://sites.google.com/site/temprpgquestion/go-here-for-the-program

i have the maps for my rpg game made as a 2d char array. the character is @ sign T is tree W is water 'space' (probably will change to '-' or '~') is grass or just plane empty what ever. stuff like that.

so what i am going for is keep the game to be mostly played in the console window but i want to add a secondary window that uses tiles instead so the player can actually see the map as more then just characters in the console. I know exactly how to do this except only in allegro5 with integers instead of characters.

so what i would like to do is assign a integer to the character and then a tile to the integer. Any way of doing this?

@ = 0 = player, # = 1 = Wall, ~ = 2 = grass, W = 3 = water, T = 4 = tree
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

Char Map[5][5] = 

{
"#####",
"#@~~#",
"#~T~#",
"#~~W#",
"#####"
}

//Map = TileMap;

int TileMap[5][5] = 

{
{1, 1, 1, 1, 1},
{1, 0, 2, 2, 1},
{1, 2, 4, 2, 1},
{1, 2, 2, 4, 1},
{1, 1, 1, 1, 1}
}

//then draw the map based on something like this
Last edited on
Topic archived. No new replies allowed.