aboutsummaryrefslogtreecommitdiff
path: root/RedTileBehavior.cpp
blob: 0f0426d610389388bf8f0bbbae2b3f7765121d6f (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 "RedTileBehavior.h"
#include "BlueTileBehavior.h"
#include "Tile.h"
#include "Museum.h"

using namespace std;

RedTileBehavior RedTileBehavior::instance { RedTileBehavior::type };

void RedTileBehavior::step(Artist * artist) {
	this->interactions++;
	if (artist != nullptr)
		this->museum->people.remove_artist(*artist);
}

void RedTileBehavior::update(Tile & tile) {
	if (this->interactions == 0) return;
	tile.set_type(BlueTileBehavior::type);
}

unique_ptr<TileBehaviorStrategy> RedTileBehavior::clone(Museum & museum) {
	auto instance = new RedTileBehavior();
	instance->museum = &museum;
	return unique_ptr<TileBehaviorStrategy>(instance);
}