summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-01 20:04:35 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-01 20:04:35 +0300
commitb8cdabbd20690d57930dce9dda949fca21a6233a (patch)
treeddd3d0a3bb4d83206b92ede95b330430e803e26b /src/gui
parentab1f66527863c7fcce6c3ccedda0d5560dc063c7 (diff)
downloadManaVerse-b8cdabbd20690d57930dce9dda949fca21a6233a.tar.gz
ManaVerse-b8cdabbd20690d57930dce9dda949fca21a6233a.tar.bz2
ManaVerse-b8cdabbd20690d57930dce9dda949fca21a6233a.tar.xz
ManaVerse-b8cdabbd20690d57930dce9dda949fca21a6233a.zip
Eliminate asserts from most files.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/charselectdialog.cpp5
-rw-r--r--src/gui/popupmenu.cpp2
-rw-r--r--src/gui/quitdialog.cpp15
-rw-r--r--src/gui/widgets/layout.cpp7
-rw-r--r--src/gui/widgets/window.cpp3
5 files changed, 14 insertions, 18 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index 28c7a083c..1942ebaeb 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -60,7 +60,6 @@
#include <guichan/font.hpp>
#include <string>
-#include <cassert>
#include "debug.h"
@@ -342,8 +341,8 @@ void CharSelectDialog::setCharacters(const Net::Characters &characters)
void CharSelectDialog::lock()
{
- assert(!mLocked);
- setLocked(true);
+ if (!mLocked)
+ setLocked(true);
}
void CharSelectDialog::unlock()
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 6db4a408f..0eac0a4f9 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -78,8 +78,6 @@
#include "utils/gettext.h"
#include "utils/stringutils.h"
-#include <cassert>
-
#include "debug.h"
std::string tradePartnerName("");
diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp
index f66872b5d..04f43fb88 100644
--- a/src/gui/quitdialog.cpp
+++ b/src/gui/quitdialog.cpp
@@ -41,23 +41,17 @@
#include "utils/gettext.h"
-#include <assert.h>
-
#include "debug.h"
QuitDialog::QuitDialog(QuitDialog** pointerToMe):
Window(_("Quit"), true, NULL), mMyPointer(pointerToMe)
{
-// int width = 200;
-// int height = 120;
-
mForceQuit = new RadioButton(_("Quit"), "quitdialog");
mLogoutQuit = new RadioButton(_("Quit"), "quitdialog");
mSwitchAccountServer = new RadioButton(_("Switch server"), "quitdialog");
mSwitchCharacter = new RadioButton(_("Switch character"), "quitdialog");
mOkButton = new Button(_("OK"), "ok", this);
mCancelButton = new Button(_("Cancel"), "cancel", this);
-// setContentSize(width, height);
addKeyListener(this);
@@ -149,10 +143,11 @@ void QuitDialog::action(const gcn::ActionEvent &event)
}
else if (mSwitchCharacter->isSelected())
{
- assert(Client::getState() == STATE_GAME);
-
- Net::getCharHandler()->switchCharacter();
- Client::closeDialogs();
+ if (Client::getState() == STATE_GAME)
+ {
+ Net::getCharHandler()->switchCharacter();
+ Client::closeDialogs();
+ }
}
}
scheduleDelete();
diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp
index 382d169dc..a14b416ce 100644
--- a/src/gui/widgets/layout.cpp
+++ b/src/gui/widgets/layout.cpp
@@ -68,7 +68,9 @@ LayoutArray &LayoutCell::getArray()
void LayoutCell::reflow(int nx, int ny, int nw, int nh)
{
- assert(mType != NONE);
+ if (mType == NONE)
+ return;
+
nx += mHPadding;
ny += mVPadding;
nw -= 2 * mHPadding;
@@ -81,7 +83,8 @@ void LayoutCell::reflow(int nx, int ny, int nw, int nh)
void LayoutCell::computeSizes()
{
- assert(mType == ARRAY);
+ if (mType != ARRAY)
+ return;
std::vector< std::vector< LayoutCell * > >::iterator
i = mArray->mCells.begin();
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 7508d4e4b..0a3779307 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -663,7 +663,8 @@ void Window::setModal(bool modal)
void Window::loadWindowState()
{
const std::string &name = mWindowName;
- assert(!name.empty());
+ if (name.empty())
+ return;
setPosition(config.getValueInt(name + "WinX", mDefaultX),
config.getValueInt(name + "WinY", mDefaultY));