diff --git a/src/network/protocols/lobby_protocol.cpp b/src/network/protocols/lobby_protocol.cpp index faffc6e06..d69e318e4 100644 --- a/src/network/protocols/lobby_protocol.cpp +++ b/src/network/protocols/lobby_protocol.cpp @@ -42,6 +42,8 @@ LobbyProtocol::LobbyProtocol(CallbackObject* callback_object) // ---------------------------------------------------------------------------- LobbyProtocol::~LobbyProtocol() { + if (RaceEventManager::getInstance()) + RaceEventManager::getInstance()->stop(); delete m_game_setup; } // ~LobbyProtocol diff --git a/src/network/race_event_manager.cpp b/src/network/race_event_manager.cpp index aa6ca24cd..395794d7a 100644 --- a/src/network/race_event_manager.cpp +++ b/src/network/race_event_manager.cpp @@ -49,19 +49,6 @@ void RaceEventManager::update(int ticks) } } // update -// ---------------------------------------------------------------------------- -void RaceEventManager::start(std::shared_ptr gep) -{ - m_game_events_protocol = gep; - m_running = true; -} // start - -// ---------------------------------------------------------------------------- -void RaceEventManager::stop() -{ - m_running = false; -} // stop - // ---------------------------------------------------------------------------- bool RaceEventManager::isRaceOver() { diff --git a/src/network/race_event_manager.hpp b/src/network/race_event_manager.hpp index 5f7e6da36..525ae9d05 100755 --- a/src/network/race_event_manager.hpp +++ b/src/network/race_event_manager.hpp @@ -48,17 +48,25 @@ private: virtual ~RaceEventManager(); public: + // ------------------------------------------------------------------------ void update(int ticks); - - void start(std::shared_ptr gep); - void stop(); - bool isRaceOver(); - - void collectedItem(Item *item, AbstractKart *kart); - void kartFinishedRace(AbstractKart *kart, float time); + // ------------------------------------------------------------------------ + void start(std::shared_ptr gep) + { + m_game_events_protocol = gep; + m_running = true; + } + // ------------------------------------------------------------------------ + void stop() { m_running = false; } // ------------------------------------------------------------------------ /** Returns if this instance is in running state or not. */ - bool isRunning() { return m_running; } + bool isRunning() { return m_running; } + // ------------------------------------------------------------------------ + bool isRaceOver(); + // ------------------------------------------------------------------------ + void collectedItem(Item *item, AbstractKart *kart); + // ------------------------------------------------------------------------ + void kartFinishedRace(AbstractKart *kart, float time); };