private void updateTilemapUsingWallmap(Tilemap p_tilemap, Tilemap p_wallMap, Tilemap p_roadMap, WallMapper p_wallMapper) { for (int y = 0; y < p_wallMap.getRows(); y++) { for (int x = 0; x < p_wallMap.getColumns(); x++) { if (p_wallMap.getState(x, y) >= 0) { p_tilemap.setState(x, y, p_wallMapper.getContactType(x, y, p_roadMap)); } } } }
private void updateTilemapUsingRoadmap(Tilemap p_tilemap, Tilemap p_roadMap, RoadMapper p_roadMapper) { for (int y = 0; y < p_roadMap.getRows(); y++) { for (int x = 0; x < p_roadMap.getColumns(); x++) { if (p_roadMap.getState(x, y) >= 0) { p_tilemap.setState(x, y, p_roadMapper.getContactType(x, y, p_roadMap)); } else if (p_roadMap.getState(x, y) == -1) { p_tilemap.setState(x, y, 31); } } } }
private void updateTilemapUsingSingles(Tilemap p_mainTilemap, Tilemap p_singlesTilemap) { for (int y = 0; y < p_mainTilemap.getRows(); y++) { for (int x = 0; x < p_mainTilemap.getColumns(); x++) { if (p_singlesTilemap.getState(x, y) >= 0) { p_mainTilemap.setState(x, y, p_singlesTilemap.getState(x, y)); } } } }
private void generateWallmapFromRoadmap(Tilemap p_wallMap, Tilemap p_roadMap) { p_wallMap.clear(); // Sweep adding walls for (int y = 0; y < p_roadMap.getRows(); y++) { for (int x = 0; x < p_roadMap.getColumns(); x++) { if (p_roadMap.getState(x, y) >= 0) { p_wallMap.setState(x - 1, y - 1, 1); p_wallMap.setState(x, y - 1, 1); p_wallMap.setState(x + 1, y - 1, 1); p_wallMap.setState(x + 1, y, 1); p_wallMap.setState(x + 1, y + 1, 1); p_wallMap.setState(x, y + 1, 1); p_wallMap.setState(x - 1, y + 1, 1); p_wallMap.setState(x - 1, y, 1); } } } // Sweep removing on roads for (int y = 0; y < p_roadMap.getRows(); y++) { for (int x = 0; x < p_roadMap.getColumns(); x++) { if (p_roadMap.getState(x, y) >= 0) { p_wallMap.setState(x, y, -1); } } } }