diff --git a/gui/map_view.cpp b/gui/map_view.cpp index c583ceb..ac65a87 100644 --- a/gui/map_view.cpp +++ b/gui/map_view.cpp @@ -46,23 +46,21 @@ namespace gui { } void MapViewUI::render(sf::RenderWindow &window, int compass_dir) { + (void)compass_dir; window.draw(*$paper.sprite); auto grid = $gui.entity("map_grid"); - - std::wstring map_out = System::draw_map($level, 23, 9, compass_dir); - + // System::draw_map auto& map_text = $gui.get(grid); - map_text.update(map_out); + map_text.update(L"MAP BROKEN"); $gui.render(window); // $gui.debug_layout(window); } void MapViewUI::save_map(const std::string& outfile, int compass_dir) { - std::wstring map_out = System::draw_map( - $level, $level.map->width(), $level.map->height(), compass_dir); - dbc::check(map_out.size() > 0, "WHAT? printed map has nothing in it."); + (void)compass_dir; + std::wstring map_out = L"I'M BROKEN"; std::wofstream out(outfile, std::ios::binary); std::locale loc(std::locale::classic(), new std::codecvt_utf8); diff --git a/gui/mini_map.cpp b/gui/mini_map.cpp index 41e21b2..af4702a 100644 --- a/gui/mini_map.cpp +++ b/gui/mini_map.cpp @@ -32,8 +32,8 @@ namespace gui { } void MiniMapUI::render(sf::RenderWindow &window, int compass_dir) { - std::wstring map_out = System::draw_map($level, 5, 3, compass_dir); - $map_grid.update(map_out); + (void)compass_dir; + $map_grid.update(L"I'M BROKEN"); window.draw(*$map_grid.text); } } diff --git a/systems.cpp b/systems.cpp index d12be28..7e012dd 100644 --- a/systems.cpp +++ b/systems.cpp @@ -407,22 +407,17 @@ void System::plan_motion(World& world, Position move_to) { motion.dy = move_to.location.y - player_position.location.y; } -/* - * This one is called inside the MapViewUI very often so - * just avoid GameMap unlike the others. - */ -std::wstring System::draw_map(GameLevel& level, size_t view_x, size_t view_y, int compass_dir) { +void System::draw_map(GameLevel& level, Matrix& grid, int compass_dir) { World &world = *level.world; Map &map = *level.map; + size_t view_x = matrix::width(grid); + size_t view_y = matrix::height(grid); auto player_pos = world.get(level.player).location; Point cam_orig = map.center_camera(player_pos, view_x, view_y); auto &tiles = map.tiles(); auto &tile_set = textures::get_map_tile_set(); - // make a grid of chars to work with - auto grid = shiterator::make(view_x+1, view_y+1); - // first fill it with the map cells for(shiterator::each_cell_t it{grid}; it.next();) { size_t tile_y = size_t(it.y) + cam_orig.y; @@ -449,16 +444,6 @@ std::wstring System::draw_map(GameLevel& level, size_t view_x, size_t view_y, in } } }); - - // then generate the string to display, but this goes away soon - std::wstring result; - - for(shiterator::each_row_t it{grid}; it.next();) { - result += grid[it.y][it.x]; - if(it.row) result += '\n'; - } - - return result; } void System::player_status(GameLevel &level) { diff --git a/systems.hpp b/systems.hpp index 8df352e..564efb8 100644 --- a/systems.hpp +++ b/systems.hpp @@ -19,7 +19,7 @@ namespace System { void init_positions(World &world, SpatialMap &collider); void device(World &world, Entity actor, Entity item); void plan_motion(World& world, Position move_to); - std::wstring draw_map(GameLevel& level, size_t view_x, size_t view_y, int compass_dir); + void draw_map(GameLevel& level, Matrix& grid, int compass_dir); Entity spawn_item(World& world, const string& name); bool drop_item(GameLevel& level, Entity item);