Bladeren bron

Realised Scene Manager class and implemented 2 new scenes

Ivan Arkhipov 6 jaren geleden
bovenliggende
commit
215f375d84

BIN
assets/pvp_intro/picture.jpg


+ 14 - 5
client.pro

@@ -31,20 +31,29 @@ SOURCES += \
     source/gui/gui.cpp \
     source/gui/recruitmentscene.cpp \
     source/unit.cpp \
-    source/unitfactory.cpp \
-    source/player.cpp
+    source/player.cpp \
+    source/gui/mainmenu.cpp \
+    source/gui/guiscenemanager.cpp \
+    source/gui/detatchedwidget.cpp \
+    source/gui/playervsplayerintro.cpp
 
 HEADERS += \
     include/gui/uniticon.h \
     include/gui/gui.h \
     include/gui/recruitmentscene.h \
     include/unit.h \
-    include/unitfactory.h \
-    include/player.h
+    include/abstractfactory.h \
+    include/player.h \
+    include/gui/mainmenu.h \
+    include/gui/guiscenemanager.h \
+    include/gui/detatchedwidget.h \
+    include/gui/playervsplayerintro.h
 
 FORMS += \
     include/gui/gui.ui \
-    include/gui/recruitmentscene.ui
+    include/gui/recruitmentscene.ui \
+    include/gui/mainmenu.ui \
+    include/gui/playervsplayerintro.ui
 
 RESOURCES += \
     gui.qrc

+ 1 - 0
gui.qrc

@@ -25,5 +25,6 @@
         <file>assets/window/thick_opaque-border-top.png</file>
         <file>assets/window/thick_opaque-border-topleft.png</file>
         <file>assets/window/thick_opaque-border-topright.png</file>
+        <file>assets/pvp_intro/picture.jpg</file>
     </qresource>
 </RCC>

+ 55 - 0
include/abstractfactory.h

@@ -0,0 +1,55 @@
+#pragma once
+#include <iostream>
+#include <string>
+#include <map>
+
+template <class Base, typename IdType>
+class AbstractCreator {
+public:
+	virtual ~AbstractCreator() {}
+	virtual Base* create(const IdType &id) const = 0;
+};
+
+template <class ObjectClass, class Base, typename IdType>
+class Creator : public AbstractCreator <Base, IdType> {
+public:
+	Creator(IdType id) {}
+	virtual ~Creator() {}
+	Base* create(const IdType &id) const {
+		return dynamic_cast<Base*>(new ObjectClass(id));
+	}
+};
+
+template <class Base, class IdType>
+class ObjectFactory {
+protected:
+	typedef AbstractCreator<Base, IdType> AbstractFactory;
+	typedef std::map<IdType, AbstractFactory*> FactoryMap;
+	FactoryMap factory_;
+
+public:
+	ObjectFactory() {}
+	virtual ~ObjectFactory() {
+		for (auto& item : factory_)
+			delete item.second;
+	}
+
+	template <class C, typename idCreator>
+	void add(const IdType &id) {
+		registerClass(id, new Creator<C, Base, idCreator>(id));
+	}
+
+	template <typename idCreator>
+	Base* create(const IdType &idClass, const idCreator &id) {
+		return factory_[idClass]->create(id);
+	}
+
+protected:
+	void registerClass(const IdType &id, AbstractFactory *ConcreteFabric) {
+		typename FactoryMap::iterator it = factory_.find(id);
+		if (it == factory_.end())
+			factory_[id] = ConcreteFabric;
+		else
+			delete ConcreteFabric;
+	}
+};

+ 17 - 0
include/gui/detatchedwidget.h

@@ -0,0 +1,17 @@
+#ifndef INCLUDEGUIDETATCHEDWIDGET_H
+#define INCLUDEGUIDETATCHEDWIDGET_H
+
+#include <QWidget>
+
+class DetatchedWidget : public QWidget
+{
+    Q_OBJECT
+public:
+    explicit DetatchedWidget(QWidget *parent = nullptr);
+
+signals:
+
+public slots:
+};
+
+#endif // INCLUDEGUIDETATCHEDWIDGET_H

