Fixed bug with bullet events deleting other unrelated bullets.

This commit is contained in:
2023-07-05 02:31:34 -05:00
parent 1ea4e6f9ca
commit 8c34640e52
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -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<Bullet*>((*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.x<view.GetWorldTL().x||b->pos.x>view.GetWorldBR().x||b->pos.y<view.GetWorldTL().y||b->pos.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;