diff options
Diffstat (limited to 'src')
57 files changed, 48 insertions, 392 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index d5972741..a8f0dce5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,6 +36,8 @@ tmw_SOURCES = graphic/spriteset.cpp \ gui/error.h \ gui/focushandler.cpp \ gui/focushandler.h \ + gui/gccontainer.cpp \ + gui/gccontainer.h \ gui/gui.cpp \ gui/gui.h \ gui/help.cpp \ diff --git a/src/gui/buddywindow.cpp b/src/gui/buddywindow.cpp index 0fec4e8c..8d4c246e 100644 --- a/src/gui/buddywindow.cpp +++ b/src/gui/buddywindow.cpp @@ -65,10 +65,6 @@ BuddyWindow::BuddyWindow(): BuddyWindow::~BuddyWindow() { delete listbox; - delete scrollArea; - delete talk; - delete remove; - delete cancel; } void BuddyWindow::action(const std::string& eventId) diff --git a/src/gui/buddywindow.h b/src/gui/buddywindow.h index 5526e13f..32dd2da2 100644 --- a/src/gui/buddywindow.h +++ b/src/gui/buddywindow.h @@ -47,7 +47,7 @@ class BuddyWindow : public Window, public BuddyList, BuddyWindow(); /** - * Destructor. + * Destructor */ ~BuddyWindow(); diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index f918d45a..4414a755 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -116,17 +116,7 @@ BuyDialog::BuyDialog(): BuyDialog::~BuyDialog() { - delete increaseButton; - delete decreaseButton; - delete quitButton; - delete buyButton; - delete slider; delete itemList; - delete scrollArea; - delete moneyLabel; - delete quantityLabel; - delete itemDescLabel; - delete itemEffectLabel; } void BuyDialog::setMoney(int amount) diff --git a/src/gui/buy.h b/src/gui/buy.h index d66a720a..341989c9 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -29,12 +29,11 @@ #include <guichan/actionlistener.hpp> #include <guichan/listmodel.hpp> +#include "shop.h" #include "window.h" #include "../guichanfwd.h" -struct ITEM_SHOP; - /** * The buy dialog. * diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index 627d119f..178c2719 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -61,13 +61,6 @@ BuySellDialog::BuySellDialog(): buyButton->requestFocus(); } -BuySellDialog::~BuySellDialog() -{ - delete buyButton; - delete sellButton; - delete cancelButton; -} - void BuySellDialog::action(const std::string& eventId) { int actionId = -1; diff --git a/src/gui/buysell.h b/src/gui/buysell.h index f1c81b60..fad7e83d 100644 --- a/src/gui/buysell.h +++ b/src/gui/buysell.h @@ -47,11 +47,6 @@ class BuySellDialog : public Window, public gcn::ActionListener BuySellDialog(); /** - * Destructor. - */ - ~BuySellDialog(); - - /** * Called when receiving actions from the widgets. */ void action(const std::string& eventId); diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index a22a25de..0123251b 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -119,19 +119,6 @@ CharSelectDialog::CharSelectDialog(): setPlayerInfo(NULL); } -CharSelectDialog::~CharSelectDialog() -{ - delete selectButton; - delete cancelButton; - delete newCharButton; - delete delCharButton; - delete nameLabel; - delete levelLabel; - delete jobLevelLabel; - delete moneyLabel; - delete playerBox; -} - void CharSelectDialog::action(const std::string& eventId) { if (eventId == "ok" && n_character > 0) { diff --git a/src/gui/char_select.h b/src/gui/char_select.h index 3751a440..d36904d3 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.h @@ -47,11 +47,6 @@ class CharSelectDialog : public Window, public gcn::ActionListener */ CharSelectDialog(); - /** - * Destructor. - */ - ~CharSelectDialog(); - void action(const std::string& eventId); void setPlayerInfo(PLAYER_INFO* pi); diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index 4135d9c5..37e7d56f 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -96,9 +96,6 @@ ServerSelectDialog::~ServerSelectDialog() { delete serverList; delete serverListModel; - delete scrollArea; - delete okButton; - delete cancelButton; } void ServerSelectDialog::action(const std::string& eventId) diff --git a/src/gui/char_server.h b/src/gui/char_server.h index f07b2f53..f81c387b 100644 --- a/src/gui/char_server.h +++ b/src/gui/char_server.h @@ -58,7 +58,7 @@ class ServerSelectDialog : public Window, public gcn::ActionListener { ServerSelectDialog(); /** - * Destructor + * Destructor. */ ~ServerSelectDialog(); @@ -66,7 +66,7 @@ class ServerSelectDialog : public Window, public gcn::ActionListener { * Called when receiving actions from the widgets. */ void action(const std::string& eventId); - + /** * Updates dialog logic */ @@ -79,7 +79,7 @@ class ServerSelectDialog : public Window, public gcn::ActionListener { gcn::Button *cancelButton; gcn::ScrollArea *scrollArea; int mStatus; - + void selectServer(int index); }; diff --git a/src/gui/chargedialog.cpp b/src/gui/chargedialog.cpp index e456810f..4ef28e16 100644 --- a/src/gui/chargedialog.cpp +++ b/src/gui/chargedialog.cpp @@ -38,11 +38,6 @@ ChargeDialog::ChargeDialog(): add(progBar); } -ChargeDialog::~ChargeDialog() -{ - delete progBar; -} - // update the dialog void ChargeDialog::logic() { diff --git a/src/gui/chargedialog.h b/src/gui/chargedialog.h index 8a4f9b04..4d38f0e2 100644 --- a/src/gui/chargedialog.h +++ b/src/gui/chargedialog.h @@ -42,11 +42,6 @@ class ChargeDialog : public Window */ ChargeDialog(); - /** - * Destructor. - */ - ~ChargeDialog(); - void logic(); private: diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 20deb1a7..2050745e 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -77,9 +77,7 @@ ChatWindow::ChatWindow(const std::string &logfile): ChatWindow::~ChatWindow() { - delete chatInput; delete textOutput; - delete scrollArea; chatlog_file.flush(); chatlog_file.close(); diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp index 75553f58..7e1ef983 100644 --- a/src/gui/confirm_dialog.cpp +++ b/src/gui/confirm_dialog.cpp @@ -86,13 +86,6 @@ void ConfirmDialog::init(const std::string &msg, gcn::ActionListener *listener) yesButton->requestFocus(); } -ConfirmDialog::~ConfirmDialog() -{ - delete userLabel; - delete yesButton; - delete noButton; -} - void ConfirmDialog::action(const std::string &eventId) { if (eventId == "yes" || eventId == "no") { diff --git a/src/gui/confirm_dialog.h b/src/gui/confirm_dialog.h index 457cd748..fd31b389 100644 --- a/src/gui/confirm_dialog.h +++ b/src/gui/confirm_dialog.h @@ -56,11 +56,6 @@ class ConfirmDialog : public Window, public gcn::ActionListener { gcn::ActionListener *listener = NULL); /** - * Destructor. - */ - ~ConfirmDialog(); - - /** * Called when receiving actions from the widgets. */ void action(const std::string& eventId); diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp index ecb98aee..012bf444 100644 --- a/src/gui/connection.cpp +++ b/src/gui/connection.cpp @@ -59,10 +59,6 @@ ConnectionDialog::ConnectionDialog(): openConnection(host, map_port); } -ConnectionDialog::~ConnectionDialog() -{ -} - void ConnectionDialog::logic() { mProgress += 0.005f; diff --git a/src/gui/connection.h b/src/gui/connection.h index fe416ddc..1686668a 100644 --- a/src/gui/connection.h +++ b/src/gui/connection.h @@ -50,11 +50,6 @@ class ConnectionDialog : public Window, public gcn::ActionListener { ConnectionDialog(); /** - * Destructor - */ - ~ConnectionDialog(); - - /** * Called when receiving actions from the widgets. */ void action(const std::string& eventId); diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 2c125c62..1ffae37f 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -66,15 +66,6 @@ DebugWindow::DebugWindow(): add(closeButton); } -DebugWindow::~DebugWindow() -{ - delete FPSLabel; - delete musicFileLabel; - delete mapFileLabel; - delete tileMouseLabel; - delete closeButton; -} - void DebugWindow::logic() { diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h index 5949cc78..ec60cb13 100644 --- a/src/gui/debugwindow.h +++ b/src/gui/debugwindow.h @@ -47,11 +47,6 @@ class DebugWindow : public Window, public gcn::ActionListener DebugWindow(); /** - * Destructor. - */ - ~DebugWindow(); - - /** * Logic (updates components' size and infos) */ void logic(); diff --git a/src/gui/error.h b/src/gui/error.h index d85b9269..9eb0cbde 100644 --- a/src/gui/error.h +++ b/src/gui/error.h @@ -25,11 +25,9 @@ #define _TMW_ERROR_H #include <iosfwd> -#include <guichan/actionlistener.hpp> #include <SDL_events.h> #include "ok_dialog.h" -#include "../guichanfwd.h" /** * The error dialog. diff --git a/src/gui/hbox.cpp b/src/gui/hbox.cpp index 0192eb67..69564fbb 100644 --- a/src/gui/hbox.cpp +++ b/src/gui/hbox.cpp @@ -23,26 +23,17 @@ #include "hbox.h" -HBox::HBox() - : Box() -{ -} - -HBox::~HBox() -{ -} - void HBox::draw(gcn::Graphics *graphics) { int widgetCount = mWidgets.size(); int childHeight = getHeight(); if (widgetCount == 0) - return; + return; int childWidth = getWidth() / widgetCount; int i = 0; for (WidgetIterator w = mWidgets.begin(); w != mWidgets.end(); w++) { - (*w)->setPosition(childWidth * i - padding, 0); + (*w)->setPosition(childWidth * i - padding, 0); (*w)->setSize(childWidth, childHeight); i++; } diff --git a/src/gui/hbox.h b/src/gui/hbox.h index 9d3fd7a5..560b1a29 100644 --- a/src/gui/hbox.h +++ b/src/gui/hbox.h @@ -29,8 +29,6 @@ class HBox : public Box { public: - HBox(); - ~HBox(); void draw(gcn::Graphics *); }; diff --git a/src/gui/help.cpp b/src/gui/help.cpp index 71e94340..45ed7ba4 100644 --- a/src/gui/help.cpp +++ b/src/gui/help.cpp @@ -63,8 +63,6 @@ HelpWindow::HelpWindow(): HelpWindow::~HelpWindow() { delete browserBox; - delete okButton; - delete scrollArea; } void HelpWindow::action(const std::string& eventId) diff --git a/src/gui/inttextbox.cpp b/src/gui/inttextbox.cpp index 1f26433d..be819de3 100644 --- a/src/gui/inttextbox.cpp +++ b/src/gui/inttextbox.cpp @@ -27,11 +27,6 @@ #include <guichan/key.hpp> -IntTextBox::IntTextBox(): - value(0) -{ -} - IntTextBox::IntTextBox(int i): value(i) { diff --git a/src/gui/inttextbox.h b/src/gui/inttextbox.h index e3517c62..580788f4 100644 --- a/src/gui/inttextbox.h +++ b/src/gui/inttextbox.h @@ -33,14 +33,9 @@ class IntTextBox : public TextBox { public: /** - * Constructor. - */ - IntTextBox(); - - /** * Constructor, sets initial value. */ - IntTextBox(int value); + IntTextBox(int value=0); /** * Sets the minimum and maximum values of the text box. diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 9012b8ee..62a0be4b 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -90,14 +90,7 @@ InventoryWindow::InventoryWindow(): InventoryWindow::~InventoryWindow() { - delete useButton; - delete dropButton; - delete invenScroll; delete items; - delete itemNameLabel; - delete itemDescriptionLabel; - delete itemEffectLabel; - delete weightLabel; } void InventoryWindow::logic() diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp index b313b98c..4620ed81 100644 --- a/src/gui/item_amount.cpp +++ b/src/gui/item_amount.cpp @@ -99,16 +99,6 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item): setLocationRelativeTo(getParentWindow()); } -ItemAmountWindow::~ItemAmountWindow() -{ - delete mItemAmountTextBox; - delete mItemAmountPlusButton; - delete mItemAmountMinusButton; - delete mItemAmountSlide; - delete mItemAmountOkButton; - delete mItemAmountCancelButton; -} - void ItemAmountWindow::resetAmount() { mItemAmountTextBox->setInt(1); diff --git a/src/gui/item_amount.h b/src/gui/item_amount.h index 8c5260bf..f7e466fb 100644 --- a/src/gui/item_amount.h +++ b/src/gui/item_amount.h @@ -52,11 +52,6 @@ class ItemAmountWindow : public Window, public gcn::ActionListener ItemAmountWindow(int usage, Window *parent, Item *item); /** - * Destructor. - */ - virtual ~ItemAmountWindow(); - - /** * Called when receiving actions from widget. */ void action(const std::string& eventId); diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 4f08216b..e6df01da 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -169,20 +169,6 @@ LoginDialog::LoginDialog(): wrongPasswordNoticeListener.setLoginDialog(this); } -LoginDialog::~LoginDialog() -{ - delete userLabel; - delete passLabel; - delete serverLabel; - delete userField; - delete passField; - delete serverField; - delete keepCheck; - delete okButton; - delete cancelButton; - delete registerButton; -} - void LoginDialog::action(const std::string& eventId) { diff --git a/src/gui/login.h b/src/gui/login.h index ae3e8a0f..f4966914 100644 --- a/src/gui/login.h +++ b/src/gui/login.h @@ -46,15 +46,10 @@ class LoginDialog : public Window, public gcn::ActionListener { LoginDialog(); /** - * Destructor - */ - ~LoginDialog(); - - /** * Called when receiving actions from the widgets. */ void action(const std::string& eventId); - + /** * Updates dialog logic. */ diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp index 280339a1..21498468 100644 --- a/src/gui/menuwindow.cpp +++ b/src/gui/menuwindow.cpp @@ -83,15 +83,6 @@ MenuWindow::MenuWindow(): (setupButton->getY() + setupButton->getHeight())); } -MenuWindow::~MenuWindow() -{ - delete statusButton; - delete equipmentButton; - delete skillsButton; - delete inventoryButton; - delete setupButton; -} - void MenuWindow::draw(gcn::Graphics *g) { Window::drawContent(g); diff --git a/src/gui/menuwindow.h b/src/gui/menuwindow.h index dc035c80..0585748d 100644 --- a/src/gui/menuwindow.h +++ b/src/gui/menuwindow.h @@ -44,11 +44,6 @@ class MenuWindow : public Window, public gcn::ActionListener { */ MenuWindow(); - /** - * Destructor. - */ - ~MenuWindow(); - /** * Called when receiving actions from widget. */ diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp index 9d423a7e..6820d561 100644 --- a/src/gui/ministatus.cpp +++ b/src/gui/ministatus.cpp @@ -64,14 +64,6 @@ MiniStatusWindow::MiniStatusWindow(): mpBar->getY() + mpBar->getHeight()); } -MiniStatusWindow::~MiniStatusWindow() -{ - delete hpBar; - delete mpBar; - delete hpLabel; - delete mpLabel; -} - void MiniStatusWindow::update() { // HP Bar coloration diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h index 07aa5d4a..0c6a5ef1 100644 --- a/src/gui/ministatus.h +++ b/src/gui/ministatus.h @@ -48,11 +48,6 @@ class MiniStatusWindow : public Window, public gcn::ActionListener { MiniStatusWindow(); /** - * Destructor. - */ - ~MiniStatusWindow(); - - /** * Draw this window */ void draw(gcn::Graphics *graphics); diff --git a/src/gui/newskill.cpp b/src/gui/newskill.cpp index ec080d81..0baf81a5 100644 --- a/src/gui/newskill.cpp +++ b/src/gui/newskill.cpp @@ -168,21 +168,6 @@ NewSkillDialog::NewSkillDialog(): setLocationRelativeTo(getParent()); } -NewSkillDialog::~NewSkillDialog() -{ - for (int i = 0; i < N_SKILL_CAT_SIZE; i++) - { - delete skillbar[i]; - delete skillLabel[i]; - delete skillLevel[i]; - } - for (int i = 0; i < N_SKILL_CAT; i++) - { - delete catButton[i]; - } - delete closeButton; -} - void NewSkillDialog::action(const std::string& eventId) { int osp = startPoint; diff --git a/src/gui/newskill.h b/src/gui/newskill.h index afcd0eec..58948729 100644 --- a/src/gui/newskill.h +++ b/src/gui/newskill.h @@ -48,7 +48,18 @@ struct nSkill { */ class NewSkillDialog : public Window, public gcn::ActionListener { + public: + /** + * Constructor. + */ + NewSkillDialog(); + + // action listener + void action(const std::string&); + private: + void resetNSD(); // updates the values in the dialog box + // members int startPoint; // starting point of skill listing ProgressBar *skillbar[N_SKILL_CAT_SIZE]; @@ -57,22 +68,6 @@ class NewSkillDialog : public Window, public gcn::ActionListener gcn::Button *catButton[N_SKILL_CAT]; gcn::Button *closeButton; nSkill playerSkill[N_SKILL]; // pointer to an array of skill values - - void resetNSD(); // updates the values in the dialog box - - public: - /** - * Constructor. - */ - NewSkillDialog(); - - /** - * Destructor. - */ - ~NewSkillDialog(); - - // action listener - void action(const std::string&); }; #endif diff --git a/src/gui/npc.cpp b/src/gui/npc.cpp index 68856705..2729d816 100644 --- a/src/gui/npc.cpp +++ b/src/gui/npc.cpp @@ -68,10 +68,7 @@ NpcListDialog::NpcListDialog(): NpcListDialog::~NpcListDialog() { - delete okButton; - delete cancelButton; delete itemList; - delete scrollArea; } int diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp index 5f5ea9cb..12032850 100644 --- a/src/gui/npc_text.cpp +++ b/src/gui/npc_text.cpp @@ -60,9 +60,7 @@ NpcTextDialog::NpcTextDialog(): NpcTextDialog::~NpcTextDialog() { - delete okButton; delete textBox; - delete scrollArea; } void diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp index 0089f0ae..8984c213 100644 --- a/src/gui/ok_dialog.cpp +++ b/src/gui/ok_dialog.cpp @@ -42,6 +42,10 @@ OkDialog::OkDialog(Window *parent, const std::string &title, init(msg, listener); } +OkDialog::~OkDialog() +{ +} + void OkDialog::init(const std::string &msg, gcn::ActionListener *listener) { userLabel = new gcn::Label(msg); @@ -72,12 +76,6 @@ void OkDialog::init(const std::string &msg, gcn::ActionListener *listener) okButton->requestFocus(); } -OkDialog::~OkDialog() -{ - delete userLabel; - delete okButton; -} - void OkDialog::action(const std::string &eventId) { if (eventId == "ok") { diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index e6d3b402..b1046553 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -67,11 +67,6 @@ PopupMenu::PopupMenu(): browserBox->setLinkHandler(this); } -PopupMenu::~PopupMenu() -{ - delete browserBox; -} - void PopupMenu::showPopup(int x, int y, Being *being) { mBeing = being; diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h index 0cd6225c..97cadf38 100644 --- a/src/gui/popupmenu.h +++ b/src/gui/popupmenu.h @@ -45,11 +45,6 @@ class PopupMenu : public Window, public LinkHandler PopupMenu(); /** - * Destructor. - */ - ~PopupMenu(); - - /** * Shows the being related popup menu at the specified mouse coords. */ void showPopup(int x, int y, Being *being); diff --git a/src/gui/requesttrade.cpp b/src/gui/requesttrade.cpp index 6c7ef2ce..075567af 100644 --- a/src/gui/requesttrade.cpp +++ b/src/gui/requesttrade.cpp @@ -75,15 +75,6 @@ RequestTradeDialog::RequestTradeDialog(const std::string &name): setLocationRelativeTo(getParent()); } -RequestTradeDialog::~RequestTradeDialog() -{ - delete acceptButton; - delete cancelButton; - for (int i = 0; i < 2; i++) { - delete nameLabel[i]; - } -} - void RequestTradeDialog::action(const std::string& eventId) { int choice = 4; // 4 means trade canceled diff --git a/src/gui/requesttrade.h b/src/gui/requesttrade.h index 4cd33a49..706b0b0e 100644 --- a/src/gui/requesttrade.h +++ b/src/gui/requesttrade.h @@ -48,11 +48,6 @@ class RequestTradeDialog : public Window, public gcn::ActionListener RequestTradeDialog(const std::string &name); /** - * Destructor. - */ - ~RequestTradeDialog(); - - /** * Called when receiving actions from the widgets. */ void action(const std::string& eventId); diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index a147fa44..7245c692 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -118,17 +118,7 @@ SellDialog::SellDialog(): SellDialog::~SellDialog() { - delete increaseButton; - delete decreaseButton; - delete quitButton; - delete sellButton; - delete slider; delete itemList; - delete scrollArea; - delete quantityLabel; - delete moneyLabel; - delete itemDescLabel; - delete itemEffectLabel; } void SellDialog::reset() diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index da56f9aa..30d95dcc 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -213,24 +213,8 @@ Setup::Setup(): Setup::~Setup() { - delete videoLabel; delete modeListModel; delete modeList; - delete scrollArea; - delete fsCheckBox; - delete openGLCheckBox; - delete customCursorCheckBox; - delete soundCheckBox; - delete audioLabel; - delete resetWinsToDefault; - delete applyButton; - delete cancelButton; - delete alphaSlider; - delete alphaLabel; - delete sfxSlider; - delete musicSlider; - delete sfxLabel; - delete musicLabel; } void Setup::action(const std::string &eventId) diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index c2e09819..72790f6a 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -111,17 +111,12 @@ SkillDialog::SkillDialog(): SkillDialog::~SkillDialog() { delete skillListBox; - delete skillScrollArea; - delete pointsLabel; - delete incButton; - delete closeButton; - delete useButton; for (int i = skillList.size() - 1; i >= 0; i--) { delete skillList[i]; - skillList.pop_back(); } + skillList.clear(); } void SkillDialog::action(const std::string& eventId) diff --git a/src/gui/status.cpp b/src/gui/status.cpp index 10b6431d..43456a29 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -215,54 +215,6 @@ StatusWindow::StatusWindow(): add(remainingStatsPointsLabel); } -StatusWindow::~StatusWindow() -{ - // Status Part - delete lvlLabel; - delete gpLabel; - delete hpLabel; - delete hpValueLabel; - delete mpLabel; - delete mpValueLabel; - delete xpLabel; - delete xpValueLabel; - delete jobXpLabel; - delete jobValueLabel; - delete hpBar; - delete mpBar; - delete xpBar; - delete jobXpBar; - - // Stats Part - delete statsTitleLabel; - delete statsTotalLabel; - delete statsCostLabel; - for (int i = 0; i < 6; i++) - { - delete statsLabel[i]; - delete pointsLabel[i]; - delete statsDisplayLabel[i]; - delete statsButton[i]; - } - delete statsAttackLabel; - delete statsDefenseLabel; - delete statsMagicAttackLabel; - delete statsMagicDefenseLabel; - delete statsAccuracyLabel; - delete statsEvadeLabel; - delete statsReflexLabel; - - delete statsAttackPoints; - delete statsDefensePoints; - delete statsMagicAttackPoints; - delete statsMagicDefensePoints; - delete statsAccuracyPoints; - delete statsEvadePoints; - delete statsReflexPoints; - - delete remainingStatsPointsLabel; -} - void StatusWindow::update() { std::stringstream updateText; diff --git a/src/gui/status.h b/src/gui/status.h index 1c5ed7ff..1df4e346 100644 --- a/src/gui/status.h +++ b/src/gui/status.h @@ -47,11 +47,6 @@ class StatusWindow : public Window, public gcn::ActionListener { */ StatusWindow(); - /** - * Destructor. - */ - ~StatusWindow(); - /** * Called when receiving actions from widget. */ diff --git a/src/gui/tabbedcontainer.cpp b/src/gui/tabbedcontainer.cpp index 3044122a..75977571 100644 --- a/src/gui/tabbedcontainer.cpp +++ b/src/gui/tabbedcontainer.cpp @@ -38,12 +38,12 @@ TabbedContainer::TabbedContainer(): TabbedContainer::~TabbedContainer() { std::vector<gcn::Widget*>::iterator i = mTabs.begin(); - while (i != mTabs.end()) { + for (i = mTabs.begin(); i != mTabs.end(); i++) { remove(*i); delete (*i); - i = mTabs.erase(i); } + mTabs.clear(); mContents.clear(); } diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 818b8b61..bd8b95c5 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -106,10 +106,10 @@ TradeWindow::TradeWindow(): moneyField->setPosition(8 + 60, getHeight() - 20); moneyField->setWidth(50); - + moneyLabel->setPosition(8 + 60 + 50 + 6, getHeight() - 20); moneyLabel2->setPosition(8, getHeight() - 20); - + cancelButton->setPosition(getWidth() - 48, getHeight() - 49); tradeButton->setPosition(cancelButton->getX() - 40 , getHeight() - 49); @@ -136,19 +136,8 @@ TradeWindow::TradeWindow(): TradeWindow::~TradeWindow() { - delete addButton; - delete okButton; - delete cancelButton; - delete tradeButton; delete myItemContainer; - delete myScroll; delete partnerItemContainer; - delete partnerScroll; - delete itemNameLabel; - delete itemDescriptionLabel; - delete moneyField; - delete moneyLabel; - delete moneyLabel2; delete myInventory; delete partnerInventory; diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 70e90e52..8ad5e486 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -107,11 +107,6 @@ UpdaterWindow::~UpdaterWindow() remove((mBasePath + "/updates/download.temp").c_str()); delete[] mCurlError; - delete mScrollArea; - delete mLabel; - delete mProgressBar; - delete mCancelButton; - delete mPlayButton; delete mBrowserBox; } diff --git a/src/gui/vbox.cpp b/src/gui/vbox.cpp index cd76beb8..d79fbba2 100644 --- a/src/gui/vbox.cpp +++ b/src/gui/vbox.cpp @@ -23,15 +23,6 @@ #include "vbox.h" -VBox::VBox() - : Box() -{ -} - -VBox::~VBox() -{ -} - void VBox::draw(gcn::Graphics *graphics) { int widgetCount = mWidgets.size(); diff --git a/src/gui/vbox.h b/src/gui/vbox.h index da486119..06a270ef 100644 --- a/src/gui/vbox.h +++ b/src/gui/vbox.h @@ -28,10 +28,8 @@ class VBox : public Box { - public: - VBox(); - ~VBox(); - void draw(gcn::Graphics *); + public: + void draw(gcn::Graphics *); }; #endif diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 54fc0103..a6f82b45 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -21,9 +21,11 @@ * $Id$ */ +#include "window.h" + #include <guichan/exception.hpp> -#include "window.h" +#include "gccontainer.h" #include "windowcontainer.h" #include "../configlistener.h" @@ -114,7 +116,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent): setTitleBarHeight(20); // Add chrome - mChrome = new gcn::Container(); + mChrome = new GCContainer(); mChrome->setOpaque(false); setContent(mChrome); @@ -259,14 +261,14 @@ void Window::scheduleDelete() windowContainer->scheduleDelete(this); } -void Window::add(gcn::Widget *w) +void Window::add(gcn::Widget *w, bool delChild) { - mChrome->add(w); + mChrome->add(w, delChild); } -void Window::add(gcn::Widget *w, int x, int y) +void Window::add(gcn::Widget *w, int x, int y, bool delChild) { - mChrome->add(w, x, y); + mChrome->add(w, x, y, delChild); } void Window::mousePress(int x, int y, int button) diff --git a/src/gui/window.h b/src/gui/window.h index c7eba732..4f20f721 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -29,6 +29,7 @@ #include "../guichanfwd.h" class ConfigListener; +class GCContainer; class Image; class ImageRect; class WindowContainer; @@ -75,12 +76,12 @@ class Window : public gcn::Window /** * Adds a widget to the window. */ - void add(gcn::Widget *w); + void add(gcn::Widget *wi, bool delChild=true); /** * Adds a widget to the window and also specifices its position. */ - void add(gcn::Widget *w, int x, int y); + void add(gcn::Widget *w, int x, int y, bool delChild=true); /** * Sets the width of the window contents. @@ -195,7 +196,7 @@ class Window : public gcn::Window virtual void resetToDefaultSize(); protected: - gcn::Container *mChrome; /**< Contained container */ + GCContainer *mChrome; /**< Contained container */ Window *mParent; /**< The parent window */ std::string mWindowName; /**< Name of the window */ int snapSize; /**< Snap distance to window edge */ diff --git a/src/gui/windowcontainer.cpp b/src/gui/windowcontainer.cpp index 899a5463..c42d5ccf 100644 --- a/src/gui/windowcontainer.cpp +++ b/src/gui/windowcontainer.cpp @@ -31,11 +31,12 @@ WindowContainer::WindowContainer() void WindowContainer::logic() { std::list<gcn::Widget*>::iterator i = deathList.begin(); - while (i != deathList.end()) { + for (i= deathList.begin(); i != deathList.end(); i++) { delete (*i); - i = deathList.erase(i); } + deathList.clear(); + gcn::Container::logic(); } |