41 |
for (int counter = 0; counter < map_rows; counter++ ) { |
for (int counter = 0; counter < map_rows; counter++ ) { |
42 |
for (int counterB = 0; counterB < map_cols; counterB++ ) { |
for (int counterB = 0; counterB < map_cols; counterB++ ) { |
43 |
the_map[counterB][counter].obst = EMPTY; |
the_map[counterB][counter].obst = EMPTY; |
44 |
|
the_map[counterB][counter].occu = NULL; |
45 |
} |
} |
46 |
} |
} |
47 |
} |
} |
106 |
////////////////////////////////////////////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////////////////////////////////////////////// |
107 |
|
|
108 |
|
|
109 |
|
void Map::SetOccu(int x, int y, Pod& pod){ |
110 |
|
the_map[x][y].occu = &pod; |
111 |
|
} |
112 |
|
|
113 |
|
|
114 |
|
////////////////////////////////////////////////////////////////////////////////////////////////////////// |
115 |
|
|
116 |
|
|
117 |
|
void Map::UnsetOccu(int x, int y){ |
118 |
|
the_map[x][y].occu = NULL; |
119 |
|
} |
120 |
|
|
121 |
|
|
122 |
|
////////////////////////////////////////////////////////////////////////////////////////////////////////// |
123 |
|
|
124 |
|
|
125 |
|
Pod* Map::GetOccu(int x, int y){ |
126 |
|
return (the_map[x][y].occu); |
127 |
|
} |
128 |
|
|
129 |
|
|
130 |
|
////////////////////////////////////////////////////////////////////////////////////////////////////////// |
131 |
|
|
132 |
|
|
133 |
bool Map::IsValid (short int x, short int y) { |
bool Map::IsValid (short int x, short int y) { |
134 |
// Returns 1 if a valid map coord is passed, zero if not. |
// Returns 1 if a valid map coord is passed, zero if not. |
135 |
// x/y coords |
// x/y coords |
151 |
for (int counter = 0; counter < map_rows; counter++ ) { |
for (int counter = 0; counter < map_rows; counter++ ) { |
152 |
cout << '*'; |
cout << '*'; |
153 |
for (int counterB = 0; counterB < map_cols; counterB++ ) { |
for (int counterB = 0; counterB < map_cols; counterB++ ) { |
154 |
if ( the_map[counterB][counter].obst == 0 ) {cout << ' ';} |
if ( the_map[counterB][counter].occu != NULL ) {cout << '.';} |
155 |
|
else if ( the_map[counterB][counter].obst == 0 ) {cout << ' ';} |
156 |
else if ( the_map[counterB][counter].obst == 1 ) {cout << 'X';} |
else if ( the_map[counterB][counter].obst == 1 ) {cout << 'X';} |
157 |
else if ( the_map[counterB][counter].obst == 2 ) {cout << '~';} |
else if ( the_map[counterB][counter].obst == 2 ) {cout << '~';} |
158 |
else if ( the_map[counterB][counter].obst == 3 ) {cout << '+';} |
else if ( the_map[counterB][counter].obst == 3 ) {cout << '+';} |