diff --git a/source/code/MenuSystem.cpp b/source/code/MenuSystem.cpp index bb9bc78..faa623d 100644 --- a/source/code/MenuSystem.cpp +++ b/source/code/MenuSystem.cpp @@ -69,11 +69,14 @@ Button::Button() { Button::~Button() { } -Button::Button(const Button& b) { - label = b.label; - marked = b.marked; - action = b.action; - popOnRun = false; +Button::Button(const Button& b) : action{b.action}, label{b.label}, marked{b.marked} { +} + +Button& Button::operator=(const Button& other) { + action = other.action; + label = other.label; + marked = other.marked; + return *this; } void Button::setLabel(const std::string& text) { @@ -169,11 +172,10 @@ Menu::Menu(SDL_Renderer* screen,bool submenu) { } } -Menu::Menu(SDL_Renderer* screen, const std::string& title, bool submenu) { +Menu::Menu(SDL_Renderer* screen, const std::string& title, bool submenu) : title{title} { this->screen = screen; buttons = std::vector(0); isSubmenu = submenu; - this->title = title; if (isSubmenu) { exit.setLabel(_("Back") ); } diff --git a/source/code/MenuSystem.h b/source/code/MenuSystem.h index cf3016f..024bf3a 100644 --- a/source/code/MenuSystem.h +++ b/source/code/MenuSystem.h @@ -69,6 +69,7 @@ public: Button(); Button(const Button& b); + Button& operator=(const Button& other); virtual ~Button();