blob: 091a2515059abd83a84a5382c3293658f9158224 (
plain)
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
|
#include <memory>
#include "DeleteArtistTileBehavior.h"
#include "SetNeighborTileBehavior.h"
#include "Tile.h"
#include "Museum.h"
using namespace std;
DeleteArtistTileBehavior DeleteArtistTileBehavior::instance { DeleteArtistTileBehavior::type };
void DeleteArtistTileBehavior::step(Artist * artist) {
this->interactions++;
if (artist != nullptr)
this->museum->people.remove_artist(*artist);
}
void DeleteArtistTileBehavior::update(Tile & tile) {
if (this->interactions == 0) return;
tile.set_type(SetNeighborTileBehavior::type);
}
unique_ptr<TileBehavior> DeleteArtistTileBehavior::clone(Museum & museum) {
auto instance = new DeleteArtistTileBehavior();
instance->museum = &museum;
return unique_ptr<TileBehavior>(instance);
}
|