summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-10-05 21:45:27 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-10-05 21:45:27 +0000
commit4a43cb1c6e5ba304d70df7066c61c52718a5f249 (patch)
treed8aca0414b771cb2b7532d6f4f9d2ed87f77d703 /src/gui
parent8415f7791ea8dc84148c65d04c288d8d12eb50bf (diff)
downloadmana-client-4a43cb1c6e5ba304d70df7066c61c52718a5f249.tar.gz
mana-client-4a43cb1c6e5ba304d70df7066c61c52718a5f249.tar.bz2
mana-client-4a43cb1c6e5ba304d70df7066c61c52718a5f249.tar.xz
mana-client-4a43cb1c6e5ba304d70df7066c61c52718a5f249.zip
Fixed some resource cleanup and memory leaks. Also changed the way dangling
references to resources are reported to be more informative.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/button.cpp15
-rw-r--r--src/gui/button.h2
-rw-r--r--src/gui/char_select.cpp2
-rw-r--r--src/gui/login.cpp47
-rw-r--r--src/gui/skill.cpp1
5 files changed, 38 insertions, 29 deletions
diff --git a/src/gui/button.cpp b/src/gui/button.cpp
index b2468036..bf2ca6c6 100644
--- a/src/gui/button.cpp
+++ b/src/gui/button.cpp
@@ -35,14 +35,14 @@
#include "../resources/resourcemanager.h"
ImageRect Button::button[4];
-int Button::instances = 0;
+int Button::mInstances = 0;
Button::Button(const std::string& caption):
gcn::Button(caption)
{
setBorderSize(0);
- if (instances == 0)
+ if (mInstances == 0)
{
// Load the skin
ResourceManager *resman = ResourceManager::getInstance();
@@ -71,14 +71,14 @@ Button::Button(const std::string& caption):
}
}
- instances++;
+ mInstances++;
}
Button::~Button()
{
- instances--;
+ mInstances--;
- if (instances == 0)
+ if (mInstances == 0)
{
int a, x, y, mode;
@@ -112,8 +112,9 @@ void Button::draw(gcn::Graphics* graphics)
mode = 0;
}
- dynamic_cast<Graphics*>(graphics)->drawImageRect(0, 0, getWidth(), getHeight(),
- button[mode]);
+ dynamic_cast<Graphics*>(graphics)->drawImageRect(0, 0,
+ getWidth(), getHeight(),
+ button[mode]);
graphics->setColor(getForegroundColor());
diff --git a/src/gui/button.h b/src/gui/button.h
index 8873358d..86467769 100644
--- a/src/gui/button.h
+++ b/src/gui/button.h
@@ -54,7 +54,7 @@ class Button : public gcn::Button {
private:
static ImageRect button[4]; /**< Button state graphics */
- static int instances; /**< Number of button instances */
+ static int mInstances; /**< Number of button instances */
};
#endif
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 84e0e13a..b7258aba 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -370,6 +370,8 @@ CharCreateDialog::~CharCreateDialog()
delete nextHairStyleButton;
delete prevHairStyleButton;
delete hairStyleLabel;
+ delete createButton;
+ delete cancelButton;
delete playerBox;
}
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index b4d431d2..aea77768 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -51,13 +51,14 @@ SERVER_INFO **server_info;
WrongUsernameNoticeListener wrongUsernameNoticeListener;
WrongPasswordNoticeListener wrongPasswordNoticeListener;
-void WrongPasswordNoticeListener::setLoginDialog(
- LoginDialog *loginDialog)
+void
+WrongPasswordNoticeListener::setLoginDialog(LoginDialog *loginDialog)
{
mLoginDialog = loginDialog;
}
-void WrongPasswordNoticeListener::action(const std::string &eventId)
+void
+WrongPasswordNoticeListener::action(const std::string &eventId)
{
// Reset the password and put the caret ready to retype it.
mLoginDialog->passField->setText("");
@@ -66,13 +67,14 @@ void WrongPasswordNoticeListener::action(const std::string &eventId)
wrongLoginNotice = NULL;
}
-void WrongUsernameNoticeListener::setLoginDialog(
- LoginDialog *loginDialog)
+void
+WrongUsernameNoticeListener::setLoginDialog(LoginDialog *loginDialog)
{
mLoginDialog = loginDialog;
}
-void WrongUsernameNoticeListener::action(const std::string &eventId)
+void
+WrongUsernameNoticeListener::action(const std::string &eventId)
{
// Set the focus on the username Field
mLoginDialog->userField->setCaretPosition(LEN_MAX_USERNAME - 1);
@@ -175,7 +177,8 @@ LoginDialog::~LoginDialog()
delete registerButton;
}
-void LoginDialog::action(const std::string& eventId)
+void
+LoginDialog::action(const std::string& eventId)
{
if (eventId == "ok")
{
@@ -267,9 +270,9 @@ void LoginDialog::action(const std::string& eventId)
{
// Name too short
std::stringstream errorMessage;
- errorMessage << "The username needs to be at least ";
- errorMessage << LEN_MIN_USERNAME;
- errorMessage << " characters long.";
+ errorMessage << "The username needs to be at least "
+ << LEN_MIN_USERNAME
+ << " characters long.";
wrongLoginNotice = new OkDialog("Error", errorMessage.str(),
&wrongUsernameNoticeListener);
}
@@ -277,9 +280,9 @@ void LoginDialog::action(const std::string& eventId)
{
// Name too long
std::stringstream errorMessage;
- errorMessage << "The username needs to be less than ";
- errorMessage << LEN_MAX_USERNAME;
- errorMessage << " characters long.";
+ errorMessage << "The username needs to be less than "
+ << LEN_MAX_USERNAME
+ << " characters long.";
wrongLoginNotice = new OkDialog("Error", errorMessage.str(),
&wrongUsernameNoticeListener);
}
@@ -287,9 +290,9 @@ void LoginDialog::action(const std::string& eventId)
{
// Pass too short
std::stringstream errorMessage;
- errorMessage << "The password needs to be at least ";
- errorMessage << LEN_MIN_PASSWORD;
- errorMessage << " characters long.";
+ errorMessage << "The password needs to be at least "
+ << LEN_MIN_PASSWORD
+ << " characters long.";
wrongLoginNotice = new OkDialog("Error", errorMessage.str(),
&wrongPasswordNoticeListener);
}
@@ -297,9 +300,9 @@ void LoginDialog::action(const std::string& eventId)
{
// Pass too long
std::stringstream errorMessage;
- errorMessage << "The password needs to be less than ";
- errorMessage << LEN_MAX_PASSWORD;
- errorMessage << " characters long.";
+ errorMessage << "The password needs to be less than "
+ << LEN_MAX_PASSWORD
+ << " characters long.";
wrongLoginNotice = new OkDialog("Error", errorMessage.str(),
&wrongPasswordNoticeListener);
}
@@ -311,7 +314,8 @@ void LoginDialog::action(const std::string& eventId)
}
}
-void loginInputHandler(SDL_KeyboardEvent *keyEvent)
+void
+loginInputHandler(SDL_KeyboardEvent *keyEvent)
{
if (keyEvent->keysym.sym == SDLK_ESCAPE)
{
@@ -319,7 +323,8 @@ void loginInputHandler(SDL_KeyboardEvent *keyEvent)
}
}
-int attemptLogin(const std::string& user, const std::string& pass)
+int
+attemptLogin(const std::string& user, const std::string& pass)
{
int ret;
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index a52cd267..75f77e39 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -115,6 +115,7 @@ SkillDialog::~SkillDialog()
delete pointsLabel;
delete incButton;
delete closeButton;
+ delete useButton;
for (int i = skillList.size() - 1; i >= 0; i--)
{