mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-01 17:55:48 +00:00
updating map info
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user