remove debug log and better hash operator

This commit is contained in:
Bluub
2021-06-19 20:08:56 +02:00
parent 6e7e0133c3
commit 6342c6bce7
3 changed files with 19 additions and 20 deletions
+12 -12
View File
@@ -108,9 +108,9 @@ end
function getPathToSafeSpace(player)
local res = getClosestSafeSpace()
print("run to")
print(res.x)
print(res.y)
log("run to")
log(res.x)
log(res.y)
local p = {player}
table.insert(p, res)
@@ -137,26 +137,26 @@ function Update()
end
end
print("player")
print(player.x)
print(player.y)
log("player")
log(player.x)
log(player.y)
local player = getPlayerRound();
if getDangerLevelPlayer() then
print("INDANGER")
log("INDANGER")
local dangerMap = getDanger()
PrintMap(dangerMap, 17, 17)
local path = getPathToSafeSpace(player)
if #path >= 2 then
print("path found")
log("path found")
for i, c in ipairs(path) do
print(i)
print(c.x)
print(c.y)
log(i)
log(c.x)
log(c.y)
end
LastTarget = {x = path[2].x, y = path[2].y}
return path[2].x - player.x, path[2].y - player.y, false, false
end
print("nopath found")
log("nopath found")
return 0, 0, false, false
end
local y = math.random(4)
-7
View File
@@ -370,14 +370,7 @@ namespace BBM
break;
newDangerMap[pos.y][pos.x] = 3;
}
for (int i = 0; i < 17; i++) {
for (int j = 0; j < 17; j++) {
std::cout << newDangerMap[i][j] << " | ";
}
std::cout << std::endl;
}
Vector2f res = map->findSafeSpace(newDangerMap);
std::cout << "res: " << res << std::endl;
lua_pushboolean(L, map->_roundedPlayer != res);
return 1;
}
+7 -1
View File
@@ -101,7 +101,13 @@ namespace std
typedef std::size_t result_type;
result_type operator()(argument_type const &in) const
{
return in.x + in.y;
union {
float vector[2];
result_type hashed;
} hasher;
hasher.vector[0] = in.x;
hasher.vector[1] = in.y;
return hasher.hashed;
}
};
}