Divided harveste into 3 jobs
This commit is contained in:
@@ -14,7 +14,9 @@ namespace DouwcoHivemind
|
||||
enum CreepRole
|
||||
{
|
||||
UNEMPLOYED,
|
||||
HARVESTER
|
||||
HARVESTER_SUPPLIER,
|
||||
HARVESTER_UPGRADER,
|
||||
HARVESTER_BUILDER
|
||||
};
|
||||
|
||||
class Creep
|
||||
|
||||
@@ -1,35 +1,28 @@
|
||||
#ifndef DOUWCO_HIVEMIND_HARVESTER_HPP
|
||||
#define DOUWCO_HIVEMIND_HARVESTER_HPP
|
||||
|
||||
|
||||
#include "Creeps/Creep.hpp"
|
||||
|
||||
namespace {
|
||||
class Creep;
|
||||
}
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
class HarvesterRole : public Creep
|
||||
class Harvester : public Creep
|
||||
{
|
||||
private:
|
||||
bool harvesting;
|
||||
int taskCounter;
|
||||
|
||||
public:
|
||||
HarvesterRole(Screeps::Creep crp);
|
||||
~HarvesterRole() override;
|
||||
Harvester(Screeps::Creep crp);
|
||||
~Harvester() override;
|
||||
|
||||
void loop() override;
|
||||
|
||||
protected:
|
||||
virtual void depositEnergy(){}
|
||||
|
||||
private:
|
||||
void harvestSource();
|
||||
std::unique_ptr<Screeps::Source> getSourceTarget();
|
||||
void searchSource();
|
||||
|
||||
void depositEnergy();
|
||||
std::unique_ptr<Screeps::Structure> getDepositTarget();
|
||||
void searchDeposit();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
22
douwco_hivemind/include/Creeps/HarvesterBuilder.hpp
Normal file
22
douwco_hivemind/include/Creeps/HarvesterBuilder.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef DOUWCO_HIVEMIND_HARVESTER_BUILDER_HPP
|
||||
#define DOUWCO_HIVEMIND_HARVESTER_BUILDER_HPP
|
||||
|
||||
#include "Creeps/Harvester.hpp"
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
class HarvesterBuilder : public Harvester
|
||||
{
|
||||
public:
|
||||
HarvesterBuilder(Screeps::Creep creep) : Harvester(creep) {}
|
||||
|
||||
protected:
|
||||
void depositEnergy() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Screeps::ConstructionSite> getConstructionSiteTarget();
|
||||
void searchConstructionSite();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // DOUWCO_HIVEMIND_HARVESTER_BUILDER_HPP
|
||||
22
douwco_hivemind/include/Creeps/HarvesterSupplier.hpp
Normal file
22
douwco_hivemind/include/Creeps/HarvesterSupplier.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef DOUWCO_HIVEMIND_HARVESTER_SUPPLIER_HPP
|
||||
#define DOUWCO_HIVEMIND_HARVESTER_SUPPLIER_HPP
|
||||
|
||||
#include "Creeps/Harvester.hpp"
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
class HarvesterSupplier : public Harvester
|
||||
{
|
||||
public:
|
||||
HarvesterSupplier(Screeps::Creep creep) : Harvester(creep) {}
|
||||
|
||||
protected:
|
||||
void depositEnergy() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Screeps::Structure> getEnergyStructureTarget();
|
||||
void searchEnergyStructure();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // DOUWCO_HIVEMIND_HARVESTER_SUPPLIER_HPP
|
||||
18
douwco_hivemind/include/Creeps/HarvesterUpgrader.hpp
Normal file
18
douwco_hivemind/include/Creeps/HarvesterUpgrader.hpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef DOUWCO_HIVEMIND_HARVESTER_UPGRADER_HPP
|
||||
#define DOUWCO_HIVEMIND_HARVESTER_UPGRADER_HPP
|
||||
|
||||
#include "Creeps/Harvester.hpp"
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
class HarvesterUpgrader : public Harvester
|
||||
{
|
||||
public:
|
||||
HarvesterUpgrader(Screeps::Creep creep) : Harvester(creep) {}
|
||||
|
||||
protected:
|
||||
void depositEnergy() override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // DOUWCO_HIVEMIND_HARVESTER_UPGRADER_HPP
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "Structures/Structure.hpp"
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
{
|
||||
class Engine
|
||||
{
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user