Added structure handling in engine as well.
This commit is contained in:
@@ -7,7 +7,10 @@
|
||||
#include <Screeps/Creep.hpp>
|
||||
|
||||
#include "Constants.hpp"
|
||||
#include "Creeps/Creep.hpp"
|
||||
#include "Creeps/Harvester.hpp"
|
||||
#include "Structures/Structure.hpp"
|
||||
#include "Structures/Spawn.hpp"
|
||||
|
||||
namespace DouwcoHivemind
|
||||
{
|
||||
@@ -18,19 +21,23 @@ namespace DouwcoHivemind
|
||||
{
|
||||
private:
|
||||
std::vector<std::unique_ptr<Creep>> creeps;
|
||||
// std::vector<std::unique_ptr<Structure>> structure;
|
||||
std::vector<std::unique_ptr<Structure>> structures;
|
||||
|
||||
public:
|
||||
Engine()
|
||||
{
|
||||
ReadOutCreeps();
|
||||
ReadOutStructures();
|
||||
}
|
||||
~Engine() {}
|
||||
|
||||
void loop() {
|
||||
for(auto &creep : creeps){
|
||||
void loop()
|
||||
{
|
||||
for (auto &creep : creeps)
|
||||
creep->loop();
|
||||
}
|
||||
|
||||
for (auto &structure : structures)
|
||||
structure->loop();
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -52,6 +59,15 @@ namespace DouwcoHivemind
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ReadOutStructures()
|
||||
{
|
||||
auto spawns = Screeps::Game.spawns();
|
||||
for (auto &spawn : spawns)
|
||||
{
|
||||
structures.push_back(std::make_unique<Spawn>(spawn.second));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user