+ 2 - 0
include/gui/gui.h

@@ -17,9 +17,11 @@ class GUI : public QMainWindow
 public:
     explicit GUI(QWidget *parent = 0);
     ~GUI();
+    QWidget* mainContentScene();
 
 private:
     Ui::GUI *ui_;
+
     QGraphicsScene *scene_;
     RecruitmentScene *rq_scene_;
 

+ 41 - 0
include/gui/guiscenemanager.h

@@ -0,0 +1,41 @@
+#ifndef INCLUDEGUIGUISCENEMANAGER_H
+#define INCLUDEGUIGUISCENEMANAGER_H
+
+#include <QObject>
+
+#include <map>
+
+class GUI;
+
+class GuiSceneManager : public QObject
+{
+    Q_OBJECT
+private:
+    explicit GuiSceneManager(QObject *parent = nullptr);
+    ~GuiSceneManager();
+
+public:
+    static GuiSceneManager& getInstance() {
+        static GuiSceneManager instance;
+        return instance;
+    }
+
+    bool registerScene(QString scene_name, QWidget* name);
+
+    bool changeScene(QString scene_name, QString args = "");
+
+    void createDetachedScene(QString scene_name);
+
+    void destroyDetachedScene(QString scene_name);
+
+private:
+    std::map<QString, QWidget*> scenes_;
+    QString current_scene_;
+    GUI* gui_;
+
+signals:
+
+public slots:
+};
+
+#endif // INCLUDEGUIGUISCENEMANAGER_H

+ 28 - 0
include/gui/mainmenu.h

@@ -0,0 +1,28 @@
+#ifndef MAINMENU_H
+#define MAINMENU_H
+
+#include <QWidget>
+
+namespace Ui {
+class MainMenu;
+}
+
+class MainMenu : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit MainMenu(QWidget *parent = 0);
+    ~MainMenu();
+
+private slots:
+
+    void on_exit_button_clicked();
+
+    void on_pvp_local_battle_button_clicked();
+
+private:
+    Ui::MainMenu *ui;
+};
+
+#endif // MAINMENU_H

+ 61 - 0
include/gui/mainmenu.ui

@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainMenu</class>
+ <widget class="QWidget" name="MainMenu">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>940</width>
+    <height>720</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <widget class="QLabel" name="title_">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>60</y>
+     <width>941</width>
+     <height>101</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:24pt; color:#b12d2d;&quot;&gt;Супер-мега-крутая-игрушка-название-которой-мы-ещё-не-придумали&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+   <property name="wordWrap">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pvp_local_battle_button">
+   <property name="geometry">
+    <rect>
+     <x>200</x>
+     <y>190</y>
+     <width>481</width>
+     <height>251</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Игрок против игрока</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="exit_button">
+   <property name="geometry">
+    <rect>
+     <x>200</x>
+     <y>470</y>
+     <width>481</width>
+     <height>221</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Выйти из игры</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 45 - 0
include/gui/mainwindow.ui

@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>940</width>
+    <height>720</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <widget class="QLabel" name="divider_">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>170</y>
+     <width>940</width>
+     <height>91</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/assets/recruitscene/divider.png&quot; width=&quot;940&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="title_">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>100</y>
+     <width>941</width>
+     <height>101</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:24pt; color:#b12d2d;&quot;&gt;Супер-мега-крутая-игрушка-&lt;br&gt;название-которой-мы-ещё-не-придумали&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 27 - 0
include/gui/playervsplayerintro.h

@@ -0,0 +1,27 @@
+#ifndef PLAYERVSPLAYERINTRO_H
+#define PLAYERVSPLAYERINTRO_H
+
+#include <QWidget>
+
+namespace Ui {
+class PlayerVsPlayerIntro;
+}
+
+class PlayerVsPlayerIntro : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit PlayerVsPlayerIntro(QWidget *parent = 0);
+    ~PlayerVsPlayerIntro();
+
+private slots:
+    void on_back_to_menu_clicked();
+
+    void on_go_next_clicked();
+
+private:
+    Ui::PlayerVsPlayerIntro *ui;
+};
+
+#endif // PLAYERVSPLAYERINTRO_H

