2022-09-05 02:19:21 +02:00
|
|
|
#ifndef MAPCONTROLLER_H
|
|
|
|
#define MAPCONTROLLER_H
|
|
|
|
|
|
|
|
#include "maphandler.h"
|
|
|
|
#include "mapview.h"
|
|
|
|
#include "../lib/mapping/CMap.h"
|
|
|
|
#include "../lib/Terrain.h"
|
|
|
|
|
|
|
|
class MainWindow;
|
|
|
|
class MapController
|
|
|
|
{
|
|
|
|
public:
|
2022-09-05 04:18:38 +02:00
|
|
|
MapController(MainWindow *);
|
2022-09-05 02:19:21 +02:00
|
|
|
MapController(const MapController &) = delete;
|
|
|
|
MapController(const MapController &&) = delete;
|
|
|
|
~MapController();
|
|
|
|
|
|
|
|
void setMap(std::unique_ptr<CMap>);
|
|
|
|
|
|
|
|
CMap * map();
|
|
|
|
MapHandler * mapHandler();
|
|
|
|
MapScene * scene(int level);
|
|
|
|
|
|
|
|
void resetMapHandler();
|
|
|
|
|
|
|
|
void sceneForceUpdate();
|
|
|
|
void sceneForceUpdate(int level);
|
|
|
|
|
|
|
|
void commitTerrainChange(int level, const Terrain & terrain);
|
2022-09-05 18:27:09 +02:00
|
|
|
void commitObjectErase(const CGObjectInstance* obj);
|
2022-09-05 02:19:21 +02:00
|
|
|
void commitObjectErase(int level);
|
|
|
|
void commitObstacleFill(int level);
|
|
|
|
void commitChangeWithoutRedraw();
|
|
|
|
void commitObjectShiftOrCreate(int level);
|
|
|
|
void commitObjectCreate(int level);
|
|
|
|
void commitObjectChange(int level);
|
|
|
|
|
|
|
|
bool discardObject(int level) const;
|
|
|
|
void createObject(int level, CGObjectInstance * obj) const;
|
2022-09-05 18:27:09 +02:00
|
|
|
|
|
|
|
void undo();
|
|
|
|
void redo();
|
2022-09-05 02:19:21 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<CMap> _map;
|
|
|
|
std::unique_ptr<MapHandler> _mapHandler;
|
2022-09-05 04:18:38 +02:00
|
|
|
MainWindow * main;
|
2022-09-05 03:50:21 +02:00
|
|
|
mutable std::array<std::unique_ptr<MapScene>, 2> _scenes;
|
2022-09-06 08:05:34 +02:00
|
|
|
|
|
|
|
void connectScenes();
|
2022-09-05 02:19:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAPCONTROLLER_H
|