Creeps extract memory completly
This commit is contained in:
@@ -2,19 +2,31 @@
|
||||
#define DOUWCO_HIVEMIND_CREEP_HPP
|
||||
|
||||
#include <Screeps/Creep.hpp>
|
||||
#include "Constants.hpp"
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
class Creep
|
||||
{
|
||||
public:
|
||||
CreepRole role;
|
||||
|
||||
protected:
|
||||
Screeps::Creep creep;
|
||||
JSON memory;
|
||||
public:
|
||||
Creep(Screeps::Creep crp) : creep(crp), memory(crp.memory()){}
|
||||
~Creep(){ creep.setMemory(memory); }
|
||||
|
||||
virtual void loop(){}
|
||||
public:
|
||||
Creep(Screeps::Creep crp) : creep(crp),
|
||||
memory(crp.memory())
|
||||
{
|
||||
role = memory.contains("role") ? static_cast<CreepRole>(memory["role"]) : CreepRole::UNEMPLOYED;
|
||||
}
|
||||
|
||||
virtual ~Creep() {
|
||||
creep.setMemory(memory);
|
||||
}
|
||||
|
||||
virtual void loop() {}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user