+ 126 - 0
include/gui/playervsplayerintro.ui

@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PlayerVsPlayerIntro</class>
+ <widget class="QWidget" name="PlayerVsPlayerIntro">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>940</width>
+    <height>720</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <widget class="QLabel" name="divider_">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>45</y>
+     <width>940</width>
+     <height>91</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/assets/recruitscene/divider.png&quot; width=&quot;940&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="title_">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>941</width>
+     <height>71</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:24pt; color:#b12d2d;&quot;&gt;Режим: игрок против игрока&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="title_1">
+   <property name="geometry">
+    <rect>
+     <x>90</x>
+     <y>120</y>
+     <width>751</width>
+     <height>151</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:16pt; color:#FDEAA8;&quot;&gt;Этот режим включает в себя стандартное пошаговое сражение между двумя игроками в отсутствие какого-либо сценария. Каждому игроку будет предложено выбрать расу и набрать армию в соответствии с указанным бюджетом. &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+   <property name="wordWrap">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>200</x>
+     <y>290</y>
+     <width>501</width>
+     <height>261</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img width=&quot;500&quot; src=&quot;:/assets/pvp_intro/picture.jpg&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="go_next">
+   <property name="geometry">
+    <rect>
+     <x>630</x>
+     <y>630</y>
+     <width>221</width>
+     <height>61</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Продолжить</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="back_to_menu">
+   <property name="geometry">
+    <rect>
+     <x>70</x>
+     <y>630</y>
+     <width>191</width>
+     <height>61</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Назад</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>310</x>
+     <y>570</y>
+     <width>141</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; color:#b12d2d;&quot;&gt;Кол-во монет:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit">
+   <property name="geometry">
+    <rect>
+     <x>462</x>
+     <y>577</y>
+     <width>111</width>
+     <height>20</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>1000</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 3 - 0
include/gui/recruitmentscene.h

@@ -19,6 +19,9 @@ public:
     explicit RecruitmentScene(QWidget *parent = 0);
     ~RecruitmentScene();
 
+private slots:
+    void on_back_button_clicked();
+
 private:
     Ui::RecruitmentScene *ui;
     UnitIcon* available_units_icons_[5];

+ 21 - 7
include/gui/recruitmentscene.ui

@@ -182,7 +182,7 @@
     </property>
    </layout>
   </widget>
-  <widget class="QPushButton" name="apply_">
+  <widget class="QPushButton" name="apply">
    <property name="geometry">
     <rect>
      <x>610</x>
@@ -244,17 +244,17 @@
     </property>
    </widget>
   </widget>
-  <widget class="QPushButton" name="back_button_">
+  <widget class="QPushButton" name="back_button">
    <property name="geometry">
     <rect>
-     <x>10</x>
-     <y>640</y>
+     <x>50</x>
+     <y>650</y>
      <width>161</width>
      <height>61</height>
     </rect>
    </property>
    <property name="text">
-    <string>Вернуться на главную</string>
+    <string>На главное меню</string>
    </property>
   </widget>
   <widget class="QLabel" name="available_money_text_">
@@ -416,6 +416,19 @@
     </rect>
    </property>
   </widget>
+  <widget class="QLabel" name="title_1">
+   <property name="geometry">
+    <rect>
+     <x>270</x>
+     <y>350</y>
+     <width>941</width>
+     <height>71</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:24pt; color:#b12d2d;&quot;&gt;Набор юнитов&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
   <zorder>divider_</zorder>
   <zorder>chosen_race_text_</zorder>
   <zorder>chosen_race_image_</zorder>
