|
|
|
@ -341,7 +341,7 @@ void Crawler::UpdateEffects(float fElapsedTime){ |
|
|
|
|
Effect*e=(*it).get(); |
|
|
|
|
if(!e->Update(fElapsedTime)){ |
|
|
|
|
it=backgroundEffects.erase(it); |
|
|
|
|
if(it==backgroundEffects.end()){ |
|
|
|
|
if(it==backgroundEffects.end()){//In case we added effects to the vector and the vector has shifted in memory, we prematurely end.
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -350,11 +350,20 @@ void Crawler::UpdateEffects(float fElapsedTime){ |
|
|
|
|
Effect*e=(*it).get(); |
|
|
|
|
if(!e->Update(fElapsedTime)){ |
|
|
|
|
it=foregroundEffects.erase(it); |
|
|
|
|
if(it==foregroundEffects.end()){ |
|
|
|
|
if(it==foregroundEffects.end()){//In case we added effects to the vector and the vector has shifted in memory, we prematurely end.
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for(auto it=foregroundEffectsToBeInserted.begin();it!=foregroundEffectsToBeInserted.end();++it){ |
|
|
|
|
foregroundEffects.push_back(std::move(*it)); |
|
|
|
|
} |
|
|
|
|
for(auto it=backgroundEffectsToBeInserted.begin();it!=backgroundEffectsToBeInserted.end();++it){ |
|
|
|
|
backgroundEffects.push_back(std::move(*it)); |
|
|
|
|
} |
|
|
|
|
foregroundEffectsToBeInserted.clear(); |
|
|
|
|
backgroundEffectsToBeInserted.clear(); |
|
|
|
|
} |
|
|
|
|
void Crawler::UpdateBullets(float fElapsedTime){ |
|
|
|
|
for(auto it=BULLET_LIST.begin();it!=BULLET_LIST.end();++it){ |
|
|
|
@ -742,15 +751,15 @@ void Crawler::RenderHud(){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Crawler::AddEffect(std::unique_ptr<Effect>foreground,std::unique_ptr<Effect> background){ |
|
|
|
|
foregroundEffects.push_back(std::move(foreground)); |
|
|
|
|
backgroundEffects.push_back(std::move(background)); |
|
|
|
|
AddEffect(std::move(background),true); |
|
|
|
|
AddEffect(std::move(foreground)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Crawler::AddEffect(std::unique_ptr<Effect> foreground,bool back){ |
|
|
|
|
if(back){ |
|
|
|
|
backgroundEffects.push_back(std::move(foreground)); |
|
|
|
|
backgroundEffectsToBeInserted.push_back(std::move(foreground)); |
|
|
|
|
} else { |
|
|
|
|
foregroundEffects.push_back(std::move(foreground)); |
|
|
|
|
foregroundEffectsToBeInserted.push_back(std::move(foreground)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|