GUI2/Minimap: don't keep copy of map data

This commit is contained in:
Charles Dang 2024-02-21 00:16:24 -05:00
parent 2b9f999142
commit 2be50eac14
2 changed files with 1 additions and 20 deletions

View file

@ -52,7 +52,6 @@ REGISTER_WIDGET(minimap)
minimap::minimap(const implementation::builder_minimap& builder)
: styled_widget(builder, type())
, map_data_()
{
}
@ -78,15 +77,10 @@ bool minimap::disable_click_dismiss() const
void minimap::set_map_data(const std::string& map_data)
{
if(map_data == map_data_) {
return;
}
map_data_ = map_data;
queue_redraw();
try {
map_ = std::make_unique<gamemap>(map_data_);
map_ = std::make_unique<gamemap>(map_data);
} catch(const incorrect_map_format_error& e) {
map_.reset(nullptr);
ERR_CF << "Error while loading the map: " << e.message;

View file

@ -65,20 +65,7 @@ public:
void set_map_data(const std::string& map_data);
std::string get_map_data() const
{
return map_data_;
}
const std::string& map_data() const
{
return map_data_;
}
private:
/** The map data to be used to generate the map. */
std::string map_data_;
/** Game map generated from the provided data. */
std::unique_ptr<gamemap> map_;