aboutsummaryrefslogtreecommitdiff
path: root/TileBehaviorFactory.cpp
blob: b795578174a919e6ad622da88f4c32983bf48573 (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
29
30
#include <memory>

#include "TileBehaviorFactory.h"
#include "CreateArtistTileBehavior.h"
#include "DeleteArtistTileBehavior.h"
#include "NullTileBehavior.h"
#include "SetNeighborTileBehavior.h"
#include "StepTileBehavior.h"

using namespace std;

TileBehaviorFactory::TileBehaviorFactory(Museum & m) : museum(m) {};

unique_ptr<TileBehavior> TileBehaviorFactory::create(string type) {
	TileBehavior * out = nullptr;

	if (type == SetNeighborTileBehavior::type)
		out = new SetNeighborTileBehavior(this->museum);
	else if (type == CreateArtistTileBehavior::type)
		out = new CreateArtistTileBehavior(this->museum);
	else if (type == StepTileBehavior::type)
		out = new StepTileBehavior(this->museum);
	else if (type == DeleteArtistTileBehavior::type)
		out = new DeleteArtistTileBehavior(this->museum);

	if (out == nullptr)
		out = new NullTileBehavior(this->museum);
	return unique_ptr<TileBehavior>(out);
}