getMap and getDanger working

This commit is contained in:
Bluub
2021-06-18 11:46:31 +02:00
parent 8914579fd7
commit b355aed333
8 changed files with 264 additions and 93 deletions
+50
View File
@@ -0,0 +1,50 @@
//
//
//
#include <map>
#include "LuaMap.hpp"
namespace BBM
{
LuaMap::LuaMap()
: _map(16, std::vector<int>(16, 0)), _danger(16, std::vector<int>(16, 0))
{
}
LuaMap::~LuaMap()
{ }
std::vector<Vector2f> pathfind(Vector2f root, Vector2f target)
{
/*
std::vector<Vector2f> closed;
std::vector<Vector2f> open;
std::map<Vector2f, Vector2f> came_from;
std::map<Vector2f, double> g_score;
std::map<Vector2f, double> f_score;
std::vector<Vector2f> path;
g_score[root] = 0;
f_score[root] = root.distance(target);
while (open.size())
{
Vector2f current = getLowestFScore();
if (current == target) {
fill_path();
return path;
}
remove_from_closed(current);
add_to_open(current);
auto neighbors = getNeighbors(current);
for (auto &neighbor : neighbors) {
if (neighbor in closed)
continue;
}
}
return path;*/
}
}