118 |
|
|
119 |
|
|
120 |
// SET FUNCTIONS |
// SET FUNCTIONS |
121 |
void Map::SetObst(short int x, short int y, obstacle type) { the_map[x][y].obst = type; } |
void Map::SetObst(short int x, short int y, obstacle type) { |
122 |
|
if ( IsValid(x,y) == 0 ) { return; } |
123 |
|
the_map[x][y].obst = type; |
124 |
|
} |
125 |
|
|
126 |
bool Map::SetOccu(int x, int y, Pod& pod){ |
bool Map::SetOccu(int x, int y, Pod& pod){ |
127 |
|
if ( IsValid(x,y) == 0 ) { return 1; } |
128 |
if (the_map[x][y].occu != NULL) {return 1;} |
if (the_map[x][y].occu != NULL) {return 1;} |
129 |
else { |
else { |
130 |
the_map[x][y].occu = &pod; |
the_map[x][y].occu = &pod; |
132 |
} |
} |
133 |
} |
} |
134 |
|
|
135 |
void Map::UnsetOccu(int x, int y){ the_map[x][y].occu = NULL; } |
void Map::UnsetOccu(int x, int y){ |
136 |
|
if ( IsValid(x,y) == 0 ) { return; } |
137 |
|
the_map[x][y].occu = NULL; |
138 |
|
} |
139 |
|
|
140 |
|
|
141 |
|
|
148 |
|
|
149 |
|
|
150 |
void Map::TrampleRoad(int x, int y, int a) { // a=1 if not defined |
void Map::TrampleRoad(int x, int y, int a) { // a=1 if not defined |
151 |
|
if ( IsValid(x,y) == 0 ) { return; } |
152 |
the_map[x][y].road_q -= a; |
the_map[x][y].road_q -= a; |
153 |
if (the_map[x][y].road_q < 0) { the_map[x][y].road_q = 0;} |
if (the_map[x][y].road_q < 0) { the_map[x][y].road_q = 0;} |
154 |
} |
} |
155 |
|
|
156 |
|
|
157 |
void Map::DegradeRoad(int x, int y, int a) { |
void Map::DegradeRoad(int x, int y, int a) { |
158 |
|
if ( IsValid(x,y) == 0 ) { return; } |
159 |
the_map[x][y].road_q += a; |
the_map[x][y].road_q += a; |
160 |
if (the_map[x][y].road_q > 9) { the_map[x][y].road_q = 9;} |
if (the_map[x][y].road_q > 9) { the_map[x][y].road_q = 9;} |
161 |
} |
} |