Skip to content

Commit

Permalink
Fixed so the queued balls disappear according to the amount of lives …
Browse files Browse the repository at this point in the history
…left

Signed-off-by: Erik Andersson <erik.rothoff@gmail.com>
  • Loading branch information
erkie committed Feb 8, 2010
1 parent 4cf0637 commit 2d21a88
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
17 changes: 10 additions & 7 deletions arrow.cpp
Expand Up @@ -34,15 +34,11 @@ Arrow::Arrow(Game *game): Sprite(game)
// Queue balls
// Create one more than specified, for the current ball
for ( int i = 0; i <= ARROW_QUEUE_SIZE; i++ )
{
Ball *ball = Ball::create(_game);
_queue.push_back(ball);
}
_queue.push_back(Ball::create(_game));

setCurrent();
}


Arrow::~Arrow()
{
SDL_FreeSurface(_origin);
Expand All @@ -53,12 +49,19 @@ void Arrow::tick()
{
if ( _game->isPaused() )
return;

int i = 0;
for ( ball_queue::iterator iter = _queue.begin(); iter != _queue.end(); iter++, i++ )
{
if ( i >= _game->lives() )
(*iter)->visible(false);
else
(*iter)->visible(true);
}
}

void Arrow::draw()
{
//if ( ! dirty() )
// return;
if ( _game->isPaused() )
return;

Expand Down
2 changes: 2 additions & 0 deletions arrow.h
Expand Up @@ -50,6 +50,8 @@ class Arrow: public Sprite
void setCurrent();
void release();

Ball* createBall();

bool isReady() const { return _is_ready; };
void setReady(bool ready) { _is_ready = ready; };
};
Expand Down
1 change: 0 additions & 1 deletion grid.cpp
Expand Up @@ -214,7 +214,6 @@ void Grid::handleDanglies()
}
else
delete result;

}

for ( island_list::iterator iter = islands.begin(); iter != islands.end(); iter++ )
Expand Down
2 changes: 1 addition & 1 deletion scorescrollnode.cpp
Expand Up @@ -136,7 +136,7 @@ void ScoreScrollNode::renderText()
iter = _scores.begin() + start_score;
to = _scores.begin() + end_score;

for (; iter != to; iter++ )
for (; iter != to; iter++)
{
SDL_Surface **surfaces = (*iter);

Expand Down

0 comments on commit 2d21a88

Please sign in to comment.