Creeps extract memory completly
This commit is contained in:
@@ -9,9 +9,25 @@ namespace DouwcoHivemind
|
||||
{
|
||||
class HarvesterRole : public Creep
|
||||
{
|
||||
private:
|
||||
bool harvesting;
|
||||
std::string target_id;
|
||||
int taskCounter;
|
||||
|
||||
public:
|
||||
HarvesterRole(Screeps::Creep crp) : Creep(crp) {}
|
||||
~HarvesterRole() {}
|
||||
HarvesterRole(Screeps::Creep crp) : Creep(crp)
|
||||
{
|
||||
harvesting = memory.contains("harvesting") ? static_cast<bool>(memory["harvesting"]) : false;
|
||||
target_id = memory.contains("target_id") ? static_cast<std::string>(memory["target_id"]) : std::string();
|
||||
taskCounter = memory.contains("taskCounter") ? static_cast<int>(memory["taskCounter"]) : 0;
|
||||
}
|
||||
|
||||
~HarvesterRole() override
|
||||
{
|
||||
memory["harvesting"] = harvesting;
|
||||
memory["target_id"] = target_id;
|
||||
memory["taskCounter"] = taskCounter;
|
||||
}
|
||||
|
||||
void loop() override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user