From 8c34640e528aac348fe6ae7dd43cdaa264e244df Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Wed, 5 Jul 2023 02:31:34 -0500 Subject: [PATCH] Fixed bug with bullet events deleting other unrelated bullets. --- Crawler/Crawler.cpp | 10 +++++++++- Crawler/Version.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index a240152a..3f037e3e 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -596,7 +596,7 @@ void Crawler::UpdateEffects(float fElapsedTime){ } void Crawler::UpdateBullets(float fElapsedTime){ for(auto it=BULLET_LIST.begin();it!=BULLET_LIST.end();++it){ - Bullet*b=dynamic_cast((*it).get()); + Bullet*b=(*it).get(); b->Update(fElapsedTime); b->pos+=b->vel*fElapsedTime; if(geom2d::overlaps(geom2d::circle(player.GetPos(),12*player.GetSizeMult()/2),geom2d::circle(b->pos,b->radius))){ @@ -605,6 +605,7 @@ void Crawler::UpdateBullets(float fElapsedTime){ if(it==BULLET_LIST.end()){ break; } + continue; } } if(b->pos.xpos.x>view.GetWorldBR().x||b->pos.ypos.y>view.GetWorldBR().y){ @@ -612,6 +613,7 @@ void Crawler::UpdateBullets(float fElapsedTime){ if(it==BULLET_LIST.end()){ break; } + continue; } b->lifetime-=fElapsedTime; if(b->lifetime<=0){ @@ -619,6 +621,7 @@ void Crawler::UpdateBullets(float fElapsedTime){ if(it==BULLET_LIST.end()){ break; } + continue; } b->animation.UpdateState(b->internal_animState,fElapsedTime); } @@ -634,6 +637,7 @@ void Crawler::UpdateBullets(float fElapsedTime){ if(it==PLAYER_BULLET_LIST.end()){ goto outsidePlayerBulletLoop; } + goto continuePlayerBulletLoop; } b->hitList[&m]=true; } @@ -644,6 +648,7 @@ void Crawler::UpdateBullets(float fElapsedTime){ if(it==PLAYER_BULLET_LIST.end()){ break; } + continue; } b->lifetime-=fElapsedTime; if(b->lifetime<=0){ @@ -651,8 +656,11 @@ void Crawler::UpdateBullets(float fElapsedTime){ if(it==PLAYER_BULLET_LIST.end()){ break; } + continue; } b->animation.UpdateState(b->internal_animState,fElapsedTime); + continuePlayerBulletLoop: + continue; } outsidePlayerBulletLoop: int a; diff --git a/Crawler/Version.h b/Crawler/Version.h index b9f28ce3..9953e422 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 370 +#define VERSION_BUILD 373 #define stringify(a) stringify_(a) #define stringify_(a) #a