@@ -426,12 +439,13 @@
   <zorder>available_units_list_</zorder>
   <zorder>chosen_units_grid_</zorder>
   <zorder>description_scroll_widget_</zorder>
-  <zorder>back_button_</zorder>
+  <zorder>back_button</zorder>
   <zorder>available_units_text_</zorder>
   <zorder>available_money_text_</zorder>
-  <zorder>apply_</zorder>
+  <zorder>apply</zorder>
   <zorder>unit_spec_widget_</zorder>
   <zorder>widget</zorder>
+  <zorder>title_1</zorder>
  </widget>
  <customwidgets>
   <customwidget>

+ 6 - 2
include/unit.h

@@ -3,7 +3,11 @@
 #include <vector>
 #include "AbstractFactory.h"
 
-class Spell;	
+class Spell {
+public:
+    int a;
+};
+
 class Cell {
 	//waiting for a realisation
 public:
@@ -144,4 +148,4 @@ public:
 	virtual bool canAttackToCell(Cell* destination) = 0;
 
 	virtual bool canAttackUnit(Unit* target) = 0;
-};
+};

+ 0 - 20
include/unitfactory.h

@@ -1,20 +0,0 @@
-#ifndef UNITFACTORY_H
-#define UNITFACTORY_H
-
-#include <QObject>
-#include <QImage>
-
-class UnitFactory : public QObject
-{
-    Q_OBJECT
-public:
-    explicit UnitFactory(QObject *parent = nullptr);
-private:
-    QImage race_icon_;
-
-signals:
-
-public slots:
-};
-
-#endif // UNITFACTORY_H

+ 6 - 0
source/gui/detatchedwidget.cpp

@@ -0,0 +1,6 @@
+#include "gui/detatchedwidget.h"
+
+DetatchedWidget::DetatchedWidget(QWidget *parent) : QWidget(parent)
+{
+
+}

+ 7 - 2
source/gui/gui.cpp

@@ -9,8 +9,8 @@ GUI::GUI(QWidget *parent) :
 {
     ui_->setupUi(this);
 
-    rq_scene_ = new RecruitmentScene(ui_->main_content_);   /// Инициализируем графическую сцену выбора юнитов
-    rq_scene_->show();
+    //rq_scene_ = new RecruitmentScene(ui_->main_content_);   /// Инициализируем графическую сцену выбора юнитов
+    //rq_scene_->show();
 }
 
 GUI::~GUI()
@@ -18,6 +18,11 @@ GUI::~GUI()
     delete ui_;
 }
 
