public void removeTile(int x, int y, int z) { QTreeNode leaf = root.getLeafForce(x, y); Floor floor = leaf.createFloor(z); int offsetX = x & 3; int offsetY = y & 3; floor.tiles[offsetX * 4 + offsetY] = null; }
public void setTile(int x, int y, int z, Tile newtile, bool remove = false) { QTreeNode leaf = root.getLeafForce(x, y); Floor floor = leaf.createFloor(z); int offsetX = x & 3; int offsetY = y & 3; Tile tile = floor.tiles[offsetX * 4 + offsetY]; if (newtile != null) { if (tile != null) { newtile.stealExits(tile); //newtile->spawn_count = tile->spawn_count; //newtile->spawn = tile->spawn; } else { tilecount++; } } else if (tile != null) { if ((tile.spawn_count != 0) || tile.isHouseExit()) { newtile = new Tile(x, y, z); newtile.stealExits(tile); newtile.spawn_count = tile.spawn_count; newtile.waypoint_count = tile.waypoint_count; //newtile->spawn = tile->spawn; } else { tilecount--; } } if (remove) { tile = null; } floor.tiles[offsetX * 4 + offsetY] = newtile; }
public Tile swapTile(int x, int y, int z, Tile newtile) { QTreeNode leaf = root.getLeafForce(x, y); Floor floor = leaf.createFloor(z); int offset_x = x & 3; int offset_y = y & 3; Tile tile = floor.tiles[offset_x * 4 + offset_y]; if (newtile != null) { if (tile == null) { ++tilecount; } else { newtile.stealExits(tile); newtile.spawn_count = tile.spawn_count; newtile.waypoint_count = tile.waypoint_count; //newtile->spawn = tile->spawn; } } else if (tile != null) { if ((tile.spawn_count != 0) || tile.isHouseExit()) { newtile = new Tile(x, y, z); newtile.stealExits(tile); newtile.spawn_count = tile.spawn_count; newtile.waypoint_count = tile.waypoint_count; //newtile->spawn = tile->spawn; } else { --tilecount; } } Tile oldtile = tile; floor.tiles[offset_x * 4 + offset_y] = newtile; return(oldtile); }