Replaced instances of util::scoped_ptr with std::unique_ptr
This commit is contained in:
parent
1fb26d9e1c
commit
e78777caa3
10 changed files with 18 additions and 21 deletions
|
@ -24,8 +24,6 @@
|
|||
|
||||
#include "editor/map/map_context.hpp"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
namespace editor {
|
||||
|
||||
editor_action_item* editor_action_item::clone() const
|
||||
|
|
|
@ -54,7 +54,7 @@ private:
|
|||
|
||||
/// collection of units destined to be drawn but not put into the unit map
|
||||
std::deque<internal_ptr_type> fake_units_;
|
||||
display & my_display_; //!< Reference to my display. The display owns me in a scoped_ptr, so this should never be a dangling reference.
|
||||
display & my_display_; //!< Reference to my display
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -47,8 +47,8 @@ namespace gui{
|
|||
preferences::set_message_private(check_->checked());
|
||||
}
|
||||
}
|
||||
box_.assign(nullptr);
|
||||
check_.assign(nullptr);
|
||||
box_.reset(nullptr);
|
||||
check_.reset(nullptr);
|
||||
font::remove_floating_label(label_);
|
||||
mode_ = TEXTBOX_NONE;
|
||||
gui.invalidate_all();
|
||||
|
@ -113,12 +113,12 @@ namespace gui{
|
|||
mode_ = mode;
|
||||
|
||||
if(check_label != "") {
|
||||
check_.assign(new gui::button(gui.video(),check_label,gui::button::TYPE_CHECK));
|
||||
check_.reset(new gui::button(gui.video(),check_label,gui::button::TYPE_CHECK));
|
||||
check_->set_check(checked);
|
||||
}
|
||||
|
||||
|
||||
box_.assign(new gui::textbox(gui.video(),100,"",true,256,font::SIZE_PLUS,0.8,0.6));
|
||||
box_.reset(new gui::textbox(gui.video(),100,"",true,256,font::SIZE_PLUS,0.8,0.6));
|
||||
|
||||
update_location(gui);
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
// Scoped_resource can't use a pointer to an incomplete pointer with MSVC.
|
||||
#include "widgets/textbox.hpp"
|
||||
#include "scoped_resource.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
class game_display;
|
||||
|
@ -38,8 +38,8 @@ namespace gui{
|
|||
floating_textbox();
|
||||
|
||||
TEXTBOX_MODE mode() const { return mode_; }
|
||||
const util::scoped_ptr<gui::button>& check() const { return check_; }
|
||||
const util::scoped_ptr<gui::textbox>& box() const { return box_; }
|
||||
const std::unique_ptr<gui::button>& check() const { return check_; }
|
||||
const std::unique_ptr<gui::textbox>& box() const { return box_; }
|
||||
|
||||
void close(game_display& gui);
|
||||
void update_location(game_display& gui);
|
||||
|
@ -49,8 +49,8 @@ namespace gui{
|
|||
bool active() const { return box_.get() != nullptr; }
|
||||
|
||||
private:
|
||||
util::scoped_ptr<gui::textbox> box_;
|
||||
util::scoped_ptr<gui::button> check_;
|
||||
std::unique_ptr<gui::textbox> box_;
|
||||
std::unique_ptr<gui::button> check_;
|
||||
|
||||
TEXTBOX_MODE mode_;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ game_board::game_board(const game_board & other)
|
|||
game_board::~game_board() {}
|
||||
|
||||
|
||||
//TODO: Fix this so that we swap pointers to maps, and also fix replace_map to use scoped_ptr::reset.
|
||||
//TODO: Fix this so that we swap pointers to maps
|
||||
// However, then anytime gameboard is overwritten, resources::gamemap must be updated. So might want to
|
||||
// just get rid of resources::gamemap and replace with resources::gameboard->map() at that point.
|
||||
void swap(game_board & one, game_board & other) {
|
||||
|
|
|
@ -619,9 +619,9 @@ void create::hide_children(bool hide)
|
|||
filter_name_.hide(hide);
|
||||
|
||||
if (hide) {
|
||||
image_restorer_.assign(nullptr);
|
||||
image_restorer_.reset(nullptr);
|
||||
} else {
|
||||
image_restorer_.assign(new surface_restorer(&video(), image_rect_));
|
||||
image_restorer_.reset(new surface_restorer(&video(), image_rect_));
|
||||
|
||||
engine_.current_level().set_metadata();
|
||||
draw_level_image();
|
||||
|
|
|
@ -87,7 +87,7 @@ private:
|
|||
gui::textbox description_;
|
||||
gui::textbox filter_name_;
|
||||
|
||||
util::scoped_ptr<surface_restorer> image_restorer_;
|
||||
std::unique_ptr<surface_restorer> image_restorer_;
|
||||
SDL_Rect image_rect_;
|
||||
|
||||
std::vector<ng::level::TYPE> available_level_types_;
|
||||
|
|
|
@ -126,9 +126,9 @@ void gamebrowser::draw()
|
|||
return;
|
||||
if(dirty()) {
|
||||
bg_restore();
|
||||
util::scoped_ptr<clip_rect_setter> clipper(nullptr);
|
||||
std::unique_ptr<clip_rect_setter> clipper(nullptr);
|
||||
if(clip_rect())
|
||||
clipper.assign(new clip_rect_setter(video().getSurface(), clip_rect()));
|
||||
clipper.reset(new clip_rect_setter(video().getSurface(), clip_rect()));
|
||||
draw_contents();
|
||||
update_rect(location());
|
||||
set_dirty(false);
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "hotkey/hotkey_manager.hpp" // for manager
|
||||
#include "image.hpp" // for manager
|
||||
#include "saved_game.hpp" // for saved_game
|
||||
#include "scoped_resource.hpp" // for scoped_ptr
|
||||
#include "sound.hpp" // for music_thinker
|
||||
|
||||
#include <string> // for string
|
||||
|
|
|
@ -49,7 +49,7 @@ std::string random_generate_map(const std::string& parms, const config &cfg)
|
|||
//that are arguments to the generator
|
||||
std::vector<std::string> parameters = utils::split(parms, ' ');
|
||||
assert(!parameters.empty()); //we use parameters.front() in the next line.
|
||||
util::scoped_ptr<map_generator> generator(create_map_generator(parameters.front(),cfg));
|
||||
std::unique_ptr<map_generator> generator(create_map_generator(parameters.front(),cfg));
|
||||
if(generator == nullptr) {
|
||||
std::stringstream ss;
|
||||
ss << "could not find map generator '" << parameters.front() << "'";
|
||||
|
@ -66,7 +66,7 @@ config random_generate_scenario(const std::string& parms, const config &cfg)
|
|||
//that are arguments to the generator
|
||||
std::vector<std::string> parameters = utils::split(parms, ' ');
|
||||
assert(!parameters.empty()); //we use parameters.front() in the next line.
|
||||
util::scoped_ptr<map_generator> generator(create_map_generator(parameters.front(),cfg));
|
||||
std::unique_ptr<map_generator> generator(create_map_generator(parameters.front(),cfg));
|
||||
if(generator == nullptr) {
|
||||
std::stringstream ss;
|
||||
ss << "could not find map generator '" << parameters.front() << "'";
|
||||
|
|
Loading…
Add table
Reference in a new issue