#ifndef DOUWCO_HIVEMIND_PATH_TOOL_HPP #define DOUWCO_HIVEMIND_PATH_TOOL_HPP #include #include namespace DouwcoHivemind { static std::vector flattenPathSteps(const std::vector &pathSteps) { std::vector flattened; for (const auto &step : pathSteps) { flattened.push_back(step.x); flattened.push_back(step.y); flattened.push_back(step.dx); flattened.push_back(step.dy); flattened.push_back(step.direction); } return flattened; } static std::vector unflattenPathSteps(const std::vector &flattened) { std::vector 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])); } return pathSteps; } } // namespace Screeps #endif // DOUWCO_HIVEMIND_PATH_TOOL_HPP