Fix out-of-bounds issue when drawing boats and horses
(thanks to Ir the Great for spotting this issue)
This commit is contained in:
@@ -319,13 +319,11 @@ void draw_outd_boats(location center) {
|
||||
location where_draw;
|
||||
rectangle source_rect;
|
||||
sf::Texture& vehicle_gworld = *ResMgr::get<ImageRsrc>("vehicle");
|
||||
cVehicle& in_boat = univ.party.boats[univ.party.in_boat];
|
||||
cVehicle& in_horse = univ.party.horses[univ.party.in_horse];
|
||||
|
||||
for(auto& boat : univ.party.boats) {
|
||||
if(!boat.exists) continue;
|
||||
if(boat.which_town != 200) continue;
|
||||
if(boat == in_boat) continue;
|
||||
if(univ.party.in_boat >= 0 && univ.party.boats[univ.party.in_boat] == boat) continue;
|
||||
location loc = local_to_global(boat.loc);
|
||||
if(point_onscreen(center, loc) && can_see_light(center, loc, sight_obscurity) < 5) {
|
||||
where_draw.x = loc.x - center.x + 4;
|
||||
@@ -336,7 +334,7 @@ void draw_outd_boats(location center) {
|
||||
for(auto& horse : univ.party.horses) {
|
||||
if(!horse.exists) continue;
|
||||
if(horse.which_town != 200) continue;
|
||||
if(horse == in_horse) continue;
|
||||
if(univ.party.in_horse >= 0 && univ.party.horses[univ.party.in_horse] == horse) continue;
|
||||
location loc = local_to_global(horse.loc);
|
||||
if(point_onscreen(center, loc) && can_see_light(center, loc, sight_obscurity) < 5) {
|
||||
where_draw.x = loc.x - center.x + 4;
|
||||
@@ -350,13 +348,11 @@ void draw_town_boat(location center) {
|
||||
location where_draw;
|
||||
rectangle source_rect;
|
||||
sf::Texture& vehicle_gworld = *ResMgr::get<ImageRsrc>("vehicle");
|
||||
cVehicle& in_boat = univ.party.boats[univ.party.in_boat];
|
||||
cVehicle& in_horse = univ.party.horses[univ.party.in_horse];
|
||||
|
||||
for(auto& boat : univ.party.boats) {
|
||||
if(!boat.exists) continue;
|
||||
if(boat.which_town != univ.party.town_num) continue;
|
||||
if(boat == in_boat) continue;
|
||||
if(univ.party.in_boat >= 0 && univ.party.boats[univ.party.in_boat] == boat) continue;
|
||||
if(point_onscreen(center, boat.loc) && can_see_light(center, boat.loc, sight_obscurity) < 5 && pt_in_light(center, boat.loc)) {
|
||||
where_draw.x = boat.loc.x - center.x + 4;
|
||||
where_draw.y = boat.loc.y - center.y + 4;
|
||||
@@ -366,7 +362,7 @@ void draw_town_boat(location center) {
|
||||
for(auto& horse : univ.party.horses) {
|
||||
if(!horse.exists) continue;
|
||||
if(horse.which_town != univ.party.town_num) continue;
|
||||
if(horse == in_horse) continue;
|
||||
if(univ.party.in_horse >= 0 && univ.party.horses[univ.party.in_horse] == horse) continue;
|
||||
if(point_onscreen(center, horse.loc) && can_see_light(center, horse.loc, sight_obscurity) < 5 && pt_in_light(center, horse.loc)) {
|
||||
where_draw.x = horse.loc.x - center.x + 4;
|
||||
where_draw.y = horse.loc.y - center.y + 4;
|
||||
|
Reference in New Issue
Block a user