diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-09-23 23:47:32 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-09-23 23:47:32 +0000 |
commit | 7ca971f04907031b80ffbcb159e5af2f595e3af8 (patch) | |
tree | c7f0f210325acb35f63071797407d266ba7e9e35 /src/gui | |
parent | c3d7827d18b725d2dff94e08a17474d607bb43dd (diff) | |
download | mana-7ca971f04907031b80ffbcb159e5af2f595e3af8.tar.gz mana-7ca971f04907031b80ffbcb159e5af2f595e3af8.tar.bz2 mana-7ca971f04907031b80ffbcb159e5af2f595e3af8.tar.xz mana-7ca971f04907031b80ffbcb159e5af2f595e3af8.zip |
Merged most of the changes in biggeruniverse's second memory cleanup patch.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/char_select.cpp | 1 | ||||
-rw-r--r-- | src/gui/char_select.h | 61 | ||||
-rw-r--r-- | src/gui/char_server.cpp | 3 | ||||
-rw-r--r-- | src/gui/char_server.h | 3 | ||||
-rw-r--r-- | src/gui/chargedialog.cpp | 6 | ||||
-rw-r--r-- | src/gui/chargedialog.h | 7 | ||||
-rw-r--r-- | src/gui/chat.cpp | 6 | ||||
-rw-r--r-- | src/gui/equipmentwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/login.h | 3 | ||||
-rw-r--r-- | src/gui/setup.cpp | 2 | ||||
-rw-r--r-- | src/gui/setup.h | 34 | ||||
-rw-r--r-- | src/gui/status.cpp | 4 | ||||
-rw-r--r-- | src/gui/updatewindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/updatewindow.h | 3 |
14 files changed, 74 insertions, 64 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 9834dcf6..0c03a6b0 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -46,7 +46,6 @@ #include "../net/protocol.h" - CharSelectDialog::CharDeleteConfirm::CharDeleteConfirm(CharSelectDialog *m): ConfirmDialog(m, "Confirm", "Are you sure you want to delete this character?"), diff --git a/src/gui/char_select.h b/src/gui/char_select.h index c4aac4b9..3751a440 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.h @@ -29,16 +29,35 @@ #include "../guichanfwd.h" +#include <SDL_events.h> + class PlayerBox; struct PLAYER_INFO; -struct SDL_KeyboardEvent; /** * Character selection dialog. * * \ingroup Interface */ -class CharSelectDialog : public Window, public gcn::ActionListener { +class CharSelectDialog : public Window, public gcn::ActionListener +{ + public: + /** + * Constructor. + */ + CharSelectDialog(); + + /** + * Destructor. + */ + ~CharSelectDialog(); + + void action(const std::string& eventId); + + void setPlayerInfo(PLAYER_INFO* pi); + + void logic(); + private: gcn::Button *selectButton; gcn::Button *cancelButton; @@ -73,31 +92,30 @@ class CharSelectDialog : public Window, public gcn::ActionListener { private: CharSelectDialog *master; }; +}; +/** + * Character creation dialog. + * + * \ingroup GUI + */ +class CharCreateDialog : public Window, public gcn::ActionListener +{ public: /** * Constructor. */ - CharSelectDialog(); + CharCreateDialog(Window *parent = NULL); /** * Destructor. */ - ~CharSelectDialog(); + ~CharCreateDialog(); void action(const std::string& eventId); - void setPlayerInfo(PLAYER_INFO* pi); - - void logic(); -}; + std::string getName(); -/** - * Character creation dialog. - * - * \ingroup GUI - */ -class CharCreateDialog : public Window, public gcn::ActionListener { private: gcn::TextField *nameField; gcn::Label *nameLabel; @@ -117,21 +135,6 @@ class CharCreateDialog : public Window, public gcn::ActionListener { * info. */ void serverCharCreate(); - - public: - /** - * Constructor. - */ - CharCreateDialog(Window *parent = NULL); - - /** - * Destructor. - */ - ~CharCreateDialog(); - - void action(const std::string& eventId); - - std::string getName(); }; void charSelectInputHandler(SDL_KeyboardEvent *keyEvent); diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index c368727b..5c371469 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -177,6 +177,9 @@ void server_char_server(int serverIndex) { char_info[i] = new PLAYER_INFO; + char_info[i]->totalWeight = 0; + char_info[i]->maxWeight = 0; + char_info[i]->lastAttackTime = 0; char_info[i]->id = msg.readLong(); char_info[i]->xp = msg.readLong(); char_info[i]->gp = msg.readLong(); diff --git a/src/gui/char_server.h b/src/gui/char_server.h index d19e84af..70361496 100644 --- a/src/gui/char_server.h +++ b/src/gui/char_server.h @@ -26,13 +26,12 @@ #include <guichan/actionlistener.hpp> #include <guichan/listmodel.hpp> +#include <SDL_events.h> #include "window.h" #include "../guichanfwd.h" -struct SDL_KeyboardEvent; - /** * The list model for the server list. */ diff --git a/src/gui/chargedialog.cpp b/src/gui/chargedialog.cpp index 797d5129..c6cee598 100644 --- a/src/gui/chargedialog.cpp +++ b/src/gui/chargedialog.cpp @@ -33,14 +33,14 @@ ChargeDialog::ChargeDialog(): Window("") { - setContentSize(180,70); - progBar = new ProgressBar(0.0f,20,40,140,25,128,128,128); + setContentSize(180, 70); + progBar = new ProgressBar(0.0f, 20, 40, 140, 25, 128, 128, 128); add(progBar); } ChargeDialog::~ChargeDialog() { - + delete progBar; } void ChargeDialog::action(const std::string& eventId) diff --git a/src/gui/chargedialog.h b/src/gui/chargedialog.h index c42e06ec..4e6d83dc 100644 --- a/src/gui/chargedialog.h +++ b/src/gui/chargedialog.h @@ -36,10 +36,6 @@ class ProgressBar; */ class ChargeDialog : public Window, public gcn::ActionListener { - private: - // members - ProgressBar* progBar; - public: /** * Constructor. @@ -54,6 +50,9 @@ class ChargeDialog : public Window, public gcn::ActionListener // action listener void action(const std::string&); void logic(); + + private: + ProgressBar* progBar; }; extern ChargeDialog* chargeDialog; diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index ab654440..be06a14a 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -47,11 +47,11 @@ ChatWindow::ChatWindow(const std::string &logfile): setContentSize(600, 100); setResizable(true); - + chatInput = new ChatInput(); chatInput->setEventId("chatinput"); chatInput->addActionListener(this); - + textOutput = new BrowserBox(BrowserBox::AUTO_WRAP); textOutput->setOpaque(false); textOutput->disableLinksAndUserColors(); @@ -73,6 +73,8 @@ 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/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 5ed0c189..eeaa13da 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -46,10 +46,12 @@ EquipmentWindow::EquipmentWindow(): Image *itemImg = resman->getImage("graphics/sprites/items.png"); if (!itemImg) logger->error("Unable to load items.png"); itemset = new Spriteset(itemImg, 32, 32); + itemImg->decRef(); } EquipmentWindow::~EquipmentWindow() { + delete itemset; } void EquipmentWindow::draw(gcn::Graphics *graphics) diff --git a/src/gui/login.h b/src/gui/login.h index ce983b8a..5f841d37 100644 --- a/src/gui/login.h +++ b/src/gui/login.h @@ -26,12 +26,11 @@ #include <iosfwd> #include <guichan/actionlistener.hpp> +#include <SDL_events.h> #include "window.h" #include "../guichanfwd.h" -struct SDL_KeyboardEvent; - /** * The login dialog. * diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 4026679e..cc2150de 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -200,11 +200,13 @@ Setup::Setup(): Setup::~Setup() { + delete videoLabel; delete modeListModel; delete modeList; delete scrollArea; delete fsCheckBox; delete openGLCheckBox; + delete customCursorCheckBox; delete soundCheckBox; delete audioLabel; delete applyButton; diff --git a/src/gui/setup.h b/src/gui/setup.h index 7e75c2b0..64358176 100644 --- a/src/gui/setup.h +++ b/src/gui/setup.h @@ -72,6 +72,23 @@ class ModeListModel : public gcn::ListModel */ class Setup : public Window, public gcn::ActionListener { + public: + /** + * Constructor. + */ + Setup(); + + /** + * Destructor. + */ + ~Setup(); + + /** + * Event handling method. + */ + void + action(const std::string& eventId); + private: ModeListModel *modeListModel; @@ -97,23 +114,6 @@ class Setup : public Window, public gcn::ActionListener bool openGLEnabled; bool customCursorEnabled; bool soundEnabled; - - public: - /** - * Constructor. - */ - Setup(); - - /** - * Destructor. - */ - ~Setup(); - - /** - * Event handling method. - */ - void - action(const std::string& eventId); }; extern Setup *setupWindow; diff --git a/src/gui/status.cpp b/src/gui/status.cpp index a601ff59..aea72995 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -220,8 +220,10 @@ StatusWindow::~StatusWindow() delete statsTitleLabel; delete statsTotalLabel; delete statsCostLabel; - for (int i = 0; i < 6; i++) { + for (int i = 0; i < 6; i++) + { delete statsLabel[i]; + delete pointsLabel[i]; delete statsDisplayLabel[i]; delete statsButton[i]; } diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index cd26aca9..5007e5f1 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -106,12 +106,13 @@ UpdaterWindow::~UpdaterWindow() remove((mBasePath + "/updates/resources.txt").c_str()); remove((mBasePath + "/updates/download.temp").c_str()); - delete [] mCurlError; + delete[] mCurlError; delete mScrollArea; delete mLabel; delete mProgressBar; delete mCancelButton; delete mPlayButton; + delete mBrowserBox; } void UpdaterWindow::setProgress(float p) diff --git a/src/gui/updatewindow.h b/src/gui/updatewindow.h index 56ff4065..4fd29ff2 100644 --- a/src/gui/updatewindow.h +++ b/src/gui/updatewindow.h @@ -25,9 +25,9 @@ #define _UPDATERWINDOW_H #include <guichan/actionlistener.hpp> - #include <string> #include <vector> +#include <SDL_events.h> #include "window.h" @@ -39,7 +39,6 @@ class ProgressBar; class ScrollArea; struct SDL_mutex; -struct SDL_KeyboardEvent; struct SDL_Thread; /** |