From 6a1ad62b26698e2483a7ec692c60f6cc3fa76561 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 12 Feb 2018 19:31:00 +0100 Subject: Add Actor* member to tiles and implement Map::moveActor() --- src/main/cpp/Map.cpp | 3 ++- src/main/cpp/Tile.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/main/cpp/Tile.cpp (limited to 'src/main/cpp') diff --git a/src/main/cpp/Map.cpp b/src/main/cpp/Map.cpp index 6d3ee01..3cb1b9d 100644 --- a/src/main/cpp/Map.cpp +++ b/src/main/cpp/Map.cpp @@ -24,5 +24,6 @@ const std::vector& Map::tiles() const bool Map::moveActor(Tile &from, Tile &to) { - // TODO + to.actor(from.actor()); + from.clearActor(); } diff --git a/src/main/cpp/Tile.cpp b/src/main/cpp/Tile.cpp new file mode 100644 index 0000000..9fc436a --- /dev/null +++ b/src/main/cpp/Tile.cpp @@ -0,0 +1,11 @@ +#include "Tile.hpp" + +bool Tile::actor(Actor *actor) +{ + if (_actor != nullptr) { + return false; + } + + _actor = actor; + return true; +} -- cgit v1.2.1