mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-02 18:21:12 +00:00
remove debug log and better hash operator
This commit is contained in:
+12
-12
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user