draw_terrain: protect also town's out of bounds...
This commit is contained in:
@@ -862,8 +862,12 @@ void draw_terrain(short mode) {
|
|||||||
if(is_town() || is_combat())
|
if(is_town() || is_combat())
|
||||||
draw_items(where_draw);
|
draw_items(where_draw);
|
||||||
// ASAN: where_draw.y can be equal to -1, ...
|
// ASAN: where_draw.y can be equal to -1, ...
|
||||||
if(is_out() && where_draw.x>=0 && where_draw.x<96 && where_draw.y>=0 && where_draw.y<96 &&
|
int max_dim = is_town() ? univ.town->max_dim : 96;
|
||||||
univ.out.out_e[where_draw.x][where_draw.y] && univ.out.is_road(where_draw.x,where_draw.y))
|
if (where_draw.x<0 || where_draw.x>=max_dim || where_draw.y<0 || where_draw.y>=max_dim) {
|
||||||
|
place_road(q,r,where_draw,false);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(is_out() && univ.out.out_e[where_draw.x][where_draw.y] && univ.out.is_road(where_draw.x,where_draw.y))
|
||||||
place_road(q,r,where_draw,true);
|
place_road(q,r,where_draw,true);
|
||||||
else if(is_town() && univ.town.is_explored(where_draw.x,where_draw.y) && univ.town.is_road(where_draw.x, where_draw.y))
|
else if(is_town() && univ.town.is_explored(where_draw.x,where_draw.y) && univ.town.is_road(where_draw.x, where_draw.y))
|
||||||
place_road(q,r,where_draw,true);
|
place_road(q,r,where_draw,true);
|
||||||
|
|||||||
Reference in New Issue
Block a user