diff options
Diffstat (limited to 'BlueTileBehavior.cpp')
-rw-r--r-- | BlueTileBehavior.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/BlueTileBehavior.cpp b/BlueTileBehavior.cpp index a2b3422..d934d4b 100644 --- a/BlueTileBehavior.cpp +++ b/BlueTileBehavior.cpp @@ -1,15 +1,15 @@ #include <memory> -#include "BlueTileBehavior.h" -#include "YellowTileBehavior.h" +#include "SetNeighborTileBehavior.h" +#include "CreateArtistTileBehavior.h" #include "Artist.h" #include "Tile.h" using namespace std; -BlueTileBehavior BlueTileBehavior::instance { BlueTileBehavior::type }; +SetNeighborTileBehavior SetNeighborTileBehavior::instance { SetNeighborTileBehavior::type }; -void BlueTileBehavior::step(Artist * artist) { +void SetNeighborTileBehavior::step(Artist * artist) { this->interactions++; if (dx != 0 || dy != 0) return; if (artist == nullptr) return; @@ -24,21 +24,21 @@ static void update_neighbor(Tile & here, int dx, int dy) { if (neighbor == &here) return; if (neighbor == nullptr) return; - neighbor->set_type(BlueTileBehavior::type); + neighbor->set_type(SetNeighborTileBehavior::type); } -void BlueTileBehavior::update(Tile & tile) { +void SetNeighborTileBehavior::update(Tile & tile) { if (this->interactions < 1) return; update_neighbor(tile, this->dx, this->dy); update_neighbor(tile, -this->dx, -this->dy); - tile.set_type(YellowTileBehavior::type); + tile.set_type(CreateArtistTileBehavior::type); } -unique_ptr<TileBehaviorStrategy> BlueTileBehavior::clone(Museum & museum) { - auto instance = new BlueTileBehavior(); +unique_ptr<TileBehavior> SetNeighborTileBehavior::clone(Museum & museum) { + auto instance = new SetNeighborTileBehavior(); instance->museum = &museum; - return unique_ptr<TileBehaviorStrategy>(instance); + return unique_ptr<TileBehavior>(instance); } |