+QWidget* GUI::mainContentScene() {
+    return ui_->main_content_;
+}
+
+
 void GUI::mouseMoveEvent( QMouseEvent* e ) {
     if( e->buttons() | Qt::LeftButton ) {
         QPoint pt=mapFromGlobal(QCursor::pos());

+ 61 - 0
source/gui/guiscenemanager.cpp

@@ -0,0 +1,61 @@
+#include "gui/guiscenemanager.h"
+#include "gui/gui.h"
+#include "gui/detatchedwidget.h"
+#include "gui/mainmenu.h"
+#include "gui/playervsplayerintro.h"
+
+GuiSceneManager::GuiSceneManager(QObject *parent) : QObject(parent) {
+    gui_ = new GUI();
+    gui_->show();
+    current_scene_ = "none";
+
+    registerScene("main_menu", new MainMenu(gui_->mainContentScene()));
+    registerScene("pvp_intro", new PlayerVsPlayerIntro(gui_->mainContentScene()));
+    registerScene("recruit_army", new RecruitmentScene(gui_->mainContentScene()));
+
+    changeScene("main_menu");
+}
+
+GuiSceneManager::~GuiSceneManager() {
+    delete gui_;
+    for (auto scene : scenes_) {
+        delete scene.second;
+    }
+}
+
+
+bool GuiSceneManager::registerScene(QString scene_name, QWidget* name) {
+    if (scene_name == "none")
+        return false;
+
+    if (scenes_.count(scene_name) != 0) {
+        delete name;
+        return false;
+    }
+
+    scenes_[scene_name] = name;
+    return true;
+}
+
+bool GuiSceneManager::changeScene(QString scene_name, QString args) {
+    if (scene_name == current_scene_ || scene_name == "main_window") {
+        return false;
+    }
+
+    if (current_scene_ != "none")
+        scenes_[current_scene_]->hide();
+
+    //scenes_[scene_name]->parseArgs(args);
+    scenes_[scene_name]->show();
+    current_scene_ = scene_name;
+    return true;
+}
+
+void GuiSceneManager::createDetachedScene(QString scene_name) {
+    /// TO BE DONE!!!
+}
+
+void GuiSceneManager::destroyDetachedScene(QString scene_name) {
+    /// TO BE DONE!!!
+}
+

+ 28 - 0
source/gui/mainmenu.cpp

@@ -0,0 +1,28 @@
+#include "gui/mainmenu.h"
+#include "gui/guiscenemanager.h"
+#include "ui_mainmenu.h"
+
+#include <QString>
+#include <QApplication>
+
+MainMenu::MainMenu(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::MainMenu)
+{
+    ui->setupUi(this);
+}
+
+MainMenu::~MainMenu()
+{
+    delete ui;
+}
+
+void MainMenu::on_exit_button_clicked()
+{
+    QApplication::quit();
+}
+
+void MainMenu::on_pvp_local_battle_button_clicked()
+{
+    GuiSceneManager::getInstance().changeScene("pvp_intro");
+}

+ 25 - 0
source/gui/playervsplayerintro.cpp

@@ -0,0 +1,25 @@
+#include "gui/playervsplayerintro.h"
+#include "gui/guiscenemanager.h"
+#include "ui_playervsplayerintro.h"
+
+PlayerVsPlayerIntro::PlayerVsPlayerIntro(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::PlayerVsPlayerIntro)
+{
+    ui->setupUi(this);
+}
+
+PlayerVsPlayerIntro::~PlayerVsPlayerIntro()
+{
+    delete ui;
+}
+
+void PlayerVsPlayerIntro::on_back_to_menu_clicked()
+{
+    GuiSceneManager::getInstance().changeScene("main_menu");
+}
+
+void PlayerVsPlayerIntro::on_go_next_clicked()
+{
+    GuiSceneManager::getInstance().changeScene("recruit_army");
+}

+ 6 - 0
source/gui/recruitmentscene.cpp

@@ -1,5 +1,6 @@
 #include <gui/recruitmentscene.h>
 #include <gui/uniticon.h>
+#include <gui/guiscenemanager.h>
 
 #include <ui_recruitmentscene.h>
 #include <QHBoxLayout>
@@ -50,3 +51,8 @@ RecruitmentScene::~RecruitmentScene()
 {
     delete ui;
 }
+
+void RecruitmentScene::on_back_button_clicked()
+{
+    GuiSceneManager::getInstance().changeScene("main_menu");
+}

+ 3 - 2
source/main.cpp

@@ -1,3 +1,4 @@
+#include <gui/guiscenemanager.h>
 #include <gui/gui.h>
 #include <gui/recruitmentscene.h>
 
@@ -6,7 +7,7 @@
 int main(int argc, char *argv[])
 {
     QApplication a(argc, argv);
-    GUI w;
-    w.show();
+
+    GuiSceneManager::getInstance().changeScene("main_menu");
     return a.exec();
 }

+ 1 - 2
source/unit.cpp

@@ -1,4 +1,3 @@
-#pragma once
 #include <iostream>
 #include <algorithm>
 #include <cassert>
@@ -200,4 +199,4 @@ void Unit::moveToCell(Cell* destination) {
 		setMovementSpeed(decreasedValue);
 		setLocation(destination);
 	}
-}
+}

+ 0 - 6
source/unitfactory.cpp

@@ -1,6 +0,0 @@
-#include "unitfactory.h"
-
-UnitFactory::UnitFactory(QObject *parent) : QObject(parent)
-{
-
-}