diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-18 15:48:14 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-18 15:48:14 +0200 |
commit | d8289105193707daede1a5b59137f18e20f20aeb (patch) | |
tree | 939908b9c4c6f7aaef8aa61ee2e04be3e85610b6 /DeleteArtistTileBehavior.cpp | |
parent | 76e61d68bbf568ec0d7fc4632e52d4de5496b003 (diff) |
(2/2) rename
Diffstat (limited to 'DeleteArtistTileBehavior.cpp')
-rw-r--r-- | DeleteArtistTileBehavior.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/DeleteArtistTileBehavior.cpp b/DeleteArtistTileBehavior.cpp new file mode 100644 index 0000000..091a251 --- /dev/null +++ b/DeleteArtistTileBehavior.cpp @@ -0,0 +1,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); +} + |