From c7012f5db30e75736f6727eba34d450c80e84adb Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Wed, 18 Jan 2023 21:44:50 -0500 Subject: [PATCH] Clean up update_explored - no need for so many variables --- src/game/boe.locutils.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/game/boe.locutils.cpp b/src/game/boe.locutils.cpp index 8d3eb79c..18df6680 100644 --- a/src/game/boe.locutils.cpp +++ b/src/game/boe.locutils.cpp @@ -239,25 +239,20 @@ bool is_container(location loc) { return false; } -void update_explored(location dest) { +void update_explored(const location dest) { if(cartoon_happening) return; - location shortdest,look; - - location look2; - - shortdest.x = (short) dest.x; - shortdest.y = (short) dest.y; + location look; which_party_sec.x = univ.party.outdoor_corner.x + univ.party.i_w_c.x; which_party_sec.y = univ.party.outdoor_corner.y + univ.party.i_w_c.y; if(is_out()) { univ.out.out_e[dest.x][dest.y] = 2; - for(look.x = shortdest.x - 4; look.x < shortdest.x + 5; look.x++) - for(look.y = shortdest.y - 4; look.y < shortdest.y + 5; look.y++) { + for(look.x = dest.x - 4; look.x < dest.x + 5; look.x++) + for(look.y = dest.y - 4; look.y < dest.y + 5; look.y++) { if((look.x == minmax(0,univ.out.max_dim-1,(int)look.x)) && (look.y == minmax(0,univ.out.max_dim-1,(int)look.y))) { if(univ.out.out_e[look.x][look.y] == 0) { - if(can_see_light(shortdest, look, sight_obscurity) < 5) { + if(can_see_light(dest, look, sight_obscurity) < 5) { univ.out.out_e[look.x][look.y] = 1; } } @@ -265,11 +260,11 @@ void update_explored(location dest) { } } else { make_explored(dest.x,dest.y); - for(look2.x = max(0,dest.x - 4); look2.x < min(univ.town->max_dim,dest.x + 5); look2.x++) - for(look2.y = max(0,dest.y - 4); look2.y < min(univ.town->max_dim,dest.y + 5); look2.y++) - if(!is_explored(look2.x,look2.y)) - if((can_see_light(dest, look2,sight_obscurity) < 5) && (pt_in_light(dest,look2))) - make_explored(look2.x,look2.y); + for(look.x = max(0,dest.x - 4); look.x < min(univ.town->max_dim,dest.x + 5); look.x++) + for(look.y = max(0,dest.y - 4); look.y < min(univ.town->max_dim,dest.y + 5); look.y++) + if(!is_explored(look.x,look.y)) + if((can_see_light(dest, look,sight_obscurity) < 5) && (pt_in_light(dest,look))) + make_explored(look.x,look.y); } }