added the maintainer and changed some naming.

This commit is contained in:
douwe
2025-08-26 16:34:49 +02:00
parent 0c693354e6
commit eea9e7d69f
24 changed files with 328 additions and 164 deletions

View File

@@ -2,11 +2,11 @@
#define DOUWCO_HIVEMIND_PATH_TOOL_HPP
#include <vector>
#include <Screeps/ReturnTypes.hpp>
#include <Screeps/Room.hpp>
namespace DouwcoHivemind
{
static std::vector<int> flattenPathSteps(const std::vector<Screeps::PathStep> &pathSteps)
static std::vector<int> flattenPathSteps(const std::vector<Screeps::Room::PathStep> &pathSteps)
{
std::vector<int> flattened;
for (const auto &step : pathSteps)
@@ -20,12 +20,18 @@ namespace DouwcoHivemind
return flattened;
}
static std::vector<Screeps::PathStep> unflattenPathSteps(const std::vector<int> &flattened)
static std::vector<Screeps::Room::PathStep> unflattenPathSteps(const std::vector<int> &flattened)
{
std::vector<Screeps::PathStep> pathSteps;
std::vector<Screeps::Room::PathStep> pathSteps;
for (size_t i = 0; i < flattened.size(); i += 5)
{
pathSteps.emplace_back(Screeps::PathStep(flattened[i], flattened[i + 1], flattened[i + 2], flattened[i + 3], flattened[i + 4]));
Screeps::Room::PathStep step;
step.x = flattened[i];
step.y = flattened[i+1];
step.dx = flattened[i+2];
step.dy = flattened[i+3];
step.direction = flattened[i+4];
pathSteps.emplace_back(step);
}
return pathSteps;
}