IMapControl.h
1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// IMapControl.h
// SteveMaggieCpp
//
// Created by Katarzyna Kalinowska-Górska on 17.05.2017.
//
//
#ifndef IMapControl_h
#define IMapControl_h
#include "IMapControlInterface.h"
class AniMapLayer;
class IMapCharacter;
class IMapControl {
public:
// the order of the observers in the vector will be the order of responding of the observers to events
virtual void install(AniMapLayer* p_AniMapLayer, IMapCharacter* p_controlledCharacter, std::vector<IMapControlInterface*> p_observers) {
for(auto it = p_observers.begin(); it != p_observers.end(); ++it){
(*it)->m_mapControl = this;
}
m_observers = p_observers;
}
virtual void uninstall(){
for(auto it = m_observers.begin(); it != m_observers.end(); ++it){
(*it)->m_mapControl = nullptr;
}
m_observers.clear();
}
virtual ~IMapControl(){};
struct IMapEvent {
std::string type;
};
virtual void mapEvent(IMapControlInterface* p_controlInterface, IMapEvent* p_mapEvent){};
protected:
std::vector<IMapControlInterface*> m_observers;
};
#endif /* IMapControl_h */