Newer
Older
#include "spdlog/spdlog.h"
void state::push() const {
spdlog::get("state")->debug("Pushing current state.");
history.emplace_back(*this);
}
state state::pop() {
if (!history.empty()) {
auto first = history.front();
history.pop_front();
return first;
} else {
throw std::length_error("History is empty. So nothing can be poped.");
}
}
state& state::operator=(const state& other) {
player = other.player;
enemies = other.enemies;
projectiles = other.projectiles;
return *this;
}