<commit_before>#include "objectives_system.h"
#include "game_over_window.h"
#include "window_manager_interface.h"

void ObjectivesSystem::handleEvent (const Event* event)
{
    switch (event->getType()) {
        case EVENT_REMOVE_ENTITY: {
            const RemoveEntityEvent* l_event = dynamic_cast<const RemoveEntityEvent*> (event);
            if (l_event->entity == getEngine()->getEntities()->getPlayer()) {

                GameOverWindow* l_win = new GameOverWindow();
                l_win->initialise(getEngine());
                getEngine()->getWindows()->pushWindow (l_win);
            }
            break;
        }
        case EVENT_CHANGE_LEVEL: {
            const ChangeLevelEvent* l_event = dynamic_cast<const ChangeLevelEvent*> (event);
            unsigned int level = l_event->level;

            if (level > m_engine->getMap()->getMapDepth()) {
                GameOverWindow* l_win = new GameOverWindow();
                l_win->initialise (m_engine, m_engine);
                m_engine->getWindows()->pushWindow (l_win);
            }
            break;
        }
        default: break;
    }
}<commit_msg>Added Troll to objectives, player can now win again<commit_after>#include "objectives_system.h"
#include "game_over_window.h"
#include "window_manager_interface.h"
#include "description_component.h"

void ObjectivesSystem::handleEvent (const Event* event)
{
    switch (event->getType()) {
        case EVENT_REMOVE_ENTITY: {
            const RemoveEntityEvent* l_event = dynamic_cast<const RemoveEntityEvent*> (event);
            if (l_event->entity == getEngine()->getEntities()->getPlayer()) {

                GameOverWindow* l_win = new GameOverWindow();
                l_win->initialise(getEngine());
                getEngine()->getWindows()->pushWindow (l_win);
                return;
            }
            DescriptionComponent* l_desc = getEngine()->getComponents()->get<DescriptionComponent>(l_event->entity);
            if (l_desc) std::cout << "Name of killed entity: " << l_desc->title << std::endl;
            if (l_desc && l_desc->title == "Troll") {
                GameOverWindow* l_win = new GameOverWindow();
                l_win->initialise(getEngine(),(void*)(1));
                getEngine()->getWindows()->pushWindow (l_win);
                return;
            }
            break;
        }
        default: break;
    }
}
{'fraction_non_alphanumeric': 0.1262541806020067, 'fraction_numerical': 0.0004180602006688963, 'mean_word_length': 2.346853146853147, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7639260', 'n_tokens_mistral': 665, 'n_tokens_neox': 651, 'n_words': 128}