23 lines
539 B
C++
23 lines
539 B
C++
#include <cstdio>
|
|
#include "libtcod.hpp"
|
|
#include "Actor.h"
|
|
#include "Map.h"
|
|
#include "Engine.h"
|
|
#include "Ai.h"
|
|
#include "Destructible.h"
|
|
#include "Attacker.h"
|
|
|
|
Actor::Actor(int x, int y, std::string_view ch, std::string name, const TCOD_ColorRGB& col) :
|
|
x(x), y(y), ch(ch), col(col), name(name),
|
|
blocks(true),attacker(nullptr), destructible(nullptr), ai(nullptr) {
|
|
}
|
|
|
|
void Actor::render(TCOD_Console& cons) const {
|
|
tcod::print(cons, { x, y }, ch, col, std::nullopt);
|
|
}
|
|
|
|
void Actor::update() {
|
|
if (ai) {
|
|
ai->update(this);
|
|
}
|
|
} |