Skip to content

Commit

Permalink
Pause / Start LevelTime objects
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Jul 31, 2023
1 parent 5354653 commit b49b856
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/supertux/game_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,24 @@ GameSession::start_sequence(Player* caller, Sequence seq, const SequenceData* da
lt->stop();
}
}
void
GameSession::set_target_timer_paused(bool paused)
{
m_pause_target_timer = paused;

for (const auto& obj : m_currentsector->get_objects())
{
auto lt = dynamic_cast<LevelTime*>(obj.get());
if (lt) {
if(paused) {
lt->stop();
}
else {
lt->start();
}
}
}
}

/* (Status): */
void
Expand Down
2 changes: 1 addition & 1 deletion src/supertux/game_session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class GameSession final : public Screen,
Level& get_current_level() const { return *m_level; }

void start_sequence(Player* caller, Sequence seq, const SequenceData* data = nullptr);
void set_target_timer_paused(bool paused) { m_pause_target_timer = paused; }
void set_target_timer_paused(bool paused);

/**
* returns the "working directory" usually this is the directory where the
Expand Down

0 comments on commit b49b856

Please sign in to comment.