-
Notifications
You must be signed in to change notification settings - Fork 0
/
subject.h
40 lines (31 loc) · 826 Bytes
/
subject.h
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
#ifndef __SUBJECT_H__
#define __SUBJECT_H__
#include <vector>
#include <map>
#include "posn.h"
#include "subscriptions.h"
#include "observer.h"
#include "stats.h"
struct Posn;
struct Stats;
class Display;
class Subject {
protected:
std::vector<Observer *> otherObservers;
std::map<Posn, Observer *> tileObservers;
public:
void attach(const Posn &p, Observer *o);
void attach(Observer *o);
void notifyObservers(SubscriptionType t);
virtual Posn getCurPos() const = 0;
virtual Posn getLastPos() const = 0;
virtual char getIcon() const = 0;
virtual void setAction(const std::string &s);
virtual void appendAction(const std::string &s);
virtual void use(Subject &p);
virtual Stats getStats() const;
virtual int getGold() const;
virtual void pickUpGold(int newGold);
virtual ~Subject() = 0;
};
#endif