updating map info

This commit is contained in:
Bluub
2021-06-18 12:14:26 +02:00
parent 4f6dd75c5d
commit 81784bf0f8
4 changed files with 16 additions and 16 deletions
+1 -1
View File
@@ -296,7 +296,7 @@ end
function Update(mapinfo)
log("NEW FRAME")
x = getMap()
PrintMap(x, 16, 16)
PrintMap(x, 17, 17)
---- sjould send Map Danger and MaxX MaxY
--MaxX = 0
--MaxY = 0
+1 -1
View File
@@ -8,7 +8,7 @@
namespace BBM
{
LuaMap::LuaMap()
: _map(16, std::vector<int>(16, 0)), _danger(16, std::vector<int>(16, 0))
: _map(17, std::vector<int>(17, 0)), _danger(17, std::vector<int>(17, 0))
{
}
+10 -10
View File
@@ -29,13 +29,13 @@ namespace BBM
const LuaMap *map = (const LuaMap *) lua_topointer(L, lua_upvalueindex(1));
lua_newtable(L);
for (int i = 0; i < 16; i++) {
lua_pushnumber(L, index++);
for (int i = 0; i < 17; i++) {
lua_pushinteger(L, index++);
lua_newtable(L);
int indexrow = 1;
for (int j = 0; j < 16; j++) {
lua_pushnumber(L, indexrow++);
lua_pushnumber(L, map->_map[i][j]);
for (int j = 0; j < 17; j++) {
lua_pushinteger(L, indexrow++);
lua_pushinteger(L, map->_map[i][j]);
lua_settable(L, -3);
}
lua_settable(L, -3);
@@ -50,13 +50,13 @@ namespace BBM
const LuaMap *map = (const LuaMap *) lua_topointer(L, lua_upvalueindex(1));
lua_newtable(L);
for (int i = 0; i < 16; i++) {
lua_pushnumber(L, index++);
for (int i = 0; i < 17; i++) {
lua_pushinteger(L, index++);
lua_newtable(L);
int indexrow = 1;
for (int j = 0; j < 16; j++) {
lua_pushnumber(L, indexrow++);
lua_pushnumber(L, map->_danger[i][j]);
for (int j = 0; j < 17; j++) {
lua_pushinteger(L, indexrow++);
lua_pushinteger(L, map->_danger[i][j]);
lua_settable(L, -3);
}
lua_settable(L, -3);
@@ -28,13 +28,13 @@ namespace BBM
if (_cached)
return;
for (auto &[other, pos, _] : _wal.getScene()->view<PositionComponent, TagComponent<Breakable>>())
_map.push_back(MapInfo(pos.position, MapGenerator::BREAKABLE));
_luamap._map[pos.position.z][pos.position.x] = MapGenerator::BREAKABLE;
for (auto &[other, pos, _] : _wal.getScene()->view<PositionComponent, TagComponent<Unbreakable>>())
_map.push_back(MapInfo(pos.position, MapGenerator::UNBREAKABLE));
_luamap._map[pos.position.z][pos.position.x] = MapGenerator::UNBREAKABLE;
for (auto &[other, pos, _] : _wal.getScene()->view<PositionComponent, TagComponent<Bumper>>())
_map.push_back(MapInfo(pos.position, MapGenerator::BUMPER));
_luamap._map[pos.position.z][pos.position.x] = MapGenerator::BUMPER;
for (auto &[other, pos, _] : _wal.getScene()->view<PositionComponent, TagComponent<Hole>>())
_map.push_back(MapInfo(pos.position, MapGenerator::HOLE));
_luamap._map[pos.position.z][pos.position.x] = MapGenerator::HOLE;
for (auto &[other, pos, bomb, timer] : _wal.getScene()->view<PositionComponent, BasicBombComponent, TimerComponent>())
_bombs.push_back(std::make_tuple(pos.position, bomb.explosionRadius, timer.ringIn));
_cached = true;