Commit pa que Mon arregle el codi mentre em dutxe
This commit is contained in:
@@ -18,7 +18,7 @@ Explosions::~Explosions()
|
||||
// Actualiza la lógica de la clase
|
||||
void Explosions::update()
|
||||
{
|
||||
for (auto explosion : explosions)
|
||||
for (auto &explosion : explosions)
|
||||
{
|
||||
explosion->update();
|
||||
}
|
||||
@@ -30,18 +30,18 @@ void Explosions::update()
|
||||
// Dibuja el objeto en pantalla
|
||||
void Explosions::render()
|
||||
{
|
||||
for (auto explosion : explosions)
|
||||
for (auto &explosion : explosions)
|
||||
{
|
||||
explosion->render();
|
||||
}
|
||||
}
|
||||
|
||||
// Añade texturas al objeto
|
||||
void Explosions::addTexture(int size, Texture *texture, std::vector<std::string> *animation)
|
||||
void Explosions::addTexture(int size, std::shared_ptr<Texture> texture, std::vector<std::string> *animation)
|
||||
{
|
||||
explosion_texture_t temp;
|
||||
temp.size = size;
|
||||
temp.texture = texture;
|
||||
temp.texture = texture.get();
|
||||
temp.animation = animation;
|
||||
textures.push_back(temp);
|
||||
}
|
||||
@@ -50,9 +50,9 @@ void Explosions::addTexture(int size, Texture *texture, std::vector<std::string>
|
||||
void Explosions::add(int x, int y, int size)
|
||||
{
|
||||
const int index = getIndexBySize(size);
|
||||
AnimatedSprite *sprite = new AnimatedSprite(textures[index].texture, "", textures[index].animation);
|
||||
auto sprite = std::make_unique<AnimatedSprite>(textures[index].texture, "", textures[index].animation);
|
||||
sprite->setPos(x, y);
|
||||
explosions.push_back(sprite);
|
||||
explosions.push_back(std::move(sprite));
|
||||
}
|
||||
|
||||
// Vacia el vector de elementos finalizados
|
||||
@@ -64,7 +64,6 @@ void Explosions::freeExplosions()
|
||||
{
|
||||
if (explosions[i]->animationIsCompleted())
|
||||
{
|
||||
delete explosions[i];
|
||||
explosions.erase(explosions.begin() + i);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user