From bd41a64b84d8b49c6827f443397964bbcc5fab79 Mon Sep 17 00:00:00 2001 From: Cameron Reikes Date: Tue, 3 Jan 2023 21:22:46 -0800 Subject: [PATCH] Delete dangerous items only in safe suns --- gamestate.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/gamestate.c b/gamestate.c index 350e462..a253654 100644 --- a/gamestate.c +++ b/gamestate.c @@ -2897,16 +2897,18 @@ void process(struct GameState *gs, double dt) cpVect pos_rel_sun = (cpvsub(entity_pos(e), (entity_pos(i.sun)))); cpFloat sqdist = cpvlengthsq(pos_rel_sun); - bool is_entity_dangerous = false; - is_entity_dangerous |= e->is_missile; - if (e->is_box) + if(i.sun->sun_is_safe) { - is_entity_dangerous |= e->box_type == BoxExplosive; - } - if (is_entity_dangerous && sqdist < sun_dist_no_gravity(i.sun) * sun_dist_no_gravity(i.sun)) - { - e->flag_for_destruction = true; - break; + bool is_entity_dangerous = false; + is_entity_dangerous |= e->is_missile; + if (e->is_box) + { + is_entity_dangerous |= e->box_type == BoxExplosive; + } + if (is_entity_dangerous && sqdist < sun_dist_no_gravity(i.sun) * sun_dist_no_gravity(i.sun)) + { + e->flag_for_destruction = true; + } } if (!e->is_grid) // grids aren't damaged (this edge case sucks!)