summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/beingpopup.cpp8
-rw-r--r--src/gui/botcheckerwindow.cpp2
-rw-r--r--src/gui/buydialog.cpp6
-rw-r--r--src/gui/buyselldialog.cpp10
-rw-r--r--src/gui/changeemaildialog.cpp4
-rw-r--r--src/gui/changepassworddialog.cpp4
-rw-r--r--src/gui/charcreatedialog.cpp12
-rw-r--r--src/gui/charselectdialog.cpp16
-rw-r--r--src/gui/chatwindow.cpp34
-rw-r--r--src/gui/confirmdialog.cpp2
-rw-r--r--src/gui/confirmdialog.h4
-rw-r--r--src/gui/debugwindow.cpp10
-rw-r--r--src/gui/didyouknowwindow.cpp2
-rw-r--r--src/gui/editdialog.h4
-rw-r--r--src/gui/emotepopup.cpp2
-rw-r--r--src/gui/equipmentwindow.cpp16
-rw-r--r--src/gui/focushandler.cpp2
-rw-r--r--src/gui/gui.cpp36
-rw-r--r--src/gui/helpwindow.cpp2
-rw-r--r--src/gui/inventorywindow.cpp8
-rw-r--r--src/gui/itemamountwindow.cpp10
-rw-r--r--src/gui/itempopup.cpp8
-rw-r--r--src/gui/killstats.cpp2
-rw-r--r--src/gui/logindialog.cpp8
-rw-r--r--src/gui/minimap.cpp8
-rw-r--r--src/gui/ministatuswindow.cpp12
-rw-r--r--src/gui/npcdialog.cpp42
-rw-r--r--src/gui/npcpostdialog.cpp2
-rw-r--r--src/gui/okdialog.h4
-rw-r--r--src/gui/outfitwindow.cpp10
-rw-r--r--src/gui/popupmenu.cpp89
-rw-r--r--src/gui/quitdialog.cpp23
-rw-r--r--src/gui/register.cpp12
-rw-r--r--src/gui/sdlfont.cpp8
-rw-r--r--src/gui/selldialog.cpp8
-rw-r--r--src/gui/serverdialog.cpp16
-rw-r--r--src/gui/setup.cpp4
-rw-r--r--src/gui/setup_colors.cpp8
-rw-r--r--src/gui/setup_joystick.cpp114
-rw-r--r--src/gui/setup_joystick.h11
-rw-r--r--src/gui/setup_keyboard.cpp10
-rw-r--r--src/gui/setup_other.cpp5
-rw-r--r--src/gui/setup_relations.cpp13
-rw-r--r--src/gui/setup_theme.cpp115
-rw-r--r--src/gui/setup_theme.h11
-rw-r--r--src/gui/setup_video.cpp18
-rw-r--r--src/gui/shopwindow.cpp16
-rw-r--r--src/gui/shortcutwindow.cpp12
-rw-r--r--src/gui/skilldialog.cpp20
-rw-r--r--src/gui/socialwindow.cpp104
-rw-r--r--src/gui/specialswindow.cpp10
-rw-r--r--src/gui/statuspopup.cpp48
-rw-r--r--src/gui/statuspopup.h1
-rw-r--r--src/gui/statuswindow.cpp37
-rw-r--r--src/gui/textcommandeditor.cpp8
-rw-r--r--src/gui/textdialog.cpp4
-rw-r--r--src/gui/theme.cpp44
-rw-r--r--src/gui/tradewindow.cpp6
-rw-r--r--src/gui/unregisterdialog.cpp4
-rw-r--r--src/gui/updaterwindow.cpp23
-rw-r--r--src/gui/viewport.cpp32
-rw-r--r--src/gui/whoisonline.cpp30
-rw-r--r--src/gui/widgets/avatarlistbox.cpp8
-rw-r--r--src/gui/widgets/browserbox.cpp58
-rw-r--r--src/gui/widgets/browserbox.h11
-rw-r--r--src/gui/widgets/button.cpp2
-rw-r--r--src/gui/widgets/chattab.cpp4
-rw-r--r--src/gui/widgets/checkbox.cpp24
-rw-r--r--src/gui/widgets/checkbox.h4
-rw-r--r--src/gui/widgets/desktop.cpp4
-rw-r--r--src/gui/widgets/dropdown.cpp2
-rw-r--r--src/gui/widgets/dropdown.h4
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp10
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/flowcontainer.cpp2
-rw-r--r--src/gui/widgets/guitable.cpp16
-rw-r--r--src/gui/widgets/guitable.h4
-rw-r--r--src/gui/widgets/icon.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp8
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp2
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp12
-rw-r--r--src/gui/widgets/layout.cpp4
-rw-r--r--src/gui/widgets/layout.h6
-rw-r--r--src/gui/widgets/playerbox.cpp4
-rw-r--r--src/gui/widgets/playerbox.h3
-rw-r--r--src/gui/widgets/popup.cpp6
-rw-r--r--src/gui/widgets/progressbar.cpp4
-rw-r--r--src/gui/widgets/radiobutton.cpp2
-rw-r--r--src/gui/widgets/resizegrip.cpp4
-rw-r--r--src/gui/widgets/scrollarea.cpp8
-rw-r--r--src/gui/widgets/setupitem.cpp98
-rw-r--r--src/gui/widgets/setuptabscroll.cpp4
-rw-r--r--src/gui/widgets/shopitems.cpp6
-rw-r--r--src/gui/widgets/shoplistbox.cpp2
-rw-r--r--src/gui/widgets/shortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/slider.cpp32
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp8
-rw-r--r--src/gui/widgets/tab.cpp2
-rw-r--r--src/gui/widgets/tabbedarea.cpp22
-rw-r--r--src/gui/widgets/tablemodel.cpp4
-rw-r--r--src/gui/widgets/textfield.cpp2
-rw-r--r--src/gui/widgets/textfield.h4
-rw-r--r--src/gui/widgets/textpreview.cpp2
-rw-r--r--src/gui/widgets/window.cpp16
-rw-r--r--src/gui/widgets/window.h3
-rw-r--r--src/gui/widgets/windowcontainer.cpp2
-rw-r--r--src/gui/windowmenu.cpp12
-rw-r--r--src/gui/worldselectdialog.cpp13
108 files changed, 977 insertions, 631 deletions
diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp
index 98df1ca9a..759d4c245 100644
--- a/src/gui/beingpopup.cpp
+++ b/src/gui/beingpopup.cpp
@@ -130,7 +130,7 @@ void BeingPopup::show(int x, int y, Being *b)
label4 = label3;
label3 = label2;
label2 = label1;
- label1 = 0;
+ label1 = nullptr;
}
if (!(b->getGuildName().empty()))
@@ -143,7 +143,7 @@ void BeingPopup::show(int x, int y, Being *b)
{
label4 = label3;
label3 = label2;
- label2 = 0;
+ label2 = nullptr;
}
if (b->getPvpRank() > 0)
@@ -154,7 +154,7 @@ void BeingPopup::show(int x, int y, Being *b)
else
{
label4 = label3;
- label3 = 0;
+ label3 = nullptr;
}
if (!b->getComment().empty())
@@ -165,7 +165,7 @@ void BeingPopup::show(int x, int y, Being *b)
}
else
{
- label4 = 0;
+ label4 = nullptr;
}
int minWidth = mBeingName->getWidth();
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp
index 88bc65a78..bff9ad31a 100644
--- a/src/gui/botcheckerwindow.cpp
+++ b/src/gui/botcheckerwindow.cpp
@@ -263,7 +263,7 @@ protected:
BotCheckerWindow::BotCheckerWindow():
- Window(_("Bot Checker"), false, 0, "botchecker.xml"),
+ Window(_("Bot Checker"), false, nullptr, "botchecker.xml"),
mEnabled(false)
{
int w = 500;
diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp
index 7fad622df..f5e556848 100644
--- a/src/gui/buydialog.cpp
+++ b/src/gui/buydialog.cpp
@@ -55,14 +55,14 @@
BuyDialog::DialogList BuyDialog::instances;
BuyDialog::BuyDialog(int npcId):
- Window(_("Buy"), false, 0, "buy.xml"),
+ Window(_("Buy"), false, nullptr, "buy.xml"),
mNpcId(npcId), mMoney(0), mAmountItems(0), mMaxItems(0), mNick("")
{
init();
}
BuyDialog::BuyDialog(std::string nick):
- Window(_("Buy"), false, 0, "buy.xml"),
+ Window(_("Buy"), false, nullptr, "buy.xml"),
mNpcId(-1), mMoney(0), mAmountItems(0), mMaxItems(0), mNick(nick)
{
init();
@@ -153,7 +153,7 @@ void BuyDialog::init()
BuyDialog::~BuyDialog()
{
delete mShopItems;
- mShopItems = 0;
+ mShopItems = nullptr;
instances.remove(this);
}
diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp
index e1063192a..2a614ed74 100644
--- a/src/gui/buyselldialog.cpp
+++ b/src/gui/buyselldialog.cpp
@@ -37,19 +37,19 @@
BuySellDialog::DialogList BuySellDialog::instances;
BuySellDialog::BuySellDialog(int npcId):
- Window(_("Shop"), false, 0, "buysell.xml"),
+ Window(_("Shop"), false, nullptr, "buysell.xml"),
mNpcId(npcId),
mNick(""),
- mBuyButton(0)
+ mBuyButton(nullptr)
{
init();
}
BuySellDialog::BuySellDialog(std::string nick):
- Window(_("Shop"), false, 0, "buysell.xml"),
+ Window(_("Shop"), false, nullptr, "buysell.xml"),
mNpcId(-1),
mNick(nick),
- mBuyButton(0)
+ mBuyButton(nullptr)
{
init();
}
@@ -62,7 +62,7 @@ void BuySellDialog::init()
static const char *buttonNames[] =
{
- N_("Buy"), N_("Sell"), N_("Cancel"), 0
+ N_("Buy"), N_("Sell"), N_("Cancel"), nullptr
};
int x = 10, y = 10;
diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp
index 384ebf07f..3c412b424 100644
--- a/src/gui/changeemaildialog.cpp
+++ b/src/gui/changeemaildialog.cpp
@@ -45,7 +45,7 @@
#include "debug.h"
ChangeEmailDialog::ChangeEmailDialog(LoginData *data):
- Window(_("Change Email Address"), true, 0, "changeemail.xml"),
+ Window(_("Change Email Address"), true, nullptr, "changeemail.xml"),
mWrongDataNoticeListener(new WrongDataNoticeListener),
mLoginData(data)
{
@@ -102,7 +102,7 @@ ChangeEmailDialog::ChangeEmailDialog(LoginData *data):
ChangeEmailDialog::~ChangeEmailDialog()
{
delete mWrongDataNoticeListener;
- mWrongDataNoticeListener = 0;
+ mWrongDataNoticeListener = nullptr;
}
void ChangeEmailDialog::action(const gcn::ActionEvent &event)
diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp
index 7a67279b6..a7ebaebca 100644
--- a/src/gui/changepassworddialog.cpp
+++ b/src/gui/changepassworddialog.cpp
@@ -47,7 +47,7 @@
#include "debug.h"
ChangePasswordDialog::ChangePasswordDialog(LoginData *data):
- Window(_("Change Password"), true, 0, "changepassword.xml"),
+ Window(_("Change Password"), true, nullptr, "changepassword.xml"),
mWrongDataNoticeListener(new WrongDataNoticeListener),
mLoginData(data)
{
@@ -82,7 +82,7 @@ ChangePasswordDialog::ChangePasswordDialog(LoginData *data):
ChangePasswordDialog::~ChangePasswordDialog()
{
delete mWrongDataNoticeListener;
- mWrongDataNoticeListener = 0;
+ mWrongDataNoticeListener = nullptr;
}
void ChangePasswordDialog::action(const gcn::ActionEvent &event)
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index efe7e804f..42435f036 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -63,7 +63,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot):
setStickyButtonLock(true);
setSticky(true);
- mPlayer = new Being(0, ActorSprite::PLAYER, mRace, NULL);
+ mPlayer = new Being(0, ActorSprite::PLAYER, mRace, nullptr);
mPlayer->setGender(GENDER_MALE);
int numberOfHairColors = ColorDB::getHairSize();
@@ -180,10 +180,10 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot):
CharCreateDialog::~CharCreateDialog()
{
delete mPlayer;
- mPlayer = 0;
+ mPlayer = nullptr;
// Make sure the char server handler knows that we're gone
- Net::getCharHandler()->setCharCreateDialog(0);
+ Net::getCharHandler()->setCharCreateDialog(nullptr);
}
void CharCreateDialog::action(const gcn::ActionEvent &event)
@@ -335,13 +335,13 @@ void CharCreateDialog::setAttributes(const std::vector<std::string> &labels,
{
remove(mAttributeLabel[i]);
delete mAttributeLabel[i];
- mAttributeLabel[i] = 0;
+ mAttributeLabel[i] = nullptr;
remove(mAttributeSlider[i]);
delete mAttributeSlider[i];
- mAttributeSlider[i] = 0;
+ mAttributeSlider[i] = nullptr;
remove(mAttributeValue[i]);
delete mAttributeValue[i];
- mAttributeValue[i] = 0;
+ mAttributeValue[i] = nullptr;
}
mAttributeLabel.resize(labels.size());
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index 00cae41e6..93302e0ff 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -122,14 +122,14 @@ class CharacterDisplay : public Container
};
CharSelectDialog::CharSelectDialog(LoginData *data):
- Window(_("Account and Character Management"), false, 0, "char.xml"),
+ Window(_("Account and Character Management"), false, nullptr, "char.xml"),
mLocked(false),
- mUnregisterButton(0),
- mChangeEmailButton(0),
+ mUnregisterButton(nullptr),
+ mChangeEmailButton(nullptr),
mCharacterEntries(0),
mLoginData(data),
mCharHandler(Net::getCharHandler()),
- mDeleteDialog(0),
+ mDeleteDialog(nullptr),
mDeleteIndex(-1)
{
setCloseButton(false);
@@ -246,7 +246,7 @@ void CharSelectDialog::action(const gcn::ActionEvent &event)
== LoginDialog::savedPassword)
{
attemptCharacterDelete(mDeleteIndex);
- mDeleteDialog = 0;
+ mDeleteDialog = nullptr;
}
else
{
@@ -313,7 +313,7 @@ void CharSelectDialog::setCharacters(const Net::Characters &characters)
for (iter = mCharacterEntries.begin(), iter_end = mCharacterEntries.end();
iter != iter_end; ++iter)
{
- (*iter)->setCharacter(0);
+ (*iter)->setCharacter(nullptr);
}
Net::Characters::const_iterator i, i_end = characters.end();
@@ -399,7 +399,7 @@ bool CharSelectDialog::selectByName(const std::string &name,
CharacterDisplay::CharacterDisplay(CharSelectDialog *charSelectDialog):
- mCharacter(0),
+ mCharacter(nullptr),
mPlayerBox(new PlayerBox)
{
mButton = new Button("wwwwwwwww", "go", charSelectDialog);
@@ -445,7 +445,7 @@ void CharacterDisplay::setCharacter(Net::Character *character)
return;
mCharacter = character;
- mPlayerBox->setPlayer(character ? character->dummy : 0);
+ mPlayerBox->setPlayer(character ? character->dummy : nullptr);
update();
}
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 7969f55f8..35b89b839 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -149,7 +149,7 @@ public:
ChatWindow::ChatWindow():
- Window(_("Chat"), false, 0, "chat.xml"),
+ Window(_("Chat"), false, nullptr, "chat.xml"),
mTmpVisible(false),
mChatHistoryIndex(0)
{
@@ -222,11 +222,11 @@ ChatWindow::~ChatWindow()
config.setValue("ReturnToggles", mReturnToggles);
removeAllWhispers();
delete mItemLinkHandler;
- mItemLinkHandler = 0;
+ mItemLinkHandler = nullptr;
delete mColorPicker;
- mColorPicker = 0;
+ mColorPicker = nullptr;
delete mColorListModel;
- mColorListModel = 0;
+ mColorListModel = nullptr;
}
void ChatWindow::fillCommands()
@@ -294,9 +294,11 @@ void ChatWindow::fillCommands()
mCommands.push_back("/removeattack ");
mCommands.push_back("/addignoreattack ");
mCommands.push_back("/blacklist ");
+ mCommands.push_back("/enemy ");
mCommands.push_back("/serverignoreall");
mCommands.push_back("/serverunignoreall");
mCommands.push_back("/dumpg");
+ mCommands.push_back("/pseudoaway ");
}
void ChatWindow::resetToDefaultSize()
@@ -555,13 +557,13 @@ void ChatWindow::ignoreAllWhispers()
}
delete(iter->second);
- iter->second = 0;
+ iter->second = nullptr;
}
}
void ChatWindow::chatInput(const std::string &message)
{
- ChatTab *tab = NULL;
+ ChatTab *tab = nullptr;
std::string msg = message;
trim(msg);
@@ -937,7 +939,7 @@ void ChatWindow::addWhisper(const std::string &nick,
if (tempNick.compare(playerName) == 0)
return;
- ChatTab *tab = 0;
+ ChatTab *tab = nullptr;
TabMap::const_iterator i = mWhispers.find(tempNick);
if (i != mWhispers.end())
@@ -1004,7 +1006,7 @@ void ChatWindow::addWhisper(const std::string &nick,
{
localChatTab->chatLog(nick + " : " + mes, ACT_WHISPER, false);
if (player_node)
- player_node->afkRespond(0, nick);
+ player_node->afkRespond(nullptr, nick);
}
}
}
@@ -1012,7 +1014,7 @@ void ChatWindow::addWhisper(const std::string &nick,
ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo)
{
if (!player_node)
- return NULL;
+ return nullptr;
std::string playerName = player_node->getName();
std::string tempNick = nick;
@@ -1024,7 +1026,7 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo)
ChatTab *ret;
if (tempNick.compare(playerName) == 0)
- return NULL;
+ return nullptr;
if (i != mWhispers.end())
{
@@ -1049,7 +1051,7 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo)
ChatTab *ChatWindow::getWhisperTab(const std::string &nick) const
{
if (!player_node)
- return NULL;
+ return nullptr;
std::string playerName = player_node->getName();
std::string tempNick = nick;
@@ -1058,10 +1060,10 @@ ChatTab *ChatWindow::getWhisperTab(const std::string &nick) const
toLower(tempNick);
TabMap::const_iterator i = mWhispers.find(tempNick);
- ChatTab *ret = 0;
+ ChatTab *ret = nullptr;
if (tempNick.compare(playerName) == 0)
- return NULL;
+ return nullptr;
if (i != mWhispers.end())
ret = i->second;
@@ -1348,8 +1350,8 @@ void ChatWindow::initTradeFilter()
void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers)
{
TabMap::const_iterator iter;
- const Party *party = 0;
- const Guild *guild = 0;
+ const Party *party = nullptr;
+ const Guild *guild = nullptr;
if (player_node)
{
party = player_node->getParty();
@@ -1499,7 +1501,7 @@ void ChatWindow::loadCustomList()
void ChatWindow::addToAwayLog(std::string line)
{
- if (!player_node || !player_node->getAwayMode())
+ if (!player_node || !player_node->getAway())
return;
if (mAwayLog.size() > 20)
diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp
index f7f81bd2f..298855563 100644
--- a/src/gui/confirmdialog.cpp
+++ b/src/gui/confirmdialog.cpp
@@ -46,7 +46,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg,
gcn::Button *yesButton = new Button(_("Yes"), "yes", this);
gcn::Button *noButton = new Button(_("No"), "no", this);
- gcn::Button *ignoreButton = NULL;
+ gcn::Button *ignoreButton = nullptr;
if (ignore)
ignoreButton = new Button(_("Ignore"), "ignore", this);
diff --git a/src/gui/confirmdialog.h b/src/gui/confirmdialog.h
index 214aaba60..2b5febed0 100644
--- a/src/gui/confirmdialog.h
+++ b/src/gui/confirmdialog.h
@@ -23,6 +23,8 @@
#ifndef OPTION_DIALOG_H
#define OPTION_DIALOG_H
+#include "localconsts.h"
+
#include "gui/widgets/window.h"
#include <guichan/actionlistener.hpp>
@@ -44,7 +46,7 @@ class ConfirmDialog : public Window, public gcn::ActionListener
*/
ConfirmDialog(const std::string &title, const std::string &msg,
bool ignore = false, bool modal = false,
- Window *parent = NULL);
+ Window *parent = nullptr);
/**
* Called when receiving actions from the widgets.
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index 83e9791ef..56a63c72d 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -51,7 +51,7 @@
#include "debug.h"
DebugWindow::DebugWindow():
- Window(_("Debug"), false, 0, "debug.xml")
+ Window(_("Debug"), false, nullptr, "debug.xml")
{
setWindowName("Debug");
if (setupWindow)
@@ -85,11 +85,11 @@ DebugWindow::DebugWindow():
DebugWindow::~DebugWindow()
{
delete mMapWidget;
- mMapWidget = 0;
+ mMapWidget = nullptr;
delete mTargetWidget;
- mTargetWidget = 0;
+ mTargetWidget = nullptr;
delete mNetWidget;
- mNetWidget = 0;
+ mNetWidget = nullptr;
}
void DebugWindow::logic()
@@ -139,7 +139,7 @@ void DebugWindow::widgetResized(const gcn::Event &event)
}
MapDebugTab::MapDebugTab() :
- mTexturesLabel(0)
+ mTexturesLabel(nullptr)
{
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp
index df15e6ebd..9a913a305 100644
--- a/src/gui/didyouknowwindow.cpp
+++ b/src/gui/didyouknowwindow.cpp
@@ -44,7 +44,7 @@ static const int minTip = 1;
static const int maxTip = 14;
DidYouKnowWindow::DidYouKnowWindow():
- Window(_("Did You Know?"), false, 0, "didyouknow.xml")
+ Window(_("Did You Know?"), false, nullptr, "didyouknow.xml")
{
setMinWidth(300);
setMinHeight(250);
diff --git a/src/gui/editdialog.h b/src/gui/editdialog.h
index dc0d1cc63..69f86edca 100644
--- a/src/gui/editdialog.h
+++ b/src/gui/editdialog.h
@@ -24,6 +24,8 @@
#ifndef EDIT_DIALOG_H
#define EDIT_DIALOG_H
+#include "localconsts.h"
+
#include "gui/widgets/window.h"
#include "gui/widgets/textfield.h"
@@ -48,7 +50,7 @@ class EditDialog : public Window, public gcn::ActionListener
*/
EditDialog(const std::string &title, const std::string &msg,
std::string eventOk = ACTION_EDIT_OK, int width = 300,
- Window *parent = NULL, bool modal = true);
+ Window *parent = nullptr, bool modal = true);
/**
* Called when receiving actions from the widgets.
diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp
index 6d2bf7be2..a8c92ed47 100644
--- a/src/gui/emotepopup.cpp
+++ b/src/gui/emotepopup.cpp
@@ -80,7 +80,7 @@ EmotePopup::~EmotePopup()
if (mSelectionImage)
{
mSelectionImage->decRef();
- mSelectionImage = 0;
+ mSelectionImage = nullptr;
}
}
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index f423cddf0..d3d230922 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -58,7 +58,7 @@ static const int BOX_HEIGHT = 36;
EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being,
bool foring):
- Window(_("Equipment"), false, 0, "equipment.xml"),
+ Window(_("Equipment"), false, nullptr, "equipment.xml"),
mEquipment(equipment),
mSelected(-1),
mForing(foring)
@@ -86,7 +86,7 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being,
mBoxes.reserve(13);
for (int f = 0; f < 13; f ++)
- mBoxes.push_back(0);
+ mBoxes.push_back(nullptr);
fillBoxes();
@@ -109,13 +109,13 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being,
EquipmentWindow::~EquipmentWindow()
{
delete mItemPopup;
- mItemPopup = 0;
+ mItemPopup = nullptr;
if (this == beingEquipmentWindow)
{
if (mEquipment)
delete mEquipment->getBackend();
delete mEquipment;
- mEquipment = 0;
+ mEquipment = nullptr;
}
delete_all(mBoxes);
mBoxes.clear();
@@ -198,7 +198,7 @@ void EquipmentWindow::action(const gcn::ActionEvent &event)
Item *EquipmentWindow::getItem(int x, int y) const
{
if (!mEquipment)
- return 0;
+ return nullptr;
std::vector<std::pair<int, int>*>::const_iterator it;
std::vector<std::pair<int, int>*>::const_iterator it_end = mBoxes.end();
@@ -215,7 +215,7 @@ Item *EquipmentWindow::getItem(int x, int y) const
if (tRect.isPointInRect(x, y))
return mEquipment->getEquipment(i);
}
- return NULL;
+ return nullptr;
}
void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent)
@@ -322,7 +322,7 @@ void EquipmentWindow::setBeing(Being *being)
delete mEquipment;
if (!being)
{
- mEquipment = 0;
+ mEquipment = nullptr;
return;
}
mEquipment = being->getEquipment();
@@ -337,7 +337,7 @@ void EquipmentWindow::updateBeing(Being *being)
void EquipmentWindow::resetBeing(Being *being)
{
if (being == mBeing)
- setBeing(0);
+ setBeing(nullptr);
}
void EquipmentWindow::fillBoxes()
diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp
index ec854cf87..40fa2f4ed 100644
--- a/src/gui/focushandler.cpp
+++ b/src/gui/focushandler.cpp
@@ -34,7 +34,7 @@ void FocusHandler::requestModalFocus(gcn::Widget *widget)
if (mModalFocusedWidget && mModalFocusedWidget != widget)
{
mModalStack.push_front(mModalFocusedWidget);
- mModalFocusedWidget = NULL;
+ mModalFocusedWidget = nullptr;
}
gcn::FocusHandler::requestModalFocus(widget);
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 658d65769..b3154fb25 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -48,11 +48,11 @@
#include "debug.h"
// Guichan stuff
-Gui *gui = 0;
-SDLInput *guiInput = 0;
+Gui *gui = nullptr;
+SDLInput *guiInput = nullptr;
// Bolded font
-gcn::Font *boldFont = 0;
+gcn::Font *boldFont = nullptr;
class GuiConfigListener : public ConfigListener
{
@@ -75,7 +75,7 @@ class GuiConfigListener : public ConfigListener
Gui::Gui(Graphics *graphics):
mCustomCursor(false),
- mMouseCursors(NULL),
+ mMouseCursors(nullptr),
mMouseCursorAlpha(1.0f),
mMouseInactivityTimer(0),
mCursorType(CURSOR_POINTER)
@@ -205,28 +205,28 @@ Gui::~Gui()
{
config.removeListener("customcursor", mConfigListener);
delete mConfigListener;
- mConfigListener = 0;
+ mConfigListener = nullptr;
if (mMouseCursors)
{
mMouseCursors->decRef();
- mMouseCursors = 0;
+ mMouseCursors = nullptr;
}
delete mGuiFont;
- mGuiFont = 0;
+ mGuiFont = nullptr;
delete boldFont;
- boldFont = 0;
+ boldFont = nullptr;
delete mHelpFont;
- mHelpFont = 0;
+ mHelpFont = nullptr;
delete mSecureFont;
- mSecureFont = 0;
+ mSecureFont = nullptr;
delete mInfoParticleFont;
- mInfoParticleFont = 0;
+ mInfoParticleFont = nullptr;
delete getTop();
delete guiInput;
- guiInput = 0;
+ guiInput = nullptr;
Theme::deleteInstance();
}
@@ -306,7 +306,7 @@ void Gui::setUseCustomCursor(bool customCursor)
if (mMouseCursors)
{
mMouseCursors->decRef();
- mMouseCursors = NULL;
+ mMouseCursors = nullptr;
}
}
}
@@ -357,13 +357,13 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
gcn::Widget* parent = source;
gcn::Widget* widget = source;
- if (!force && mFocusHandler->getModalFocused() != NULL
+ if (!force && mFocusHandler->getModalFocused() != nullptr
&& !widget->isModalFocused())
{
return;
}
- if (!force && mFocusHandler->getModalMouseInputFocused() != NULL
+ if (!force && mFocusHandler->getModalMouseInputFocused() != nullptr
&& !widget->isModalMouseInputFocused())
{
return;
@@ -373,7 +373,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
mAltPressed, mMetaPressed, type, button,
x, y, mClickCount);
- while (parent != NULL)
+ while (parent)
{
// If the widget has been removed due to input
// cancel the distribution.
@@ -443,7 +443,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
// If a non modal focused widget has been reach
// and we have modal focus cancel the distribution.
- if (mFocusHandler->getModalFocused() != NULL
+ if (mFocusHandler->getModalFocused()
&& !widget->isModalFocused())
{
break;
@@ -451,7 +451,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
// If a non modal mouse input focused widget has been reach
// and we have modal mouse input focus cancel the distribution.
- if (mFocusHandler->getModalMouseInputFocused() != NULL
+ if (mFocusHandler->getModalMouseInputFocused()
&& !widget->isModalMouseInputFocused())
{
break;
diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp
index 019baf503..49f309bca 100644
--- a/src/gui/helpwindow.cpp
+++ b/src/gui/helpwindow.cpp
@@ -40,7 +40,7 @@
#include "debug.h"
HelpWindow::HelpWindow():
- Window(_("Help"), false, 0, "help.xml")
+ Window(_("Help"), false, nullptr, "help.xml")
{
setMinWidth(300);
setMinHeight(250);
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index f52151698..8ffebebff 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -96,7 +96,7 @@ public:
InventoryWindow::WindowList InventoryWindow::instances;
InventoryWindow::InventoryWindow(Inventory *inventory):
- Window("Inventory", false, 0, "inventory.xml"),
+ Window("Inventory", false, nullptr, "inventory.xml"),
mInventory(inventory),
mDropButton(0),
mSplit(false),
@@ -238,7 +238,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory):
loadWindowState();
slotsChanged(mInventory);
- widgetResized(0);
+ widgetResized(nullptr);
if (!isMainInventory())
setVisible(true);
}
@@ -250,7 +250,7 @@ InventoryWindow::~InventoryWindow()
if (!instances.empty())
instances.front()->updateDropButton();
delete mSortModel;
- mSortModel = 0;
+ mSortModel = nullptr;
}
void InventoryWindow::action(const gcn::ActionEvent &event)
@@ -644,7 +644,7 @@ void InventoryWindow::updateDropButton()
}
else
{
- Item *item = 0;
+ Item *item = nullptr;
if (mItems)
item = mItems->getSelectedItem();
diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp
index 7c5b19415..a80434ac0 100644
--- a/src/gui/itemamountwindow.cpp
+++ b/src/gui/itemamountwindow.cpp
@@ -138,13 +138,13 @@ void ItemAmountWindow::finish(Item *item, int amount, int price, Usage usage)
ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item,
int maxRange):
Window("", true, parent, "amount.xml"),
- mItemPriceTextField(0),
- mGPLabel(0),
+ mItemPriceTextField(nullptr),
+ mGPLabel(nullptr),
mItem(item),
mMax(maxRange),
mUsage(usage),
- mItemPriceSlide(0),
- mItemsModal(0),
+ mItemPriceSlide(nullptr),
+ mItemsModal(nullptr),
mPrice(0)
{
if (!mItem)
@@ -293,7 +293,7 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item,
ItemAmountWindow::~ItemAmountWindow()
{
delete mItemPopup;
- mItemPopup = 0;
+ mItemPopup = nullptr;
}
// Show ItemTooltip
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index b05d7fe28..2e87cd544 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -50,7 +50,7 @@
ItemPopup::ItemPopup():
Popup("ItemPopup", "itempopup.xml"),
- mIcon(0),
+ mIcon(nullptr),
mLastName(""),
mLastColor(1)
{
@@ -76,7 +76,7 @@ ItemPopup::ItemPopup():
mItemWeight->setEditable(false);
mItemWeight->setPosition(getPadding(), 3 * fontHeight + 4 * getPadding());
- mIcon = new Icon(0);
+ mIcon = new Icon(nullptr);
add(mItemName);
add(mItemDesc);
@@ -95,7 +95,7 @@ ItemPopup::~ItemPopup()
if (image)
{
image->decRef();
- image = 0;
+ image = nullptr;
}
}
}
@@ -164,7 +164,7 @@ void ItemPopup::setItem(const ItemInfo &item, unsigned char color,
}
else
{
- mIcon->setImage(0);
+ mIcon->setImage(nullptr);
}
mItemType = item.getType();
diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp
index 4bcab0a09..fa6241ef6 100644
--- a/src/gui/killstats.cpp
+++ b/src/gui/killstats.cpp
@@ -43,7 +43,7 @@
#include "debug.h"
KillStats::KillStats():
- Window(_("Kill stats"), false, 0, "killstats.xml"),
+ Window(_("Kill stats"), false, nullptr, "killstats.xml"),
mKillCounter(0), mExpCounter(0),
mKillTCounter(0), mExpTCounter(0), mKillTimer(0),
m1minExpTime(0), m1minExpNum(0), m1minSpeed(0),
diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp
index 136a01b37..86b3dc28b 100644
--- a/src/gui/logindialog.cpp
+++ b/src/gui/logindialog.cpp
@@ -83,7 +83,7 @@ public:
LoginDialog::LoginDialog(LoginData *data, std::string serverName,
std::string *updateHost):
- Window(_("Login"), false, 0, "login.xml"),
+ Window(_("Login"), false, nullptr, "login.xml"),
mLoginData(data),
mUpdateHost(updateHost),
mServerName(serverName)
@@ -166,7 +166,7 @@ LoginDialog::LoginDialog(LoginData *data, std::string serverName,
LoginDialog::~LoginDialog()
{
delete mUpdateTypeModel;
- mUpdateTypeModel = 0;
+ mUpdateTypeModel = nullptr;
}
void LoginDialog::action(const gcn::ActionEvent &event)
@@ -226,9 +226,9 @@ void LoginDialog::keyPressed(gcn::KeyEvent &keyEvent)
gcn::Key key = keyEvent.getKey();
if (key.getValue() == Key::ESCAPE)
- action(gcn::ActionEvent(NULL, mServerButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mServerButton->getActionEventId()));
else if (key.getValue() == Key::ENTER)
- action(gcn::ActionEvent(NULL, mLoginButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mLoginButton->getActionEventId()));
else
mLoginButton->setEnabled(canSubmit());
}
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index e42f12336..d890a462f 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -47,8 +47,8 @@
bool Minimap::mShow = true;
Minimap::Minimap():
- Window(_("Map"), false, 0, "map.xml"),
- mMapImage(0),
+ Window(_("Map"), false, nullptr, "map.xml"),
+ mMapImage(nullptr),
mWidthProportion(0.5),
mHeightProportion(0.5),
mCustomMapImage(false),
@@ -83,7 +83,7 @@ Minimap::~Minimap()
delete mMapImage;
else
mMapImage->decRef();
- mMapImage = 0;
+ mMapImage = nullptr;
}
}
@@ -107,7 +107,7 @@ void Minimap::setMap(Map *map)
delete mMapImage;
else
mMapImage->decRef();
- mMapImage = 0;
+ mMapImage = nullptr;
}
if (map)
diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp
index 3e66f42cb..665d2b61b 100644
--- a/src/gui/ministatuswindow.cpp
+++ b/src/gui/ministatuswindow.cpp
@@ -67,7 +67,7 @@ MiniStatusWindow::MiniStatusWindow():
}
else
{
- mMpBar = 0;
+ mMpBar = nullptr;
}
int job = Net::getPlayerHandler()->getJobLocation()
@@ -85,7 +85,7 @@ MiniStatusWindow::MiniStatusWindow():
}
else
{
- mJobBar = 0;
+ mJobBar = nullptr;
}
mWeightBar = createBar(0, 140, 20, Theme::PROG_WEIGHT,
@@ -100,7 +100,7 @@ MiniStatusWindow::MiniStatusWindow():
mArrowsBar = createBar(0, 50, 20, Theme::PROG_INVY_SLOTS,
"arrows bar", _("arrows bar"));
- mStatusBar = createBar(100, 150, 20, Theme::PROG_EXP,
+ mStatusBar = createBar(100, 165, 20, Theme::PROG_EXP,
"status bar", _("status bar"));
loadBars();
@@ -124,9 +124,9 @@ MiniStatusWindow::MiniStatusWindow():
MiniStatusWindow::~MiniStatusWindow()
{
delete mTextPopup;
- mTextPopup = 0;
+ mTextPopup = nullptr;
delete mStatusPopup;
- mStatusPopup = 0;
+ mStatusPopup = nullptr;
delete_all(mIcons);
mIcons.clear();
@@ -161,7 +161,7 @@ void MiniStatusWindow::updateBars()
{
int x = 0;
std::vector <ProgressBar*>::const_iterator it, it_end;
- ProgressBar* lastBar = 0;
+ ProgressBar* lastBar = nullptr;
for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it)
safeRemove(*it);
for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it)
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index b926d260e..66a30c8a7 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -55,14 +55,14 @@
NpcDialog::DialogList NpcDialog::instances;
-NpcDialog::NpcDialog(int npcId)
- : Window(_("NPC"), false, 0, "npc.xml"),
- mNpcId(npcId),
- mLogInteraction(config.getBoolValue("logNpcInGui")),
- mDefaultInt(0),
- mInputState(NPC_INPUT_NONE),
- mActionState(NPC_ACTION_WAIT),
- mLastNextTime(0)
+NpcDialog::NpcDialog(int npcId) :
+ Window(_("NPC"), false, nullptr, "npc.xml"),
+ mNpcId(npcId),
+ mLogInteraction(config.getBoolValue("logNpcInGui")),
+ mDefaultInt(0),
+ mInputState(NPC_INPUT_NONE),
+ mActionState(NPC_ACTION_WAIT),
+ mLastNextTime(0)
{
// Basic Window Setup
setWindowName("NpcText");
@@ -143,32 +143,32 @@ NpcDialog::~NpcDialog()
clearLayout();
delete mTextBox;
- mTextBox = 0;
+ mTextBox = nullptr;
delete mClearButton;
- mClearButton = 0;
+ mClearButton = nullptr;
delete mButton;
- mButton = 0;
+ mButton = nullptr;
// These might not actually be in the layout, so lets be safe
delete mScrollArea;
- mScrollArea = 0;
+ mScrollArea = nullptr;
delete mItemList;
- mItemList = 0;
+ mItemList = nullptr;
delete mTextField;
- mTextField = 0;
+ mTextField = nullptr;
delete mIntField;
- mIntField = 0;
+ mIntField = nullptr;
delete mResetButton;
- mResetButton = 0;
+ mResetButton = nullptr;
delete mPlusButton;
- mPlusButton = 0;
+ mPlusButton = nullptr;
delete mMinusButton;
- mMinusButton = 0;
+ mMinusButton = nullptr;
delete mItemLinkHandler;
- mItemLinkHandler = 0;
+ mItemLinkHandler = nullptr;
delete mListScrollArea;
- mListScrollArea = 0;
+ mListScrollArea = nullptr;
instances.remove(this);
}
@@ -432,7 +432,7 @@ NpcDialog *NpcDialog::getActive()
return (*it);
}
- return 0;
+ return nullptr;
}
void NpcDialog::closeAll()
diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp
index 67fc57ba9..ada48e832 100644
--- a/src/gui/npcpostdialog.cpp
+++ b/src/gui/npcpostdialog.cpp
@@ -39,7 +39,7 @@
NpcPostDialog::DialogList NpcPostDialog::instances;
NpcPostDialog::NpcPostDialog(int npcId):
- Window(_("NPC"), false, 0, "npcpost.xml"),
+ Window(_("NPC"), false, nullptr, "npcpost.xml"),
mNpcId(npcId)
{
setContentSize(400, 180);
diff --git a/src/gui/okdialog.h b/src/gui/okdialog.h
index 2ee8653ec..2f32d0d65 100644
--- a/src/gui/okdialog.h
+++ b/src/gui/okdialog.h
@@ -23,6 +23,8 @@
#ifndef OK_DIALOG_H
#define OK_DIALOG_H
+#include "localconsts.h"
+
#include "gui/widgets/window.h"
#include <guichan/actionlistener.hpp>
@@ -44,7 +46,7 @@ class OkDialog : public Window, public gcn::ActionListener
*/
OkDialog(const std::string &title, const std::string &msg,
bool modal = true, bool showCenter = true,
- Window *parent = NULL);
+ Window *parent = nullptr);
/**
* Called when receiving actions from the widgets.
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 8e0791af1..c33c753bc 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -57,13 +57,13 @@
float OutfitWindow::mAlpha = 1.0;
OutfitWindow::OutfitWindow():
- Window(_("Outfits"), false, 0, "outfits.xml"),
+ Window(_("Outfits"), false, nullptr, "outfits.xml"),
mBoxWidth(33),
mBoxHeight(33),
mGridWidth(4),
mGridHeight(3),
mItemClicked(false),
- mItemMoved(NULL),
+ mItemMoved(nullptr),
mItemSelected(-1),
mItemColorSelected(1),
mCurrentOutfit(0),
@@ -383,7 +383,7 @@ void OutfitWindow::mouseDragged(gcn::MouseEvent &event)
if (item)
mItemMoved = item;
else
- mItemMoved = 0;
+ mItemMoved = nullptr;
mItems[mCurrentOutfit][index] = -1;
}
}
@@ -433,7 +433,7 @@ void OutfitWindow::mouseReleased(gcn::MouseEvent &event)
const int index = getIndexFromGrid(event.getX(), event.getY());
if (index == -1)
{
- mItemMoved = NULL;
+ mItemMoved = nullptr;
Window::mouseReleased(event);
return;
}
@@ -443,7 +443,7 @@ void OutfitWindow::mouseReleased(gcn::MouseEvent &event)
{
mItems[mCurrentOutfit][index] = mItemMoved->getId();
mItemColors[mCurrentOutfit][index] = mItemMoved->getColor();
- mItemMoved = NULL;
+ mItemMoved = nullptr;
}
if (mItemClicked)
mItemClicked = false;
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index d7c7e54df..b133f66fc 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -85,15 +85,15 @@ std::string tradePartnerName("");
PopupMenu::PopupMenu():
Popup("PopupMenu", "popupmenu.xml"),
mBeingId(0),
- mFloorItem(0),
- mItem(0),
+ mFloorItem(nullptr),
+ mItem(nullptr),
mItemId(0),
mItemColor(1),
- mMapItem(0),
- mTab(0),
- mSpell(0),
- mDialog(0),
- mButton(0),
+ mMapItem(nullptr),
+ mTab(nullptr),
+ mSpell(nullptr),
+ mDialog(nullptr),
+ mButton(nullptr),
mNick(""),
mType(Being::UNKNOWN)
{
@@ -102,10 +102,10 @@ PopupMenu::PopupMenu():
mBrowserBox->setHighlightMode(BrowserBox::BACKGROUND);
mBrowserBox->setOpaque(false);
mBrowserBox->setLinkHandler(this);
- mRenameListener.setMapItem(0);
- mRenameListener.setDialog(0);
+ mRenameListener.setMapItem(nullptr);
+ mRenameListener.setDialog(nullptr);
mPlayerListener.setNick("");
- mPlayerListener.setDialog(0);
+ mPlayerListener.setDialog(nullptr);
mPlayerListener.setType(Being::UNKNOWN);
add(mBrowserBox);
@@ -145,6 +145,7 @@ void PopupMenu::showPopup(int x, int y, Being *being)
mBrowserBox->addRow("disregard", _("Disregard"));
mBrowserBox->addRow("ignore", _("Ignore"));
mBrowserBox->addRow("blacklist", _("Black list"));
+ mBrowserBox->addRow("enemy", _("Set as enemy"));
mBrowserBox->addRow("erase", _("Erase"));
break;
@@ -152,6 +153,7 @@ void PopupMenu::showPopup(int x, int y, Being *being)
mBrowserBox->addRow("disregard", _("Disregard"));
mBrowserBox->addRow("ignore", _("Ignore"));
mBrowserBox->addRow("blacklist", _("Black list"));
+ mBrowserBox->addRow("enemy", _("Set as enemy"));
mBrowserBox->addRow("erase", _("Erase"));
break;
@@ -159,6 +161,15 @@ void PopupMenu::showPopup(int x, int y, Being *being)
mBrowserBox->addRow("unignore", _("Unignore"));
mBrowserBox->addRow("disregard", _("Disregard"));
mBrowserBox->addRow("ignore", _("Ignore"));
+ mBrowserBox->addRow("enemy", _("Set as enemy"));
+ mBrowserBox->addRow("erase", _("Erase"));
+ break;
+
+ case PlayerRelation::ENEMY2:
+ mBrowserBox->addRow("unignore", _("Unignore"));
+ mBrowserBox->addRow("disregard", _("Disregard"));
+ mBrowserBox->addRow("ignore", _("Ignore"));
+ mBrowserBox->addRow("blacklist", _("Black list"));
mBrowserBox->addRow("erase", _("Erase"));
break;
@@ -379,6 +390,7 @@ void PopupMenu::showPlayerPopup(int x, int y, std::string nick)
mBrowserBox->addRow("disregard", _("Disregard"));
mBrowserBox->addRow("ignore", _("Ignore"));
mBrowserBox->addRow("blacklist", _("Black list"));
+ mBrowserBox->addRow("enemy", _("Set as enemy"));
mBrowserBox->addRow("erase", _("Erase"));
break;
@@ -386,6 +398,7 @@ void PopupMenu::showPlayerPopup(int x, int y, std::string nick)
mBrowserBox->addRow("disregard", _("Disregard"));
mBrowserBox->addRow("ignore", _("Ignore"));
mBrowserBox->addRow("blacklist", _("Black list"));
+ mBrowserBox->addRow("enemy", _("Set as enemy"));
mBrowserBox->addRow("erase", _("Erase"));
break;
@@ -393,6 +406,7 @@ void PopupMenu::showPlayerPopup(int x, int y, std::string nick)
mBrowserBox->addRow("unignore", _("Unignore"));
mBrowserBox->addRow("disregard", _("Disregard"));
mBrowserBox->addRow("ignore", _("Ignore"));
+ mBrowserBox->addRow("enemy", _("Set as enemy"));
mBrowserBox->addRow("erase", _("Erase"));
break;
@@ -407,6 +421,14 @@ void PopupMenu::showPlayerPopup(int x, int y, std::string nick)
mBrowserBox->addRow("erase", _("Erase"));
break;
+ case PlayerRelation::ENEMY2:
+ mBrowserBox->addRow("unignore", _("Unignore"));
+ mBrowserBox->addRow("disregard", _("Disregard"));
+ mBrowserBox->addRow("ignore", _("Ignore"));
+ mBrowserBox->addRow("blacklist", _("Black list"));
+ mBrowserBox->addRow("erase", _("Erase"));
+ break;
+
case PlayerRelation::ERASED:
mBrowserBox->addRow("unignore", _("Unignore"));
mBrowserBox->addRow("disregard", _("Disregard"));
@@ -625,6 +647,7 @@ void PopupMenu::showChatPopup(int x, int y, ChatTab *tab)
mBrowserBox->addRow("disregard", _("Disregard"));
mBrowserBox->addRow("ignore", _("Ignore"));
mBrowserBox->addRow("blacklist", _("Black list"));
+ mBrowserBox->addRow("enemy", _("Set as enemy"));
mBrowserBox->addRow("erase", _("Erase"));
break;
@@ -632,6 +655,7 @@ void PopupMenu::showChatPopup(int x, int y, ChatTab *tab)
mBrowserBox->addRow("disregard", _("Disregard"));
mBrowserBox->addRow("ignore", _("Ignore"));
mBrowserBox->addRow("blacklist", _("Black list"));
+ mBrowserBox->addRow("enemy", _("Set as enemy"));
mBrowserBox->addRow("erase", _("Erase"));
break;
@@ -639,6 +663,7 @@ void PopupMenu::showChatPopup(int x, int y, ChatTab *tab)
mBrowserBox->addRow("unignore", _("Unignore"));
mBrowserBox->addRow("disregard", _("Disregard"));
mBrowserBox->addRow("ignore", _("Ignore"));
+ mBrowserBox->addRow("enemy", _("Set as enemy"));
mBrowserBox->addRow("erase", _("Erase"));
break;
@@ -648,6 +673,14 @@ void PopupMenu::showChatPopup(int x, int y, ChatTab *tab)
mBrowserBox->addRow("erase", _("Erase"));
break;
+ case PlayerRelation::ENEMY2:
+ mBrowserBox->addRow("unignore", _("Unignore"));
+ mBrowserBox->addRow("disregard", _("Disregard"));
+ mBrowserBox->addRow("ignore", _("Ignore"));
+ mBrowserBox->addRow("blacklist", _("Black list"));
+ mBrowserBox->addRow("erase", _("Erase"));
+ break;
+
case PlayerRelation::IGNORED:
mBrowserBox->addRow("unignore", _("Unignore"));
mBrowserBox->addRow("erase", _("Erase"));
@@ -800,9 +833,9 @@ void PopupMenu::showChangePos(int x, int y)
else
{
mBeingId = 0;
- mFloorItem = 0;
- mItem = 0;
- mMapItem = 0;
+ mFloorItem = nullptr;
+ mItem = nullptr;
+ mMapItem = nullptr;
mNick = "";
mType = Being::UNKNOWN;
setVisible(false);
@@ -895,6 +928,16 @@ void PopupMenu::handleLink(const std::string &link,
{
player_relations.setRelation(mNick, PlayerRelation::BLACKLISTED);
}
+ else if (link == "enemy" && being &&
+ being->getType() == ActorSprite::PLAYER)
+ {
+ player_relations.setRelation(being->getName(),
+ PlayerRelation::ENEMY2);
+ }
+ else if (link == "enemy" && !mNick.empty())
+ {
+ player_relations.setRelation(mNick, PlayerRelation::ENEMY2);
+ }
else if (link == "erase" && being &&
being->getType() == ActorSprite::PLAYER)
{
@@ -1640,11 +1683,11 @@ void PopupMenu::handleLink(const std::string &link,
setVisible(false);
mBeingId = 0;
- mFloorItem = 0;
- mItem = 0;
+ mFloorItem = nullptr;
+ mItem = nullptr;
mItemId = 0;
mItemColor = 1;
- mMapItem = 0;
+ mMapItem = nullptr;
mNick = "";
mType = Being::UNKNOWN;
}
@@ -1747,7 +1790,7 @@ void PopupMenu::showItemPopup(int x, int y, int itemId, unsigned char color)
}
else
{
- mItem = 0;
+ mItem = nullptr;
mItemId = itemId;
mItemColor = color;
mBrowserBox->clearRows();
@@ -2023,8 +2066,8 @@ void PopupMenu::showPopup(int x, int y)
}
RenameListener::RenameListener() :
- mMapItem(0),
- mDialog(0)
+ mMapItem(nullptr),
+ mDialog(nullptr)
{
}
@@ -2037,7 +2080,7 @@ void RenameListener::action(const gcn::ActionEvent &event)
return;
SpecialLayer *sl = map->getSpecialLayer();
- MapItem *item = 0;
+ MapItem *item = nullptr;
if (sl)
{
item = sl->getTile(mMapItem->getX(), mMapItem->getY());
@@ -2056,12 +2099,12 @@ void RenameListener::action(const gcn::ActionEvent &event)
if (socialWindow)
socialWindow->updatePortalNames();
}
- mDialog = 0;
+ mDialog = nullptr;
}
PlayerListener::PlayerListener() :
mNick(""),
- mDialog(0),
+ mDialog(nullptr),
mType(Being::UNKNOWN)
{
}
@@ -2077,5 +2120,5 @@ void PlayerListener::action(const gcn::ActionEvent &event)
being->setComment(comment);
Being::saveComment(mNick, comment, mType);
}
- mDialog = 0;
+ mDialog = nullptr;
}
diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp
index 05691c2d2..450cfd86e 100644
--- a/src/gui/quitdialog.cpp
+++ b/src/gui/quitdialog.cpp
@@ -44,7 +44,7 @@
#include "debug.h"
QuitDialog::QuitDialog(QuitDialog** pointerToMe):
- Window(_("Quit"), true, 0, "quit.xml"),
+ Window(_("Quit"), true, nullptr, "quit.xml"),
mMyPointer(pointerToMe)
{
mForceQuit = new RadioButton(_("Quit"), "quitdialog");
@@ -98,16 +98,16 @@ QuitDialog::QuitDialog(QuitDialog** pointerToMe):
QuitDialog::~QuitDialog()
{
if (mMyPointer)
- *mMyPointer = 0;
+ *mMyPointer = nullptr;
// Optional widgets, so delete them by hand.
delete mForceQuit;
- mForceQuit = 0;
+ mForceQuit = nullptr;
delete mLogoutQuit;
- mLogoutQuit = 0;
+ mLogoutQuit = nullptr;
delete mSwitchAccountServer;
- mSwitchAccountServer = 0;
+ mSwitchAccountServer = nullptr;
delete mSwitchCharacter;
- mSwitchCharacter = 0;
+ mSwitchCharacter = nullptr;
}
void QuitDialog::placeOption(ContainerPlacer &placer, gcn::RadioButton *option)
@@ -133,13 +133,13 @@ void QuitDialog::action(const gcn::ActionEvent &event)
}
else if (mLogoutQuit->isSelected())
{
- Client::closeDialogs();
+ Game::closeDialogs();
Client::setState(STATE_EXIT);
}
else if (Net::getGameHandler()->isConnected()
&& mSwitchAccountServer->isSelected())
{
- Client::closeDialogs();
+ Game::closeDialogs();
Client::setState(STATE_SWITCH_SERVER);
}
else if (mSwitchCharacter->isSelected())
@@ -147,7 +147,7 @@ void QuitDialog::action(const gcn::ActionEvent &event)
if (Client::getState() == STATE_GAME)
{
Net::getCharHandler()->switchCharacter();
- Client::closeDialogs();
+ Game::closeDialogs();
}
}
}
@@ -162,10 +162,11 @@ void QuitDialog::keyPressed(gcn::KeyEvent &keyEvent)
switch (key.getValue())
{
case Key::ENTER:
- action(gcn::ActionEvent(NULL, mOkButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mOkButton->getActionEventId()));
break;
case Key::ESCAPE:
- action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr,
+ mCancelButton->getActionEventId()));
break;
case Key::UP:
dir = -1;
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 062275b80..29030aa72 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -47,7 +47,7 @@
#include "debug.h"
WrongDataNoticeListener::WrongDataNoticeListener():
- mTarget(0)
+ mTarget(nullptr)
{
}
@@ -63,10 +63,10 @@ void WrongDataNoticeListener::action(const gcn::ActionEvent &event)
}
RegisterDialog::RegisterDialog(LoginData *data):
- Window(_("Register"), false, 0, "register.xml"),
- mEmailField(0),
- mMaleButton(0),
- mFemaleButton(0),
+ Window(_("Register"), false, nullptr, "register.xml"),
+ mEmailField(nullptr),
+ mMaleButton(nullptr),
+ mFemaleButton(nullptr),
mWrongDataNoticeListener(new WrongDataNoticeListener),
mLoginData(data)
{
@@ -147,7 +147,7 @@ RegisterDialog::RegisterDialog(LoginData *data):
RegisterDialog::~RegisterDialog()
{
delete mWrongDataNoticeListener;
- mWrongDataNoticeListener = 0;
+ mWrongDataNoticeListener = nullptr;
}
void RegisterDialog::action(const gcn::ActionEvent &event)
diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp
index b196ae4e4..001a8671a 100644
--- a/src/gui/sdlfont.cpp
+++ b/src/gui/sdlfont.cpp
@@ -49,14 +49,14 @@ class SDLTextChunk
{
public:
SDLTextChunk(const std::string &text0, const gcn::Color &color0) :
- img(0), text(text0), color(color0)
+ img(nullptr), text(text0), color(color0)
{
}
~SDLTextChunk()
{
delete img;
- img = 0;
+ img = nullptr;
}
bool operator==(const SDLTextChunk &chunk) const
@@ -79,7 +79,7 @@ class SDLTextChunk
if (!surface)
{
- img = 0;
+ img = nullptr;
return;
}
@@ -138,7 +138,7 @@ SDLFont::SDLFont(const std::string &filename, int size, int style) :
SDLFont::~SDLFont()
{
TTF_CloseFont(mFont);
- mFont = 0;
+ mFont = nullptr;
--fontCounter;
if (fontCounter == 0)
diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp
index bbd0a71c1..e1a77f6c9 100644
--- a/src/gui/selldialog.cpp
+++ b/src/gui/selldialog.cpp
@@ -50,14 +50,14 @@
SellDialog::DialogList SellDialog::instances;
SellDialog::SellDialog(int npcId):
- Window(_("Sell"), false, 0, "sell.xml"),
+ Window(_("Sell"), false, nullptr, "sell.xml"),
mNpcId(npcId), mMaxItems(0), mAmountItems(0), mNick("")
{
init();
}
SellDialog::SellDialog(std::string nick):
- Window(_("Sell"), false, 0, "sell.xml"),
+ Window(_("Sell"), false, nullptr, "sell.xml"),
mNpcId(-1), mMaxItems(0), mAmountItems(0), mNick(nick)
{
init();
@@ -133,7 +133,7 @@ void SellDialog::init()
SellDialog::~SellDialog()
{
delete mShopItems;
- mShopItems = 0;
+ mShopItems = nullptr;
instances.remove(this);
}
@@ -290,7 +290,7 @@ void SellDialog::updateButtonsAndLabels()
{
int selectedItem = mShopItemList->getSelected();
int income = 0;
- ShopItem *item = 0;
+ ShopItem *item = nullptr;
if (selectedItem > -1 && mShopItems->at(selectedItem))
{
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 5a00d4a76..3fd298159 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -234,15 +234,15 @@ private:
ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir):
- Window(_("Choose Your Server"), false, 0, "server.xml"),
+ Window(_("Choose Your Server"), false, nullptr, "server.xml"),
mDir(dir),
// mDownloadStatus(DOWNLOADING_PREPARING),
mDownloadStatus(DOWNLOADING_UNKNOWN),
- mDownload(0),
+ mDownload(nullptr),
mDownloadProgress(-1.0f),
mServers(ServerInfos()),
mServerInfo(serverInfo),
- mPersistentIPCheckBox(0)
+ mPersistentIPCheckBox(nullptr)
{
if (isSafeMode)
setCaption(_("Choose Your Server *** SAFE MODE ***"));
@@ -377,12 +377,12 @@ ServerDialog::~ServerDialog()
{
mDownload->cancel();
delete mDownload;
- mDownload = 0;
+ mDownload = nullptr;
}
delete mServersListModel;
- mServersListModel = 0;
+ mServersListModel = nullptr;
delete mTypeListModel;
- mTypeListModel = 0;
+ mTypeListModel = nullptr;
}
void ServerDialog::action(const gcn::ActionEvent &event)
@@ -489,7 +489,7 @@ void ServerDialog::keyPressed(gcn::KeyEvent &keyEvent)
if (key.getValue() == Key::ESCAPE)
Client::setState(STATE_EXIT);
else if (key.getValue() == Key::ENTER)
- action(gcn::ActionEvent(NULL, mConnectButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mConnectButton->getActionEventId()));
}
void ServerDialog::valueChanged(const gcn::SelectionEvent &)
@@ -617,7 +617,7 @@ void ServerDialog::downloadServerList()
{
mDownload->cancel();
delete mDownload;
- mDownload = 0;
+ mDownload = nullptr;
}
mDownload = new Net::Download(this, listFile, &downloadUpdate);
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index ae7a3109c..d305824d5 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -51,7 +51,7 @@
extern Window *statusWindow;
Setup::Setup():
- Window(_("Setup"), false, 0, "setup.xml")
+ Window(_("Setup"), false, nullptr, "setup.xml")
{
setCloseButton(true);
setResizable(true);
@@ -72,7 +72,7 @@ Setup::Setup():
N_("Cancel"),
N_("Store"),
N_("Reset Windows"),
- 0
+ nullptr
};
int x = width;
for (const char **curBtn = buttonNames; *curBtn; ++curBtn)
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index 7c0306f8f..6f1a4afce 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -65,7 +65,7 @@ Setup_Colors::Setup_Colors() :
mPreview->setOpaque(false);
// don't do anything with links
- mPreview->setLinkHandler(NULL);
+ mPreview->setLinkHandler(nullptr);
mPreviewBox = new ScrollArea(mPreview);
mPreviewBox->setHeight(20);
@@ -188,12 +188,12 @@ Setup_Colors::~Setup_Colors()
if (mPreviewBox && mPreviewBox->getContent() == mPreview)
{
delete mTextPreview;
- mTextPreview = 0;
+ mTextPreview = nullptr;
}
else
{
delete mPreview;
- mPreview = 0;
+ mPreview = nullptr;
}
}
@@ -251,7 +251,7 @@ void Setup_Colors::valueChanged(const gcn::SelectionEvent &event A_UNUSED)
mPreviewBox->setContent(mTextPreview);
mTextPreview->setFont(boldFont);
mTextPreview->setTextColor(col);
- mTextPreview->setTextBGColor(NULL);
+ mTextPreview->setTextBGColor(nullptr);
mTextPreview->setOpaque(false);
mTextPreview->setShadow(true);
mTextPreview->setOutline(true);
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index aadfc11e3..7899247e3 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -24,54 +24,117 @@
#include "configuration.h"
#include "joystick.h"
+#include "logger.h"
#include "gui/widgets/button.h"
#include "gui/widgets/checkbox.h"
+#include "gui/widgets/dropdown.h"
#include "gui/widgets/label.h"
#include "gui/widgets/layouthelper.h"
#include "utils/gettext.h"
+#include <guichan/listmodel.hpp>
+
#include "debug.h"
extern Joystick *joystick;
+class NamesModel : public gcn::ListModel
+{
+ public:
+ NamesModel()
+ { }
+
+ virtual ~NamesModel()
+ { }
+
+ virtual int getNumberOfElements()
+ {
+ return static_cast<int>(mNames.size());
+ }
+
+ virtual std::string getElementAt(int i)
+ {
+ if (i >= getNumberOfElements() || i < 0)
+ return _("???");
+
+ return mNames[i];
+ }
+
+ std::vector<std::string> mNames;
+};
+
+
Setup_Joystick::Setup_Joystick():
mCalibrateLabel(new Label(_("Press the button to start calibration"))),
mCalibrateButton(new Button(_("Calibrate"), "calibrate", this)),
- mJoystickEnabled(new CheckBox(_("Enable joystick")))
+ mJoystickEnabled(new CheckBox(_("Enable joystick"))),
+ mNamesModel(new NamesModel()),
+ mNamesDropDown(new DropDown(mNamesModel)),
+ mUseInactiveCheckBox(new CheckBox(_("Use joystick if client "
+ "window inactive"), config.getBoolValue("useInactiveJoystick")))
{
setName(_("Joystick"));
- mOriginalJoystickEnabled = !config.getBoolValue("joystickEnabled");
- mJoystickEnabled->setSelected(mOriginalJoystickEnabled);
+ Joystick::getNames(mNamesModel->mNames);
+ mOriginalJoystickEnabled = config.getBoolValue("joystickEnabled");
+ mJoystickEnabled->setSelected(mOriginalJoystickEnabled);
+ mJoystickEnabled->setActionEventId("joystick");
mJoystickEnabled->addActionListener(this);
+ mCalibrateButton->setEnabled(mOriginalJoystickEnabled);
+
+ mNamesDropDown->setActionEventId("name");
+ mNamesDropDown->addActionListener(this);
+
+ if (joystick)
+ {
+ mNamesDropDown->setSelected(joystick->getNumber());
+ }
+ else
+ {
+ unsigned sel = config.getIntValue("selectedJoystick");
+ if (sel >= mNamesModel->mNames.size())
+ sel = 0;
+ mNamesDropDown->setSelected(sel);
+ }
// Do the layout
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
place(0, 0, mJoystickEnabled);
- place(0, 1, mCalibrateLabel);
- place.getCell().matchColWidth(0, 0);
- place = h.getPlacer(0, 1);
- place(0, 0, mCalibrateButton);
+ place(0, 1, mNamesDropDown);
+ place(0, 2, mUseInactiveCheckBox);
+ place(0, 3, mCalibrateLabel);
+ place(0, 4, mCalibrateButton);
setDimension(gcn::Rectangle(0, 0, 365, 75));
}
-void Setup_Joystick::action(const gcn::ActionEvent &event)
+Setup_Joystick::~Setup_Joystick()
{
- if (!joystick)
- return;
+ delete mNamesModel;
+ mNamesModel = nullptr;
+}
+void Setup_Joystick::action(const gcn::ActionEvent &event)
+{
if (event.getSource() == mJoystickEnabled)
{
- joystick->setEnabled(mJoystickEnabled->isSelected());
+ setTempEnabled(mJoystickEnabled->isSelected());
+ }
+ else if (event.getSource() == mNamesDropDown)
+ {
+ if (joystick)
+ joystick->setNumber(mNamesDropDown->getSelected());
}
else
{
+ if (!joystick)
+ return;
+
if (joystick->isCalibrating())
{
mCalibrateButton->setCaption(_("Calibrate"));
@@ -82,23 +145,46 @@ void Setup_Joystick::action(const gcn::ActionEvent &event)
else
{
mCalibrateButton->setCaption(_("Stop"));
- mCalibrateLabel->setCaption(_("Rotate the stick"));
+ mCalibrateLabel->setCaption(
+ _("Rotate the stick and dont press buttons"));
joystick->startCalibration();
}
}
}
+void Setup_Joystick::setTempEnabled(bool sel)
+{
+ Joystick::setEnabled(sel);
+ mCalibrateButton->setEnabled(sel);
+ if (joystick)
+ {
+ if (sel)
+ joystick->open();
+ else
+ joystick->close();
+ }
+}
+
void Setup_Joystick::cancel()
{
if (joystick)
joystick->setEnabled(mOriginalJoystickEnabled);
+ if (mOriginalJoystickEnabled != mJoystickEnabled->isSelected())
+ setTempEnabled(mOriginalJoystickEnabled);
+
mJoystickEnabled->setSelected(mOriginalJoystickEnabled);
}
void Setup_Joystick::apply()
{
+ if (!joystick)
+ return;
+
config.setValue("joystickEnabled",
- joystick ? joystick->isEnabled() : false);
-}
+ joystick ? joystick->isEnabled() : false);
+ config.setValue("useInactiveJoystick", mUseInactiveCheckBox->isSelected());
+ if (joystick)
+ joystick->setUseInactive(mUseInactiveCheckBox->isSelected());
+}
diff --git a/src/gui/setup_joystick.h b/src/gui/setup_joystick.h
index d18d5a7fb..5bd72cdad 100644
--- a/src/gui/setup_joystick.h
+++ b/src/gui/setup_joystick.h
@@ -29,21 +29,32 @@
#include <guichan/actionlistener.hpp>
+class DropDown;
+class NamesModel;
+
class Setup_Joystick : public SetupTab
{
public:
Setup_Joystick();
+ ~Setup_Joystick();
+
void apply();
+
void cancel();
void action(const gcn::ActionEvent &event);
+ void setTempEnabled(bool sel);
+
private:
gcn::Label *mCalibrateLabel;
gcn::Button *mCalibrateButton;
bool mOriginalJoystickEnabled;
gcn::CheckBox *mJoystickEnabled;
+ NamesModel *mNamesModel;
+ DropDown *mNamesDropDown;
+ gcn::CheckBox *mUseInactiveCheckBox;
};
#endif
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index 922d9797b..fa7a63b8c 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -112,16 +112,16 @@ Setup_Keyboard::Setup_Keyboard():
Setup_Keyboard::~Setup_Keyboard()
{
delete mKeyList;
- mKeyList = 0;
+ mKeyList = nullptr;
delete mKeyListModel;
- mKeyListModel = 0;
+ mKeyListModel = nullptr;
delete mAssignKeyButton;
- mAssignKeyButton = 0;
+ mAssignKeyButton = nullptr;
delete mUnassignKeyButton;
- mUnassignKeyButton = 0;
+ mUnassignKeyButton = nullptr;
delete mMakeDefaultButton;
- mMakeDefaultButton = 0;
+ mMakeDefaultButton = nullptr;
}
void Setup_Keyboard::apply()
diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp
index 23fb5c086..bd445cfa0 100644
--- a/src/gui/setup_other.cpp
+++ b/src/gui/setup_other.cpp
@@ -171,8 +171,9 @@ Setup_Other::Setup_Other()
new SetupItemCheckBox(_("Enable bot checker"), "",
"enableBotCheker", this, "enableBotChekerEvent");
- new SetupItemCheckBox(_("Enable buggy servers protection"), "",
- "enableBuggyServers", this, "enableBuggyServersEvent", false);
+ new SetupItemCheckBox(_("Enable buggy servers protection "
+ "(do not disable)"), "", "enableBuggyServers", this,
+ "enableBuggyServersEvent", false);
new SetupItemCheckBox(_("Enable debug log"), "",
"debugLog", this, "debugLogEvent");
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp
index 6c57d981e..8ac61f90c 100644
--- a/src/gui/setup_relations.cpp
+++ b/src/gui/setup_relations.cpp
@@ -72,7 +72,8 @@ static const char *RELATION_NAMES[PlayerRelation::RELATIONS_NR] =
N_("Disregarded"),
N_("Ignored"),
N_("Erased"),
- N_("Blacklisted")
+ N_("Blacklisted"),
+ N_("Enemy")
};
class PlayerRelationListModel : public gcn::ListModel
@@ -97,7 +98,7 @@ class PlayerTableModel : public TableModel
{
public:
PlayerTableModel() :
- mPlayers(NULL),
+ mPlayers(nullptr),
mListModel(new PlayerRelationListModel)
{
playerRelationsUpdated();
@@ -107,9 +108,9 @@ public:
{
freeWidgets();
delete mListModel;
- mListModel = 0;
+ mListModel = nullptr;
delete mPlayers;
- mPlayers = 0;
+ mPlayers = nullptr;
}
virtual int getRows() const
@@ -184,7 +185,7 @@ public:
virtual void freeWidgets()
{
delete mPlayers;
- mPlayers = 0;
+ mPlayers = nullptr;
delete_all(mWidgets);
mWidgets.clear();
@@ -309,7 +310,7 @@ Setup_Relations::~Setup_Relations()
{
player_relations.removeListener(this);
delete mIgnoreActionChoicesModel;
- mIgnoreActionChoicesModel = 0;
+ mIgnoreActionChoicesModel = nullptr;
}
diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp
index 05f8c7315..3b1c1d932 100644
--- a/src/gui/setup_theme.cpp
+++ b/src/gui/setup_theme.cpp
@@ -47,6 +47,7 @@
const char* ACTION_THEME = "theme";
const char* ACTION_FONT = "font";
+const char* ACTION_LANG = "lang";
const char* ACTION_BOLD_FONT = "bold font";
const char* ACTION_PARTICLE_FONT = "particle font";
const char* ACTION_HELP_FONT = "help font";
@@ -84,7 +85,7 @@ class ThemesModel : public NamesModel
public:
ThemesModel()
{
- mNames.push_back("(default)");
+ mNames.push_back(gettext("(default)"));
Theme::fillSkinsList(mNames);
}
@@ -130,9 +131,55 @@ public:
}
};
+struct Language
+{
+ std::string name;
+
+ std::string value;
+};
+
+const int langs_count = 14;
+
+const Language LANG_NAME[langs_count] =
+{
+ {N_("(default)"), ""},
+ {N_("Chinese (China)"), "zh_CN"},
+ {N_("Czech"), "cs_CZ"},
+ {N_("English"), "C"},
+ {N_("Finnish"), "fi_FI"},
+ {N_("French"), "fr_FR"},
+ {N_("German"), "de_DE"},
+ {N_("Indonesian"), "id_ID"},
+ {N_("Japanese"), "ja_JP.utf8"},
+ {N_("Dutch (Belgium/Flemish)"), "nl_BE"},
+ {N_("Portuguese"), "pt_PT"},
+ {N_("Portuguese (Brazilian)"), "pt_BR"},
+ {N_("Russian"), "ru_RU"},
+ {N_("Spanish (Castilian)"), "es_ES"}
+};
+
+class LangListModel : public gcn::ListModel
+{
+public:
+ virtual ~LangListModel()
+ { }
+
+ virtual int getNumberOfElements()
+ { return langs_count; }
+
+ virtual std::string getElementAt(int i)
+ {
+ if (i >= getNumberOfElements() || i < 0)
+ return _("???");
+
+ return gettext(LANG_NAME[i].name.c_str());
+ }
+};
+
Setup_Theme::Setup_Theme():
mTheme(config.getValue("theme", config.getValue("selectedSkin", ""))),
mFont(config.getStringValue("font")),
+ mLang(config.getStringValue("lang")),
mBoldFont(config.getStringValue("boldFont")),
mParticleFont(config.getStringValue("particleFont")),
mHelpFont(config.getStringValue("helpFont")),
@@ -143,6 +190,7 @@ Setup_Theme::Setup_Theme():
setName(_("Theme"));
mThemeLabel = new Label(_("Gui theme"));
+ mLangLabel = new Label(_("Language"));
mFontLabel = new Label(_("Main Font"));
mBoldFontLabel = new Label(_("Bold font"));
mParticleFontLabel = new Label(_("Particle font"));
@@ -151,6 +199,7 @@ Setup_Theme::Setup_Theme():
mJapanFontLabel = new Label(_("Japanese font"));
mThemesModel = new ThemesModel();
mFontsModel = new FontsModel();
+ mLangListModel = new LangListModel();
mThemeDropDown = new DropDown(mThemesModel);
mThemeDropDown->setActionEventId(ACTION_THEME);
@@ -160,6 +209,10 @@ Setup_Theme::Setup_Theme():
mFontDropDown->setActionEventId(ACTION_FONT);
mFontDropDown->addActionListener(this);
+ mLangDropDown = new DropDown(mLangListModel);
+ mLangDropDown->setActionEventId(ACTION_LANG);
+ mLangDropDown->addActionListener(this);
+
mBoldFontDropDown = new DropDown(mFontsModel);
mBoldFontDropDown->setActionEventId(ACTION_BOLD_FONT);
mBoldFontDropDown->addActionListener(this);
@@ -192,6 +245,17 @@ Setup_Theme::Setup_Theme():
else
mThemeDropDown->setSelected(0);
+ const std::string str = config.getStringValue("lang");
+
+ for (int f = 0; f < langs_count; f ++)
+ {
+ if (LANG_NAME[f].value == str)
+ {
+ mLangDropDown->setSelected(f);
+ break;
+ }
+ }
+
mFontDropDown->setSelectedString(getFileName(
config.getStringValue("font")));
mBoldFontDropDown->setSelectedString(getFileName(
@@ -210,22 +274,24 @@ Setup_Theme::Setup_Theme():
ContainerPlacer place = h.getPlacer(0, 0);
place(0, 0, mThemeLabel, 5);
- place(0, 1, fontSizeLabel, 5);
- place(0, 2, mFontLabel, 5);
- place(0, 3, mBoldFontLabel, 5);
- place(0, 4, mParticleFontLabel, 5);
- place(0, 5, mHelpFontLabel, 5);
- place(0, 6, mSecureFontLabel, 5);
- place(0, 7, mJapanFontLabel, 5);
+ place(0, 1, mLangLabel, 5);
+ place(0, 2, fontSizeLabel, 5);
+ place(0, 3, mFontLabel, 5);
+ place(0, 4, mBoldFontLabel, 5);
+ place(0, 5, mParticleFontLabel, 5);
+ place(0, 6, mHelpFontLabel, 5);
+ place(0, 7, mSecureFontLabel, 5);
+ place(0, 8, mJapanFontLabel, 5);
place(6, 0, mThemeDropDown, 10);
- place(6, 1, mFontSizeDropDown, 10);
- place(6, 2, mFontDropDown, 10);
- place(6, 3, mBoldFontDropDown, 10);
- place(6, 4, mParticleFontDropDown, 10);
- place(6, 5, mHelpFontDropDown, 10);
- place(6, 6, mSecureFontDropDown, 10);
- place(6, 7, mJapanFontDropDown, 10);
+ place(6, 1, mLangDropDown, 10);
+ place(6, 2, mFontSizeDropDown, 10);
+ place(6, 3, mFontDropDown, 10);
+ place(6, 4, mBoldFontDropDown, 10);
+ place(6, 5, mParticleFontDropDown, 10);
+ place(6, 6, mHelpFontDropDown, 10);
+ place(6, 7, mSecureFontDropDown, 10);
+ place(6, 8, mJapanFontDropDown, 10);
place.getCell().matchColWidth(0, 0);
place = h.getPlacer(0, 1);
@@ -236,13 +302,16 @@ Setup_Theme::Setup_Theme():
Setup_Theme::~Setup_Theme()
{
delete mThemesModel;
- mThemesModel = 0;
+ mThemesModel = nullptr;
delete mFontsModel;
- mFontsModel = 0;
+ mFontsModel = nullptr;
delete mFontSizeListModel;
- mFontSizeListModel = 0;
+ mFontSizeListModel = nullptr;
+
+ delete mLangListModel;
+ mLangListModel = nullptr;
}
void Setup_Theme::action(const gcn::ActionEvent &event)
@@ -258,6 +327,14 @@ void Setup_Theme::action(const gcn::ActionEvent &event)
{
mFont = mFontDropDown->getSelectedString();
}
+ else if (event.getId() == ACTION_LANG)
+ {
+ int id = mLangDropDown->getSelected();
+ if (id < 0 || id >= langs_count)
+ mLang = "";
+ else
+ mLang = LANG_NAME[id].value;
+ }
else if (event.getId() == ACTION_BOLD_FONT)
{
mBoldFont = mBoldFontDropDown->getSelectedString();
@@ -283,6 +360,7 @@ void Setup_Theme::action(const gcn::ActionEvent &event)
void Setup_Theme::cancel()
{
mTheme = config.getValue("theme", config.getValue("selectedSkin", ""));
+ mLang = config.getStringValue("lang");
mFont = getFileName(config.getStringValue("font"));
mBoldFont = getFileName(config.getStringValue("boldFont"));
mParticleFont = getFileName(config.getStringValue("particleFont"));
@@ -302,6 +380,7 @@ void Setup_Theme::apply()
config.setValue("selectedSkin", "");
config.setValue("theme", mTheme);
+ config.setValue("lang", mLang);
if (config.getValue("font", "dejavusans.ttf") != mFont
|| config.getValue("boldFont", "dejavusans-bold.ttf") != mBoldFont
|| config.getValue("particleFont", "dejavusans.ttf") != mParticleFont
diff --git a/src/gui/setup_theme.h b/src/gui/setup_theme.h
index c803cc296..1ff159195 100644
--- a/src/gui/setup_theme.h
+++ b/src/gui/setup_theme.h
@@ -30,10 +30,11 @@
#include <guichan/actionlistener.hpp>
+class DropDown;
+class EditDialog;
class FontsModel;
class FontSizeChoiceListModel;
-class EditDialog;
-class DropDown;
+class LangListModel;
class ThemesModel;
class Setup_Theme : public SetupTab
@@ -58,6 +59,12 @@ class Setup_Theme : public SetupTab
DropDown *mFontDropDown;
std::string mFont;
+ LangListModel *mLangListModel;
+
+ gcn::Label *mLangLabel;
+ DropDown *mLangDropDown;
+ std::string mLang;
+
gcn::Label *mBoldFontLabel;
DropDown *mBoldFontDropDown;
std::string mBoldFont;
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index d3c1163dc..794fd3324 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -130,10 +130,10 @@ bool modeSorter(std::string mode1, std::string mode2)
ModeListModel::ModeListModel()
{
/* Get available fullscreen/hardware modes */
- SDL_Rect **modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE);
+ SDL_Rect **modes = SDL_ListModes(nullptr, SDL_FULLSCREEN | SDL_HWSURFACE);
/* Check which modes are available */
- if (modes == static_cast<SDL_Rect **>(0))
+ if (modes == static_cast<SDL_Rect **>(nullptr))
{
logger->log1("No modes available");
}
@@ -310,7 +310,7 @@ Setup_Video::Setup_Video():
mParticleDetail(3 - config.getIntValue("particleEmitterSkip")),
mParticleDetailSlider(new Slider(0, 3)),
mParticleDetailField(new Label),
- mDialog(0)
+ mDialog(nullptr)
{
setName(_("Video"));
@@ -446,13 +446,13 @@ Setup_Video::Setup_Video():
Setup_Video::~Setup_Video()
{
delete mModeListModel;
- mModeListModel = 0;
+ mModeListModel = nullptr;
delete mModeList;
- mModeList = 0;
+ mModeList = nullptr;
delete mOpenGLListModel;
- mOpenGLListModel = 0;
+ mOpenGLListModel = nullptr;
delete mDialog;
- mDialog = 0;
+ mDialog = nullptr;
}
void Setup_Video::apply()
@@ -594,7 +594,7 @@ void Setup_Video::action(const gcn::ActionEvent &event)
if (mDialog)
{
mode = mDialog->getText();
- mDialog = 0;
+ mDialog = nullptr;
}
else
{
@@ -632,7 +632,7 @@ void Setup_Video::action(const gcn::ActionEvent &event)
}
if (id == "~videomode")
{
- mDialog = 0;
+ mDialog = nullptr;
}
else if (id == "guialpha")
{
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index 2215ce699..a50a485ec 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -72,14 +72,14 @@ extern std::string tradePartnerName;
ShopWindow::DialogList ShopWindow::instances;
ShopWindow::ShopWindow():
- Window(_("Personal Shop"), false, 0, "shop.xml"),
+ Window(_("Personal Shop"), false, nullptr, "shop.xml"),
mSelectedItem(-1),
mAnnonceTime(0),
mLastRequestTimeList(0),
mLastRequestTimeItem(0),
mRandCounter(0),
mAcceptPlayer(""),
- mTradeItem(0),
+ mTradeItem(nullptr),
mTradeNick(""),
mTradeMoney(0)
{
@@ -152,8 +152,8 @@ ShopWindow::ShopWindow():
}
else
{
- mBuyAuctionButton = 0;
- mSellAuctionButton = 0;
+ mBuyAuctionButton = nullptr;
+ mSellAuctionButton = nullptr;
}
Layout &layout = getLayout();
@@ -173,10 +173,10 @@ ShopWindow::~ShopWindow()
saveList();
delete mBuyShopItems;
- mBuyShopItems = 0;
+ mBuyShopItems = nullptr;
delete mSellShopItems;
- mSellShopItems = 0;
+ mSellShopItems = nullptr;
instances.remove(this);
}
@@ -602,8 +602,8 @@ void ShopWindow::sendMessage(const std::string &nick,
void ShopWindow::showList(const std::string &nick, std::string data)
{
- BuyDialog *buyDialog = 0;
- SellDialog *sellDialog = 0;
+ BuyDialog *buyDialog = nullptr;
+ SellDialog *sellDialog = nullptr;
if (data.find("B1") == 0)
{
data = data.substr(2);
diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp
index 6d48da197..eff28def7 100644
--- a/src/gui/shortcutwindow.cpp
+++ b/src/gui/shortcutwindow.cpp
@@ -54,7 +54,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title,
ShortcutContainer *content,
std::string skinFile,
int width, int height) :
- Window("Window", false, 0, skinFile)
+ Window("Window", false, nullptr, skinFile)
{
setWindowName(title);
// no title presented, title bar is padding so window can be moved.
@@ -66,7 +66,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title,
setupWindow->registerWindowForReset(this);
- mTabs = 0;
+ mTabs = nullptr;
mItems = content;
const int border = SCROLL_PADDING * 2 + getPadding() * 2;
@@ -100,7 +100,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title,
ShortcutWindow::ShortcutWindow(const std::string &title, std::string skinFile,
int width, int height) :
- Window("Window", false, 0, skinFile)
+ Window("Window", false, nullptr, skinFile)
{
setWindowName(title);
// no title presented, title bar is padding so window can be moved.
@@ -114,7 +114,7 @@ ShortcutWindow::ShortcutWindow(const std::string &title, std::string skinFile,
mTabs = new TabbedArea;
- mItems = 0;
+ mItems = nullptr;
const int border = SCROLL_PADDING * 2 + getPadding() * 2;
@@ -138,9 +138,9 @@ ShortcutWindow::~ShortcutWindow()
if (mTabs)
mTabs->removeAll();
delete mTabs;
- mTabs = 0;
+ mTabs = nullptr;
delete mItems;
- mItems = 0;
+ mItems = nullptr;
}
void ShortcutWindow::addTab(std::string name, ShortcutContainer *content)
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 8f45be5d1..072a9cb85 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -81,8 +81,8 @@ struct SkillInfo
gcn::Color color;
SkillInfo() :
- id(0), name(""), dispName(""), icon(0), modifiable(false),
- visible(false), model(0), skillLevel(""), skillLevelWidth(0),
+ id(0), name(""), dispName(""), icon(nullptr), modifiable(false),
+ visible(false), model(nullptr), skillLevel(""), skillLevelWidth(0),
skillExp(""), progress(0.0f)
{
}
@@ -92,7 +92,7 @@ struct SkillInfo
if (icon)
{
icon->decRef();
- icon = 0;
+ icon = nullptr;
}
}
@@ -161,9 +161,9 @@ public:
~SkillListBox()
{
delete mModel;
- mModel = 0;
+ mModel = nullptr;
delete mPopup;
- mPopup = 0;
+ mPopup = nullptr;
}
SkillInfo *getSelectedInfo()
@@ -172,7 +172,7 @@ public:
if (!mListModel || selected < 0
|| selected > mListModel->getNumberOfElements())
{
- return 0;
+ return nullptr;
}
return static_cast<SkillModel*>(mListModel)->getSkillAt(selected);
@@ -257,7 +257,7 @@ public:
~SkillTab()
{
delete mListBox;
- mListBox = 0;
+ mListBox = nullptr;
}
SkillInfo *getSelectedInfo()
@@ -265,7 +265,7 @@ public:
if (mListBox)
return mListBox->getSelectedInfo();
else
- return 0;
+ return nullptr;
}
private:
@@ -273,7 +273,7 @@ private:
};
SkillDialog::SkillDialog():
- Window(_("Skills"), false, 0, "skills.xml")
+ Window(_("Skills"), false, nullptr, "skills.xml")
{
setWindowName("Skills");
setCloseButton(true);
@@ -286,7 +286,7 @@ SkillDialog::SkillDialog():
mTabs = new TabbedArea();
mPointsLabel = new Label("0");
mIncreaseButton = new Button(_("Up"), "inc", this);
- mDefaultModel = 0;
+ mDefaultModel = nullptr;
place(0, 0, mTabs, 5, 5);
place(0, 5, mPointsLabel, 4);
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index a728d4051..2bc8aba9b 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -66,10 +66,10 @@ protected:
friend class SocialWindow;
SocialTab():
- mInviteDialog(0),
- mConfirmDialog(0),
- mScroll(0),
- mList(0)
+ mInviteDialog(nullptr),
+ mConfirmDialog(nullptr),
+ mScroll(nullptr),
+ mList(nullptr)
{}
virtual ~SocialTab()
@@ -79,14 +79,14 @@ protected:
{
mInviteDialog->close();
mInviteDialog->scheduleDelete();
- mInviteDialog = NULL;
+ mInviteDialog = nullptr;
}
if (mConfirmDialog)
{
mConfirmDialog->close();
mConfirmDialog->scheduleDelete();
- mConfirmDialog = NULL;
+ mConfirmDialog = nullptr;
}
}
@@ -129,9 +129,9 @@ public:
~SocialGuildTab()
{
delete mList;
- mList = 0;
+ mList = nullptr;
delete mScroll;
- mScroll = 0;
+ mScroll = nullptr;
}
void action(const gcn::ActionEvent &event)
@@ -147,11 +147,11 @@ public:
_("Invited user %s to guild %s."),
name.c_str(), mGuild->getName().c_str()), BY_SERVER);
}
- mInviteDialog = 0;
+ mInviteDialog = nullptr;
}
else if (event.getId() == "~do invite")
{
- mInviteDialog = 0;
+ mInviteDialog = nullptr;
}
else if (event.getId() == "yes")
{
@@ -161,11 +161,11 @@ public:
localChatTab->chatLog(strprintf(_("Guild %s quit requested."),
mGuild->getName().c_str()), BY_SERVER);
}
- mConfirmDialog = 0;
+ mConfirmDialog = nullptr;
}
else if (event.getId() == "~yes")
{
- mConfirmDialog = 0;
+ mConfirmDialog = nullptr;
}
}
@@ -227,9 +227,9 @@ public:
~SocialGuildTab2()
{
delete mList;
- mList = 0;
+ mList = nullptr;
delete mScroll;
- mScroll = 0;
+ mScroll = nullptr;
}
void action(const gcn::ActionEvent &event A_UNUSED)
@@ -330,9 +330,9 @@ public:
~SocialPartyTab()
{
delete mList;
- mList = 0;
+ mList = nullptr;
delete mScroll;
- mScroll = 0;
+ mScroll = nullptr;
}
void action(const gcn::ActionEvent &event)
@@ -347,11 +347,11 @@ public:
localChatTab->chatLog(strprintf(_("Invited user %s to party."),
name.c_str()), BY_SERVER);
}
- mInviteDialog = NULL;
+ mInviteDialog = nullptr;
}
else if (event.getId() == "~do invite")
{
- mInviteDialog = NULL;
+ mInviteDialog = nullptr;
}
else if (event.getId() == "yes")
{
@@ -361,11 +361,11 @@ public:
localChatTab->chatLog(strprintf(_("Party %s quit requested."),
mParty->getName().c_str()), BY_SERVER);
}
- mConfirmDialog = NULL;
+ mConfirmDialog = nullptr;
}
else if (event.getId() == "~yes")
{
- mConfirmDialog = NULL;
+ mConfirmDialog = nullptr;
}
}
@@ -465,11 +465,11 @@ public:
~SocialPlayersTab()
{
delete mList;
- mList = 0;
+ mList = nullptr;
delete mScroll;
- mScroll = 0;
+ mScroll = nullptr;
delete mBeings;
- mBeings = 0;
+ mBeings = nullptr;
}
void updateList()
@@ -525,9 +525,9 @@ public:
{
std::vector<Avatar*> *avatars = mBeings->getMembers();
if (!avatars)
- return 0;
+ return nullptr;
- Avatar *ava = 0;
+ Avatar *ava = nullptr;
std::vector<Avatar*>::const_iterator i = avatars->begin();
while (i != avatars->end())
{
@@ -629,11 +629,11 @@ public:
~SocialNavigationTab()
{
delete mList;
- mList = 0;
+ mList = nullptr;
delete mScroll;
- mScroll = 0;
+ mScroll = nullptr;
delete mBeings;
- mBeings = 0;
+ mBeings = nullptr;
}
void invite()
@@ -751,7 +751,7 @@ public:
if (!map)
return;
- Avatar *ava = 0;
+ Avatar *ava = nullptr;
std::vector<Avatar*>::const_iterator i = avatars->begin();
while (i != avatars->end())
{
@@ -785,7 +785,7 @@ public:
if (!map)
return 01;
- Avatar *ava = 0;
+ Avatar *ava = nullptr;
std::vector<Avatar*>::const_iterator i = avatars->begin();
unsigned num = 0;
while (i != avatars->end())
@@ -906,11 +906,11 @@ public:
~SocialAttackTab()
{
delete mList;
- mList = 0;
+ mList = nullptr;
delete mScroll;
- mScroll = 0;
+ mScroll = nullptr;
delete mBeings;
- mBeings = 0;
+ mBeings = nullptr;
}
void invite()
@@ -1114,11 +1114,11 @@ private:
};
SocialWindow::SocialWindow() :
- Window(_("Social"), false, 0, "social.xml"),
+ Window(_("Social"), false, nullptr, "social.xml"),
mGuildInvited(0),
- mGuildAcceptDialog(0),
- mPartyAcceptDialog(0),
- mMap(0),
+ mGuildAcceptDialog(nullptr),
+ mPartyAcceptDialog(nullptr),
+ mMap(nullptr),
mLastUpdateTime(0),
mNeedUpdate(false),
mProcessedPortals(false)
@@ -1146,7 +1146,7 @@ SocialWindow::SocialWindow() :
place(2, 0, mLeaveButton);
place(0, 1, mTabs, 4, 4);
- widgetResized(NULL);
+ widgetResized(nullptr);
mCreatePopup = new CreatePopup();
@@ -1165,7 +1165,7 @@ SocialWindow::SocialWindow() :
}
else
{
- mAttackFilter = 0;
+ mAttackFilter = nullptr;
}
if (player_node && player_node->getParty())
@@ -1184,7 +1184,7 @@ SocialWindow::~SocialWindow()
{
mGuildAcceptDialog->close();
mGuildAcceptDialog->scheduleDelete();
- mGuildAcceptDialog = NULL;
+ mGuildAcceptDialog = nullptr;
mGuildInvited = 0;
}
@@ -1193,18 +1193,18 @@ SocialWindow::~SocialWindow()
{
mPartyAcceptDialog->close();
mPartyAcceptDialog->scheduleDelete();
- mPartyAcceptDialog = NULL;
+ mPartyAcceptDialog = nullptr;
mPartyInviter = "";
}
delete mCreatePopup;
- mCreatePopup = 0;
+ mCreatePopup = nullptr;
delete mPlayers;
- mPlayers = 0;
+ mPlayers = nullptr;
delete mNavigation;
- mNavigation = 0;
+ mNavigation = nullptr;
delete mAttackFilter;
- mAttackFilter = 0;
+ mAttackFilter = nullptr;
}
bool SocialWindow::addTab(Guild *guild)
@@ -1212,7 +1212,7 @@ bool SocialWindow::addTab(Guild *guild)
if (mGuilds.find(guild) != mGuilds.end())
return false;
- SocialTab *tab = 0;
+ SocialTab *tab = nullptr;
if (guild->getServerGuild())
tab = new SocialGuildTab(guild);
else
@@ -1300,7 +1300,7 @@ void SocialWindow::action(const gcn::ActionEvent &event)
}
mPartyInviter = "";
- mPartyAcceptDialog = NULL;
+ mPartyAcceptDialog = nullptr;
}
else if (event.getSource() == mGuildAcceptDialog)
{
@@ -1333,7 +1333,7 @@ void SocialWindow::action(const gcn::ActionEvent &event)
}
mGuildInvited = 0;
- mGuildAcceptDialog = NULL;
+ mGuildAcceptDialog = nullptr;
}
else if (event.getId() == "create")
{
@@ -1374,11 +1374,11 @@ void SocialWindow::action(const gcn::ActionEvent &event)
name.c_str()), BY_SERVER);
}
- mGuildCreateDialog = NULL;
+ mGuildCreateDialog = nullptr;
}
else if (event.getId() == "~create guild")
{
- mGuildCreateDialog = NULL;
+ mGuildCreateDialog = nullptr;
}
else if (event.getId() == "create party")
{
@@ -1397,11 +1397,11 @@ void SocialWindow::action(const gcn::ActionEvent &event)
name.c_str()), BY_SERVER);
}
- mPartyCreateDialog = NULL;
+ mPartyCreateDialog = nullptr;
}
else if (event.getId() == "~create party")
{
- mPartyCreateDialog = NULL;
+ mPartyCreateDialog = nullptr;
}
}
diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp
index c464b83b5..6abff3796 100644
--- a/src/gui/specialswindow.cpp
+++ b/src/gui/specialswindow.cpp
@@ -76,7 +76,7 @@ class SpecialEntry : public Container
};
SpecialsWindow::SpecialsWindow():
- Window(_("Specials"), false, 0, "specials.xml")
+ Window(_("Specials"), false, nullptr, "specials.xml")
{
setWindowName("Specials");
setCloseButton(true);
@@ -194,10 +194,10 @@ void SpecialsWindow::rebuild(const std::map<int, Special> &specialData)
SpecialEntry::SpecialEntry(SpecialInfo *info) :
mInfo(info),
- mIcon(NULL),
- mLevelLabel(NULL),
- mUse(NULL),
- mRechargeBar(NULL)
+ mIcon(nullptr),
+ mLevelLabel(nullptr),
+ mUse(nullptr),
+ mRechargeBar(nullptr)
{
setFrameSize(1);
setOpaque(false);
diff --git a/src/gui/statuspopup.cpp b/src/gui/statuspopup.cpp
index a0c8e06d4..5f2ec71e3 100644
--- a/src/gui/statuspopup.cpp
+++ b/src/gui/statuspopup.cpp
@@ -75,29 +75,33 @@ StatusPopup::StatusPopup():
mMagicAttackType->setPosition(getPadding(),
4 + 6 * fontHeight + getPadding());
+ mPvpAttackType = new Label;
+ mPvpAttackType->setPosition(getPadding(),
+ 4 + 7 * fontHeight + getPadding());
+
mDropCounter = new Label;
- mDropCounter->setPosition(getPadding(), 8 + 7 * fontHeight + getPadding());
+ mDropCounter->setPosition(getPadding(), 8 + 8 * fontHeight + getPadding());
mPickUpType = new Label;
- mPickUpType->setPosition(getPadding(), 8 + 8 * fontHeight + getPadding());
+ mPickUpType->setPosition(getPadding(), 8 + 9 * fontHeight + getPadding());
mMapType = new Label;
- mMapType->setPosition(getPadding(), 12 + 9 * fontHeight + getPadding());
+ mMapType->setPosition(getPadding(), 12 + 10 * fontHeight + getPadding());
mImitationMode = new Label;
mImitationMode->setPosition(getPadding(),
- 16 + 10 * fontHeight + getPadding());
+ 16 + 11 * fontHeight + getPadding());
mAwayMode = new Label;
- mAwayMode->setPosition(getPadding(), 16 + 11 * fontHeight + getPadding());
+ mAwayMode->setPosition(getPadding(), 16 + 12 * fontHeight + getPadding());
mCameraMode = new Label;
mCameraMode->setPosition(getPadding(),
- 16 + 12 * fontHeight + getPadding());
+ 16 + 13 * fontHeight + getPadding());
mDisableGameModifiers = new Label;
mDisableGameModifiers->setPosition(getPadding(),
- 20 + 13 * fontHeight + getPadding());
+ 20 + 14 * fontHeight + getPadding());
add(mMoveType);
add(mCrazyMoveType);
@@ -109,6 +113,7 @@ StatusPopup::StatusPopup():
add(mPickUpType);
add(mMapType);
add(mMagicAttackType);
+ add(mPvpAttackType);
add(mDisableGameModifiers);
add(mImitationMode);
add(mAwayMode);
@@ -145,6 +150,8 @@ void StatusPopup::update()
minWidth = mMapType->getWidth();
if (mMagicAttackType->getWidth() > minWidth)
minWidth = mMagicAttackType->getWidth();
+ if (mPvpAttackType->getWidth() > minWidth)
+ minWidth = mPvpAttackType->getWidth();
if (mDisableGameModifiers->getWidth() > minWidth)
minWidth = mDisableGameModifiers->getWidth();
if (mAwayMode->getWidth() > minWidth)
@@ -476,6 +483,31 @@ void StatusPopup::updateLabels()
}
mMagicAttackType->adjustSize();
+ switch (player_node->getPvpAttackType())
+ {
+ case 0:
+ setLabelText(mPvpAttackType, _("(a) attack all players"),
+ keyboard.KEY_SWITCH_PVP_ATTACK);
+ break;
+ case 1:
+ setLabelText(mPvpAttackType, _("(f) attack not friends"),
+ keyboard.KEY_SWITCH_PVP_ATTACK);
+ break;
+ case 2:
+ setLabelText(mPvpAttackType, _("(b) attack bad relations"),
+ keyboard.KEY_SWITCH_PVP_ATTACK);
+ break;
+ case 3:
+ setLabelText(mPvpAttackType, _("(d) dont attack players"),
+ keyboard.KEY_SWITCH_PVP_ATTACK);
+ break;
+ default:
+ setLabelText(mMagicAttackType, _("(?) pvp attack"),
+ keyboard.KEY_SWITCH_MAGIC_ATTACK);
+ break;
+ }
+ mPvpAttackType->adjustSize();
+
switch (player_node->getImitationMode())
{
case 0:
@@ -493,7 +525,7 @@ void StatusPopup::updateLabels()
}
mImitationMode->adjustSize();
- switch ((int)player_node->getAwayMode())
+ switch ((int)player_node->getAway())
{
case 0:
setLabelText(mAwayMode, _("(O) on keyboard"), keyboard.KEY_AWAY);
diff --git a/src/gui/statuspopup.h b/src/gui/statuspopup.h
index 802b077a6..2af8064c5 100644
--- a/src/gui/statuspopup.h
+++ b/src/gui/statuspopup.h
@@ -72,6 +72,7 @@ class StatusPopup : public Popup
gcn::Label *mPickUpType;
gcn::Label *mMapType;
gcn::Label *mMagicAttackType;
+ gcn::Label *mPvpAttackType;
gcn::Label *mDisableGameModifiers;
gcn::Label *mImitationMode;
gcn::Label *mAwayMode;
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index c746eb82d..37a706baf 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -123,7 +123,8 @@ class ChangeDisplay : public AttrDisplay, gcn::ActionListener
};
StatusWindow::StatusWindow():
- Window(player_node ? player_node->getName() : "?", false, 0, "status.xml")
+ Window(player_node ? player_node->getName() :
+ "?", false, nullptr, "status.xml")
{
listen(Mana::CHANNEL_ATTRIBUTES);
@@ -177,8 +178,8 @@ StatusWindow::StatusWindow():
}
else
{
- mMpLabel = 0;
- mMpBar = 0;
+ mMpLabel = nullptr;
+ mMpBar = nullptr;
}
place(0, 0, mLvlLabel, 3);
@@ -210,9 +211,9 @@ StatusWindow::StatusWindow():
}
else
{
- mJobLvlLabel = 0;
- mJobLabel = 0;
- mJobBar = 0;
+ mJobLvlLabel = nullptr;
+ mJobLabel = nullptr;
+ mJobBar = nullptr;
}
// ----------------------
@@ -787,6 +788,25 @@ void StatusWindow::updateStatusBar(ProgressBar *bar, bool percent A_UNUSED)
break;
}
+ switch (player_node->getPvpAttackType())
+ {
+ case 0:
+ str += translateLetter(N_("(a)"));
+ break;
+ case 1:
+ str += translateLetter(N_("(f)"));
+ break;
+ case 2:
+ str += translateLetter(N_("(b)"));
+ break;
+ case 3:
+ str += translateLetter(N_("(d)"));
+ break;
+ default:
+ str += translateLetter(N_("(?)"));
+ break;
+ }
+
str += " " + toString(player_node->getQuickDropCounter());
switch (player_node->getPickUpType())
@@ -873,7 +893,7 @@ void StatusWindow::updateStatusBar(ProgressBar *bar, bool percent A_UNUSED)
break;
}
- switch ((int)player_node->getAwayMode())
+ switch ((int)player_node->getAway())
{
case 0:
str += translateLetter(N_("(O)"));
@@ -944,6 +964,7 @@ AttrDisplay::AttrDisplay(int id, const std::string &name):
AttrDisplay::~AttrDisplay()
{
delete mLayout;
+ mLayout = nullptr;
}
std::string AttrDisplay::update()
@@ -993,7 +1014,7 @@ ChangeDisplay::ChangeDisplay(int id, const std::string &name):
}
else
{
- mDec = 0;
+ mDec = nullptr;
}
update();
diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp
index 6512f8465..7d97549f3 100644
--- a/src/gui/textcommandeditor.cpp
+++ b/src/gui/textcommandeditor.cpp
@@ -165,7 +165,7 @@ public:
TextCommandEditor::TextCommandEditor(TextCommand *command):
- Window(_("Command Editor"), false, 0, "commandeditor.xml")
+ Window(_("Command Editor"), false, nullptr, "commandeditor.xml")
{
int w = 350;
int h = 370;
@@ -302,11 +302,11 @@ TextCommandEditor::TextCommandEditor(TextCommand *command):
TextCommandEditor::~TextCommandEditor()
{
delete mIconsModal;
- mIconsModal = 0;
+ mIconsModal = nullptr;
delete mTargetTypeModel;
- mTargetTypeModel = 0;
+ mTargetTypeModel = nullptr;
delete mMagicSchoolModel;
- mMagicSchoolModel = 0;
+ mMagicSchoolModel = nullptr;
}
void TextCommandEditor::action(const gcn::ActionEvent &event)
diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp
index c1539684c..a32b13aa4 100644
--- a/src/gui/textdialog.cpp
+++ b/src/gui/textdialog.cpp
@@ -40,8 +40,8 @@ int TextDialog::instances = 0;
TextDialog::TextDialog(const std::string &title, const std::string &msg,
Window *parent, bool isPassword):
Window(title, true, parent, "textdialog.xml"),
- mTextField(0),
- mPasswordField(0)
+ mTextField(nullptr),
+ mPasswordField(nullptr)
{
mEnabledKeyboard = keyboard.isEnabled();
keyboard.setEnabled(false);
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 0a1a930a9..0246a5b62 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -48,7 +48,7 @@ static std::string defaultThemePath;
std::string Theme::mThemePath;
std::string Theme::mThemeName;
-Theme *Theme::mInstance = 0;
+Theme *Theme::mInstance = nullptr;
// Set the theme path...
static void initDefaultThemePath()
@@ -82,18 +82,18 @@ Skin::~Skin()
for (int i = 0; i < 9; i++)
{
delete mBorder.grid[i];
- mBorder.grid[i] = 0;
+ mBorder.grid[i] = nullptr;
}
if (mCloseImage)
{
mCloseImage->decRef();
- mCloseImage = 0;
+ mCloseImage = nullptr;
}
delete mStickyImageUp;
- mStickyImageUp = 0;
+ mStickyImageUp = nullptr;
delete mStickyImageDown;
- mStickyImageDown = 0;
+ mStickyImageDown = nullptr;
}
void Skin::updateAlpha(float minimumOpacityAllowed)
@@ -182,7 +182,7 @@ Theme *Theme::instance()
void Theme::deleteInstance()
{
delete mInstance;
- mInstance = 0;
+ mInstance = nullptr;
}
gcn::Color Theme::getProgressColor(int type, float progress)
@@ -295,7 +295,7 @@ void Theme::optionChanged(const std::string &)
Skin *Theme::readSkin(const std::string &filename)
{
if (filename.empty())
- return 0;
+ return nullptr;
// std::string filename = filename0;
// ResourceManager *resman = ResourceManager::getInstance();
@@ -306,14 +306,14 @@ Skin *Theme::readSkin(const std::string &filename)
xmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "skinset"))
- return 0;
+ return nullptr;
const std::string skinSetImage = XML::getProperty(rootNode, "image", "");
if (skinSetImage.empty())
{
logger->log1("Theme::readSkin(): Skinset does not define an image!");
- return 0;
+ return nullptr;
}
logger->log("Theme::load(): <skinset> defines '%s' as a skin image.",
@@ -355,7 +355,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[0] = 0;
+ border.grid[0] = nullptr;
}
}
else if (partType == "top-edge")
@@ -367,7 +367,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[1] = 0;
+ border.grid[1] = nullptr;
}
}
else if (partType == "top-right-corner")
@@ -379,7 +379,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[2] = 0;
+ border.grid[2] = nullptr;
}
}
@@ -393,7 +393,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[3] = 0;
+ border.grid[3] = nullptr;
}
}
else if (partType == "bg-quad")
@@ -405,7 +405,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[4] = 0;
+ border.grid[4] = nullptr;
}
}
else if (partType == "right-edge")
@@ -417,7 +417,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[5] = 0;
+ border.grid[5] = nullptr;
}
}
@@ -431,7 +431,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[6] = 0;
+ border.grid[6] = nullptr;
}
}
else if (partType == "bottom-edge")
@@ -443,7 +443,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[7] = 0;
+ border.grid[7] = nullptr;
}
}
else if (partType == "bottom-right-corner")
@@ -455,7 +455,7 @@ Skin *Theme::readSkin(const std::string &filename)
}
else
{
- border.grid[8] = 0;
+ border.grid[8] = nullptr;
}
}
@@ -490,8 +490,8 @@ Skin *Theme::readSkin(const std::string &filename)
// to look for window buttons
Image *closeImage = Theme::getImageFromTheme("close_button.png");
Image *sticky = Theme::getImageFromTheme("sticky_button.png");
- Image *stickyImageUp = 0;
- Image *stickyImageDown = 0;
+ Image *stickyImageUp = nullptr;
+ Image *stickyImageDown = nullptr;
if (sticky)
{
stickyImageUp = sticky->getSubImage(0, 0, 15, 15);
@@ -526,7 +526,7 @@ void Theme::fillSkinsList(std::vector<std::string> &list)
char **skins = PHYSFS_enumerateFiles(
branding.getStringValue("guiThemePath").c_str());
- for (char **i = skins; *i != 0; i++)
+ for (char **i = skins; *i; i++)
{
if (PHYSFS_isDirectory((
branding.getStringValue("guiThemePath") + *i).c_str()))
@@ -544,7 +544,7 @@ void Theme::fillFontsList(std::vector<std::string> &list)
char **fonts = PHYSFS_enumerateFiles(
branding.getStringValue("fontsPath").c_str());
- for (char **i = fonts; *i != 0; i++)
+ for (char **i = fonts; *i; i++)
{
if (!PHYSFS_isDirectory((
branding.getStringValue("fontsPath") + *i).c_str()))
diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp
index bd7e9bb1e..506bf65c9 100644
--- a/src/gui/tradewindow.cpp
+++ b/src/gui/tradewindow.cpp
@@ -63,11 +63,11 @@
#define CAPTION_ACCEPTED _("Agreed. Waiting...")
TradeWindow::TradeWindow():
- Window(_("Trade: You"), false, 0, "trade.xml"),
+ Window(_("Trade: You"), false, nullptr, "trade.xml"),
mMyInventory(new Inventory(Inventory::TRADE)),
mPartnerInventory(new Inventory(Inventory::TRADE)),
mStatus(PROPOSING),
- mAutoAddItem(0),
+ mAutoAddItem(nullptr),
mAutoAddToNick(""),
mGotMoney(0),
mGotMaxMoney(0),
@@ -390,7 +390,7 @@ void TradeWindow::close()
void TradeWindow::clear()
{
- mAutoAddItem = 0;
+ mAutoAddItem = nullptr;
mAutoAddToNick = "";
mAutoMoney = 0;
mAutoAddAmount = 0;
diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp
index cc5caca60..c43f28400 100644
--- a/src/gui/unregisterdialog.cpp
+++ b/src/gui/unregisterdialog.cpp
@@ -47,7 +47,7 @@
#include "debug.h"
UnRegisterDialog::UnRegisterDialog(LoginData *data):
- Window(_("Unregister"), true, 0, "unregister.xml"),
+ Window(_("Unregister"), true, nullptr, "unregister.xml"),
mWrongDataNoticeListener(new WrongDataNoticeListener),
mLoginData(data)
{
@@ -92,7 +92,7 @@ UnRegisterDialog::UnRegisterDialog(LoginData *data):
UnRegisterDialog::~UnRegisterDialog()
{
delete mWrongDataNoticeListener;
- mWrongDataNoticeListener = 0;
+ mWrongDataNoticeListener = nullptr;
}
void UnRegisterDialog::action(const gcn::ActionEvent &event)
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index 2efe82199..ac51cc76f 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -135,7 +135,7 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost,
const std::string &updatesDir,
bool applyUpdates,
int updateType):
- Window(_("Updating..."), false, 0, "update.xml"),
+ Window(_("Updating..."), false, nullptr, "update.xml"),
mDownloadStatus(UPDATE_NEWS),
mUpdateHost(updateHost),
mUpdatesDir(updatesDir),
@@ -147,8 +147,8 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost,
mDownloadComplete(true),
mUserCancel(false),
mDownloadedBytes(0),
- mMemoryBuffer(NULL),
- mDownload(NULL),
+ mMemoryBuffer(nullptr),
+ mDownload(nullptr),
mUpdateIndex(0),
mUpdateIndexOffset(0),
mLoadUpdates(applyUpdates),
@@ -202,7 +202,7 @@ UpdaterWindow::~UpdaterWindow()
mDownload->cancel();
delete mDownload;
- mDownload = 0;
+ mDownload = nullptr;
}
free(mMemoryBuffer);
}
@@ -256,7 +256,7 @@ void UpdaterWindow::keyPressed(gcn::KeyEvent &keyEvent)
if (key.getValue() == Key::ESCAPE)
{
- action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mCancelButton->getActionEventId()));
Client::setState(STATE_WORLD_SELECT);
}
else if (key.getValue() == Key::ENTER)
@@ -264,11 +264,12 @@ void UpdaterWindow::keyPressed(gcn::KeyEvent &keyEvent)
if (mDownloadStatus == UPDATE_COMPLETE ||
mDownloadStatus == UPDATE_ERROR)
{
- action(gcn::ActionEvent(NULL, mPlayButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr, mPlayButton->getActionEventId()));
}
else
{
- action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId()));
+ action(gcn::ActionEvent(nullptr,
+ mCancelButton->getActionEventId()));
}
}
}
@@ -294,12 +295,12 @@ void UpdaterWindow::loadNews()
while (line)
{
mBrowserBox->addRow(line);
- line = strtok(NULL, "\n");
+ line = strtok(nullptr, "\n");
}
// Free the memory buffer now that we don't need it anymore
free(mMemoryBuffer);
- mMemoryBuffer = NULL;
+ mMemoryBuffer = nullptr;
mDownloadedBytes = 0;
mScrollArea->setVerticalScrollAmount(0);
@@ -340,7 +341,7 @@ void UpdaterWindow::loadPatch()
// Free the memory buffer now that we don't need it anymore
free(mMemoryBuffer);
- mMemoryBuffer = NULL;
+ mMemoryBuffer = nullptr;
mDownloadedBytes = 0;
mScrollArea->setVerticalScrollAmount(0);
@@ -365,7 +366,7 @@ int UpdaterWindow::updateProgress(void *ptr, DownloadStatus status,
uw->mDownloadStatus = UPDATE_COMPLETE;
uw->mDownloadComplete = true;
free(uw->mMemoryBuffer);
- uw->mMemoryBuffer = NULL;
+ uw->mMemoryBuffer = nullptr;
}
else
{
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 97a467add..3086a027f 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -56,7 +56,7 @@
extern volatile int tick_time;
Viewport::Viewport():
- mMap(0),
+ mMap(nullptr),
mMouseX(0),
mMouseY(0),
mPixelViewX(0.0f),
@@ -65,9 +65,9 @@ Viewport::Viewport():
mCameraMode(0),
mPlayerFollowMouse(false),
mLocalWalkTime(-1),
- mHoverBeing(0),
- mHoverItem(0),
- mHoverSign(0),
+ mHoverBeing(nullptr),
+ mHoverItem(nullptr),
+ mHoverSign(nullptr),
mCameraRelativeX(0),
mCameraRelativeY(0)
{
@@ -104,11 +104,11 @@ Viewport::~Viewport()
config.removeListener("enableLazyScrolling", this);
delete mPopupMenu;
- mPopupMenu = 0;
+ mPopupMenu = nullptr;
delete mBeingPopup;
- mBeingPopup = 0;
+ mBeingPopup = nullptr;
delete mTextPopup;
- mTextPopup = 0;
+ mTextPopup = nullptr;
}
void Viewport::setMap(Map *map)
@@ -298,8 +298,8 @@ void Viewport::_followMouse()
if (mPlayerFollowMouse && button & SDL_BUTTON(1))
{
// We create a mouse event and send it to mouseDragged.
- Uint8 *keys = SDL_GetKeyState(NULL);
- gcn::MouseEvent mouseEvent(NULL,
+ Uint8 *keys = SDL_GetKeyState(nullptr);
+ gcn::MouseEvent mouseEvent(nullptr,
(keys[SDLK_LSHIFT] || keys[SDLK_RSHIFT]),
false,
false,
@@ -699,7 +699,7 @@ void Viewport::showUndressPopup(int x, int y, Being *being, Item *item)
void Viewport::closePopupMenu()
{
if (mPopupMenu)
- mPopupMenu->handleLink("cancel", 0);
+ mPopupMenu->handleLink("cancel", nullptr);
}
void Viewport::optionChanged(const std::string &name A_UNUSED)
@@ -738,7 +738,7 @@ void Viewport::mouseMoved(gcn::MouseEvent &event A_UNUSED)
mBeingPopup->setVisible(false);
}
- mHoverItem = 0;
+ mHoverItem = nullptr;
if (!mHoverBeing && actorSpriteManager)
{
mHoverItem = actorSpriteManager->findItem(x / mMap->getTileWidth(),
@@ -844,17 +844,17 @@ void Viewport::hideBeingPopup()
void Viewport::clearHover(ActorSprite *actor)
{
if (mHoverBeing == actor)
- mHoverBeing = 0;
+ mHoverBeing = nullptr;
if (mHoverItem == actor)
- mHoverItem = 0;
+ mHoverItem = nullptr;
}
void Viewport::cleanHoverItems()
{
- mHoverBeing = 0;
- mHoverItem = 0;
- mHoverSign = 0;
+ mHoverBeing = nullptr;
+ mHoverItem = nullptr;
+ mHoverSign = nullptr;
}
void Viewport::moveCamera(int dx, int dy)
diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp
index 3fb63a105..ead38f42b 100644
--- a/src/gui/whoisonline.cpp
+++ b/src/gui/whoisonline.cpp
@@ -82,12 +82,12 @@ class NameFunctuator
} nameCompare;
WhoIsOnline::WhoIsOnline():
- Window(_("Who Is Online - Updating"), false, 0, "whoisonline.xml"),
- mThread(NULL),
+ Window(_("Who Is Online - Updating"), false, nullptr, "whoisonline.xml"),
+ mThread(nullptr),
mDownloadStatus(UPDATE_LIST),
mDownloadComplete(true),
mDownloadedBytes(0),
- mMemoryBuffer(NULL),
+ mMemoryBuffer(nullptr),
mCurlError(new char[CURL_ERROR_SIZE]),
mAllowUpdate(true),
mShowLevel(false)
@@ -137,10 +137,10 @@ WhoIsOnline::~WhoIsOnline()
config.removeListener("updateOnlineList", this);
if (mThread && SDL_GetThreadID(mThread))
- SDL_WaitThread(mThread, NULL);
+ SDL_WaitThread(mThread, nullptr);
free(mMemoryBuffer);
- mMemoryBuffer = 0;
+ mMemoryBuffer = nullptr;
// Remove possibly leftover temporary download
delete[] mCurlError;
@@ -206,7 +206,7 @@ void WhoIsOnline::loadList()
mShowLevel = config.getBoolValue("showlevel");
- while (line != NULL)
+ while (line)
{
std::string nick;
lineStr = line;
@@ -295,7 +295,7 @@ void WhoIsOnline::loadList()
{
listStarted = true;
}
- line = strtok(NULL, "\n");
+ line = strtok(nullptr, "\n");
}
//Set window caption
@@ -333,7 +333,7 @@ void WhoIsOnline::loadList()
// Free the memory buffer now that we don't need it anymore
free(mMemoryBuffer);
- mMemoryBuffer = 0;
+ mMemoryBuffer = nullptr;
if (mScrollArea->getVerticalMaxScroll() <
mScrollArea->getVerticalScrollAmount())
@@ -377,7 +377,7 @@ int WhoIsOnline::downloadThread(void *ptr)
if (!wio->mAllowUpdate)
{
curl_easy_cleanup(curl);
- curl = 0;
+ curl = nullptr;
break;
}
wio->mDownloadedBytes = 0;
@@ -398,7 +398,7 @@ int WhoIsOnline::downloadThread(void *ptr)
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 7);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 30);
- struct curl_slist *pHeaders = 0;
+ struct curl_slist *pHeaders = nullptr;
// Make sure the resources2.txt and news.txt aren't cached,
// in order to always get the latest version.
pHeaders = curl_slist_append(pHeaders, "pragma: no-cache");
@@ -422,7 +422,7 @@ int WhoIsOnline::downloadThread(void *ptr)
attempts++;
curl_easy_cleanup(curl);
curl_slist_free_all(pHeaders);
- curl = 0;
+ curl = nullptr;
continue;
}
@@ -448,12 +448,12 @@ void WhoIsOnline::download()
{
mDownloadComplete = true;
if (mThread && SDL_GetThreadID(mThread))
- SDL_WaitThread(mThread, NULL);
+ SDL_WaitThread(mThread, nullptr);
mDownloadComplete = false;
mThread = SDL_CreateThread(WhoIsOnline::downloadThread, this);
- if (mThread == NULL)
+ if (mThread == nullptr)
mDownloadStatus = UPDATE_ERROR;
}
@@ -525,8 +525,8 @@ void WhoIsOnline::action(const gcn::ActionEvent &event)
setCaption(_("Who Is Online - Update"));
if (mThread && SDL_GetThreadID(mThread))
{
- SDL_WaitThread(mThread, NULL);
- mThread = NULL;
+ SDL_WaitThread(mThread, nullptr);
+ mThread = nullptr;
}
mDownloadComplete = true;
}
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 18dc48417..8264f0fb9 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -43,8 +43,8 @@
#include "debug.h"
int AvatarListBox::instances = 0;
-Image *AvatarListBox::onlineIcon = 0;
-Image *AvatarListBox::offlineIcon = 0;
+Image *AvatarListBox::onlineIcon = nullptr;
+Image *AvatarListBox::offlineIcon = nullptr;
AvatarListBox::AvatarListBox(AvatarListModel *model):
ListBox(model),
@@ -83,12 +83,12 @@ AvatarListBox::~AvatarListBox()
if (onlineIcon)
{
onlineIcon->decRef();
- onlineIcon = 0;
+ onlineIcon = nullptr;
}
if (offlineIcon)
{
offlineIcon->decRef();
- offlineIcon = 0;
+ offlineIcon = nullptr;
}
}
}
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 1419e213c..5ded29c55 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -29,6 +29,7 @@
#include "utils/stringutils.h"
+#include "gui/gui.h"
#include "gui/palette.h"
#include "gui/theme.h"
@@ -48,8 +49,9 @@
BrowserBox::BrowserBox(unsigned int mode, bool opaque):
gcn::Widget(),
- mLinkHandler(0),
- mMode(mode), mHighMode(UNDERLINE | BACKGROUND),
+ mLinkHandler(nullptr),
+ mMode(mode),
+ mHighMode(UNDERLINE | BACKGROUND),
mOpaque(opaque),
mUseLinksAndUserColors(true),
mSelectedLink(-1),
@@ -371,7 +373,10 @@ void BrowserBox::draw(gcn::Graphics *graphics)
if (!part.mType)
{
graphics->setColor(part.mColor);
- font->drawString(graphics, part.mText, part.mX, part.mY);
+ if (part.mBold)
+ boldFont->drawString(graphics, part.mText, part.mX, part.mY);
+ else
+ font->drawString(graphics, part.mText, part.mX, part.mY);
}
else if (part.mImage)
{
@@ -389,6 +394,8 @@ int BrowserBox::calcHeight()
int moreHeight = 0;
int maxWidth = getWidth();
int link = 0;
+ bool bold = false;
+
if (getWidth() < 0)
return 1;
@@ -417,7 +424,7 @@ int BrowserBox::calcHeight()
const int dashWidth = fontWidthMinus;
for (x = 0; x < (unsigned)getWidth(); x++)
{
- mLineParts.push_back(LinePart(x, y, selColor, "-"));
+ mLineParts.push_back(LinePart(x, y, selColor, "-", false));
x += dashWidth - 2;
}
@@ -458,6 +465,8 @@ int BrowserBox::calcHeight()
wrapped = false;
}
+ bold = false;
+
// "Tokenize" the string at control sequences
if (mUseLinksAndUserColors)
end = row.find("##", start + 1);
@@ -483,6 +492,14 @@ int BrowserBox::calcHeight()
prevColor = selColor;
selColor = col;
}
+ else if (c == 'B')
+ {
+ bold = true;
+ }
+ else if (c == 'b')
+ {
+ bold = false;
+ }
else if (valid)
{
selColor = col;
@@ -533,10 +550,16 @@ int BrowserBox::calcHeight()
std::string part = row.substr(start, len);
+ int width = 0;
+ if (bold)
+ width = boldFont->getWidth(part);
+ else
+ width = font->getWidth(part);
+
// Auto wrap mode
if (mMode == AUTO_WRAP && getWidth() > 0
- && font->getWidth(part) > 0
- && (x + font->getWidth(part) + 10) > (unsigned)getWidth())
+ && width > 0
+ && (x + width + 10) > (unsigned)getWidth())
{
bool forced = false;
@@ -564,16 +587,20 @@ int BrowserBox::calcHeight()
end--; // And then to the last byte of the previous one
part = row.substr(start, end - start + 1);
+ if (bold)
+ width = boldFont->getWidth(part);
+ else
+ width = font->getWidth(part);
}
- while (end > start && font->getWidth(part) > 0
- && (x + font->getWidth(part) + 10)
+ while (end > start && width > 0
+ && (x + width + 10)
> (unsigned)getWidth());
if (forced)
{
x -= hyphenWidth; // Remove the wrap-notifier accounting
mLineParts.push_back(LinePart(getWidth() - hyphenWidth,
- y, selColor, hyphen));
+ y, selColor, hyphen, bold));
end++; // Skip to the next character
}
else
@@ -585,12 +612,17 @@ int BrowserBox::calcHeight()
wrappedLines++;
}
- mLineParts.push_back(LinePart(x, y, selColor, part.c_str()));
+ mLineParts.push_back(LinePart(x, y, selColor, part.c_str(), bold));
+
+ if (bold)
+ width = boldFont->getWidth(part);
+ else
+ width = font->getWidth(part);
- if (mMode == AUTO_WRAP && font->getWidth(part) == 0)
+ if (mMode == AUTO_WRAP && width == 0)
break;
- x += font->getWidth(part);
+ x += width;
}
y += fontHeight;
}
@@ -617,5 +649,5 @@ LinePart::~LinePart()
{
if (mImage)
mImage->decRef();
- mImage = 0;
+ mImage = nullptr;
}
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index e86f0288e..06609b318 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -30,6 +30,8 @@
#include <list>
#include <vector>
+#include "localconsts.h"
+
class Image;
class Resource;
class LinkHandler;
@@ -44,13 +46,15 @@ struct BROWSER_LINK
class LinePart
{
public:
- LinePart(int x, int y, gcn::Color color, std::string text) :
- mX(x), mY(y), mColor(color), mText(text), mType(0), mImage(0)
+ LinePart(int x, int y, gcn::Color color, std::string text, bool bold) :
+ mX(x), mY(y), mColor(color), mText(text), mType(0),
+ mImage(nullptr), mBold(bold)
{
}
LinePart(int x, int y, gcn::Color color, Image *image) :
- mX(x), mY(y), mColor(color), mText(""), mType(1), mImage(image)
+ mX(x), mY(y), mColor(color), mText(""), mType(1),
+ mImage(image), mBold(false)
{
}
@@ -61,6 +65,7 @@ class LinePart
std::string mText;
unsigned char mType;
Image *mImage;
+ bool mBold;
};
/**
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 7c46ae9df..85e4eca17 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -146,7 +146,7 @@ Button::~Button()
mInstances--;
delete mVertexes;
- mVertexes = 0;
+ mVertexes = nullptr;
if (mInstances == 0)
{
for (int mode = 0; mode < BUTTON_COUNT; mode++)
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 9a29ae204..0a224605a 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -82,9 +82,9 @@ ChatTab::~ChatTab()
chatWindow->removeTab(this);
delete mTextOutput;
- mTextOutput = 0;
+ mTextOutput = nullptr;
delete mScrollArea;
- mScrollArea = 0;
+ mScrollArea = nullptr;
}
void ChatTab::chatLog(std::string line, Own own,
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index 65d26e196..dcedc8951 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -70,12 +70,12 @@ CheckBox::CheckBox(const std::string &caption, bool selected,
}
else
{
- checkBoxNormal = 0;
- checkBoxChecked = 0;
- checkBoxDisabled = 0;
- checkBoxDisabledChecked = 0;
- checkBoxNormalHi = 0;
- checkBoxCheckedHi = 0;
+ checkBoxNormal = nullptr;
+ checkBoxChecked = nullptr;
+ checkBoxDisabled = nullptr;
+ checkBoxDisabledChecked = nullptr;
+ checkBoxNormalHi = nullptr;
+ checkBoxCheckedHi = nullptr;
}
}
@@ -97,17 +97,17 @@ CheckBox::~CheckBox()
if (instances == 0)
{
delete checkBoxNormal;
- checkBoxNormal = 0;
+ checkBoxNormal = nullptr;
delete checkBoxChecked;
- checkBoxChecked = 0;
+ checkBoxChecked = nullptr;
delete checkBoxDisabled;
- checkBoxDisabled = 0;
+ checkBoxDisabled = nullptr;
delete checkBoxDisabledChecked;
- checkBoxDisabledChecked = 0;
+ checkBoxDisabledChecked = nullptr;
delete checkBoxNormalHi;
- checkBoxNormalHi = 0;
+ checkBoxNormalHi = nullptr;
delete checkBoxCheckedHi;
- checkBoxCheckedHi = 0;
+ checkBoxCheckedHi = nullptr;
}
}
diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h
index a16ab242c..4e293aad6 100644
--- a/src/gui/widgets/checkbox.h
+++ b/src/gui/widgets/checkbox.h
@@ -25,6 +25,8 @@
#include <guichan/widgets/checkbox.hpp>
+#include "localconsts.h"
+
#ifdef __GNUC__
#define A_UNUSED __attribute__ ((unused))
#else
@@ -45,7 +47,7 @@ class CheckBox : public gcn::CheckBox
* Constructor.
*/
CheckBox(const std::string &caption, bool selected = false,
- gcn::ActionListener* listener = NULL,
+ gcn::ActionListener* listener = nullptr,
std::string eventId = "");
/**
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 46240f76d..beb232fb2 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -39,7 +39,7 @@
#include "debug.h"
Desktop::Desktop() :
- mWallpaper(0)
+ mWallpaper(nullptr)
{
addWidgetListener(this);
@@ -66,7 +66,7 @@ Desktop::~Desktop()
if (mWallpaper)
{
mWallpaper->decRef();
- mWallpaper = 0;
+ mWallpaper = nullptr;
}
}
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 687d7dc6d..2a17320de 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -133,7 +133,7 @@ DropDown::~DropDown()
}
delete mScrollArea;
- mScrollArea = 0;
+ mScrollArea = nullptr;
}
void DropDown::updateAlpha()
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index 4cbd23314..3559b634a 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -25,6 +25,8 @@
#include <guichan/widgets/dropdown.hpp>
+#include "localconsts.h"
+
class Image;
class ImageRect;
@@ -47,7 +49,7 @@ class DropDown : public gcn::DropDown
* @see ListModel, ScrollArea, ListBox.
*/
DropDown(gcn::ListModel *listModel = 0,
- gcn::ActionListener* listener = NULL,
+ gcn::ActionListener* listener = nullptr,
std::string eventId = "");
~DropDown();
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index 1fa272448..8335a61bc 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -49,7 +49,7 @@
DropShortcutContainer::DropShortcutContainer():
ShortcutContainer(),
mItemClicked(false),
- mItemMoved(NULL)
+ mItemMoved(nullptr)
{
addMouseListener(this);
addWidgetListener(this);
@@ -82,10 +82,10 @@ DropShortcutContainer::~DropShortcutContainer()
if (mBackgroundImg)
{
mBackgroundImg->decRef();
- mBackgroundImg = 0;
+ mBackgroundImg = nullptr;
}
delete mItemPopup;
- mItemPopup = 0;
+ mItemPopup = nullptr;
}
void DropShortcutContainer::draw(gcn::Graphics *graphics)
@@ -254,14 +254,14 @@ void DropShortcutContainer::mouseReleased(gcn::MouseEvent &event)
const int index = getIndexFromGrid(event.getX(), event.getY());
if (index == -1)
{
- mItemMoved = NULL;
+ mItemMoved = nullptr;
return;
}
if (mItemMoved)
{
dropShortcut->setItems(index, mItemMoved->getId(),
mItemMoved->getColor());
- mItemMoved = NULL;
+ mItemMoved = nullptr;
}
if (mItemClicked)
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index cc9e8badf..e8d7bb7e3 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -90,7 +90,7 @@ EmoteShortcutContainer::~EmoteShortcutContainer()
if (mBackgroundImg)
{
mBackgroundImg->decRef();
- mBackgroundImg = 0;
+ mBackgroundImg = nullptr;
}
}
diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp
index 0a64a7142..7d3ddc0b4 100644
--- a/src/gui/widgets/flowcontainer.cpp
+++ b/src/gui/widgets/flowcontainer.cpp
@@ -87,5 +87,5 @@ void FlowContainer::add(gcn::Widget *widget)
Container::add(widget);
widget->setSize(mBoxWidth, mBoxHeight);
- widgetResized(NULL);
+ widgetResized(nullptr);
}
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index e02eda88c..78ce14e56 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -76,7 +76,7 @@ GuiTableActionListener::~GuiTableActionListener()
if (mWidget)
{
mWidget->removeActionListener(this);
- mWidget->_setParent(NULL);
+ mWidget->_setParent(nullptr);
}
}
@@ -92,10 +92,10 @@ GuiTable::GuiTable(TableModel *initial_model, bool opacity) :
mLinewiseMode(false),
mWrappingEnabled(false),
mOpaque(opacity),
- mModel(NULL),
+ mModel(nullptr),
mSelectedRow(0),
mSelectedColumn(0),
- mTopWidget(NULL)
+ mTopWidget(nullptr)
{
mBackgroundColor = Theme::getThemeColor(Theme::BACKGROUND);
mHighlightColor = Theme::getThemeColor(Theme::HIGHLIGHT);
@@ -110,7 +110,7 @@ GuiTable::~GuiTable()
{
uninstallActionListeners();
delete mModel;
- mModel = 0;
+ mModel = nullptr;
}
TableModel *GuiTable::getModel() const
@@ -391,7 +391,7 @@ void GuiTable::moveToBottom(gcn::Widget *widget)
{
gcn::Widget::moveToBottom(widget);
if (widget == mTopWidget)
- mTopWidget = NULL;
+ mTopWidget = nullptr;
}
gcn::Rectangle GuiTable::getChildrenArea()
@@ -512,7 +512,7 @@ void GuiTable::modelUpdated(bool completed)
}
else
{ // before the update?
- mTopWidget = NULL; // No longer valid in general
+ mTopWidget = nullptr; // No longer valid in general
uninstallActionListeners();
}
}
@@ -531,10 +531,10 @@ gcn::Widget *GuiTable::getWidgetAt(int x, int y)
if (w && w->isFocusable())
return w;
else
- return NULL; // Grab the event locally
+ return nullptr; // Grab the event locally
}
else
- return NULL;
+ return nullptr;
}
int GuiTable::getRowForY(int y) const
diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h
index d248c4820..cf3cb8ad8 100644
--- a/src/gui/widgets/guitable.h
+++ b/src/gui/widgets/guitable.h
@@ -23,6 +23,8 @@
#ifndef TABLE_H
#define TABLE_H
+#include "localconsts.h"
+
#include "gui/widgets/tablemodel.h"
#include <guichan/keylistener.hpp>
@@ -57,7 +59,7 @@ class GuiTable : public gcn::Widget,
friend class GuiTableActionListener;
public:
- GuiTable(TableModel * initial_model = NULL,
+ GuiTable(TableModel * initial_model = nullptr,
bool opacity = true);
virtual ~GuiTable();
diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp
index 3e9c7dd24..b8cc2ac3a 100644
--- a/src/gui/widgets/icon.cpp
+++ b/src/gui/widgets/icon.cpp
@@ -30,7 +30,7 @@
#include "debug.h"
Icon::Icon(const std::string &file)
- : mImage(0)
+ : mImage(nullptr)
{
mImage = ResourceManager::getInstance()->getImage(file);
if (mImage)
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 9a17d81cd..57c64093b 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -166,7 +166,7 @@ ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity):
mDescItems(false),
mTag(0),
mSortType(0),
- mShowMatrix(0)
+ mShowMatrix(nullptr)
{
mItemPopup = new ItemPopup;
setFocusable(true);
@@ -188,10 +188,10 @@ ItemContainer::~ItemContainer()
if (mSelImg)
{
mSelImg->decRef();
- mSelImg = 0;
+ mSelImg = nullptr;
}
delete mItemPopup;
- mItemPopup = 0;
+ mItemPopup = nullptr;
delete []mShowMatrix;
}
@@ -309,7 +309,7 @@ Item *ItemContainer::getSelectedItem() const
if (mInventory)
return mInventory->getItem(mSelectedIndex);
else
- return 0;
+ return nullptr;
}
void ItemContainer::distributeValueChangedEvent()
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 6ae0f6b5b..549aa1616 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -42,7 +42,7 @@ ItemLinkHandler::ItemLinkHandler()
ItemLinkHandler::~ItemLinkHandler()
{
delete mItemPopup;
- mItemPopup = 0;
+ mItemPopup = nullptr;
}
void ItemLinkHandler::handleLink(const std::string &link,
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 560045a29..3682ec448 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -51,7 +51,7 @@
ItemShortcutContainer::ItemShortcutContainer(unsigned number):
ShortcutContainer(),
mItemClicked(false),
- mItemMoved(NULL),
+ mItemMoved(nullptr),
mNumber(number)
{
addMouseListener(this);
@@ -87,12 +87,12 @@ ItemShortcutContainer::~ItemShortcutContainer()
if (mBackgroundImg)
{
mBackgroundImg->decRef();
- mBackgroundImg = 0;
+ mBackgroundImg = nullptr;
}
delete mItemPopup;
- mItemPopup = 0;
+ mItemPopup = nullptr;
delete mSpellPopup;
- mSpellPopup = 0;
+ mSpellPopup = nullptr;
}
void ItemShortcutContainer::draw(gcn::Graphics *graphics)
@@ -304,14 +304,14 @@ void ItemShortcutContainer::mouseReleased(gcn::MouseEvent &event)
const int index = getIndexFromGrid(event.getX(), event.getY());
if (index == -1)
{
- mItemMoved = NULL;
+ mItemMoved = nullptr;
return;
}
if (mItemMoved)
{
itemShortcut[mNumber]->setItems(index,
mItemMoved->getId(), mItemMoved->getColor());
- mItemMoved = NULL;
+ mItemMoved = nullptr;
}
else if (itemShortcut[mNumber]->getItem(index) && mItemClicked)
{
diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp
index 52b92d0bc..7f2f1f621 100644
--- a/src/gui/widgets/layout.cpp
+++ b/src/gui/widgets/layout.cpp
@@ -45,7 +45,7 @@ LayoutCell::~LayoutCell()
if (mType == ARRAY)
{
delete mArray;
- mArray = 0;
+ mArray = nullptr;
}
}
@@ -159,7 +159,7 @@ void LayoutArray::resizeGrid(int w, int h)
i = mCells.begin();
while (i != mCells.end())
{
- i->resize(w, 0);
+ i->resize(w, nullptr);
++i;
}
}
diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h
index 5e3ac4532..c4c703644 100644
--- a/src/gui/widgets/layout.h
+++ b/src/gui/widgets/layout.h
@@ -23,6 +23,8 @@
#ifndef WIDGET_LAYOUT_H
#define WIDGET_LAYOUT_H
+#include "localconsts.h"
+
#include <guichan/widgets/container.hpp>
#include <vector>
@@ -35,7 +37,7 @@ class LayoutCell;
class ContainerPlacer
{
public:
- ContainerPlacer(gcn::Container *c = NULL, LayoutCell *l = NULL):
+ ContainerPlacer(gcn::Container *c = nullptr, LayoutCell *l = nullptr):
mContainer(c), mCell(l)
{}
@@ -172,7 +174,7 @@ class LayoutCell
};
LayoutCell():
- mWidget(0),
+ mWidget(nullptr),
mHPadding(0),
mVPadding(0),
mType(NONE)
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index 2efaa2088..fb72176bd 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -68,7 +68,7 @@ PlayerBox::PlayerBox(const Being *being):
}
else
{
- background.grid[a] = 0;
+ background.grid[a] = nullptr;
}
a++;
}
@@ -85,7 +85,7 @@ PlayerBox::~PlayerBox()
{
instances--;
- mBeing = 0;
+ mBeing = nullptr;
if (instances == 0)
for_each(background.grid, background.grid + 9, dtor<Image*>());
diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h
index 1b1a237d8..2bf010618 100644
--- a/src/gui/widgets/playerbox.h
+++ b/src/gui/widgets/playerbox.h
@@ -52,7 +52,8 @@ class PlayerBox : public gcn::ScrollArea
* player to <code>NULL</code> causes the box not to draw any
* character.
*/
- void setPlayer(const Being *being) { mBeing = being; }
+ void setPlayer(const Being *being)
+ { mBeing = being; }
/**
* Draws the scroll area.
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index ac282b088..78557d481 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -70,7 +70,7 @@ Popup::Popup(const std::string &name, std::string skin):
}
else
{
- mSkin = 0;
+ mSkin = nullptr;
}
// Add this window to the window container
@@ -85,13 +85,13 @@ Popup::~Popup()
logger->log("Popup::~Popup(\"%s\")", mPopupName.c_str());
delete mVertexes;
- mVertexes = 0;
+ mVertexes = nullptr;
if (mSkin)
{
if (Theme::instance())
Theme::instance()->unload(mSkin);
- mSkin = 0;
+ mSkin = nullptr;
}
}
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 7324fc9ad..f9b6da153 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -93,7 +93,7 @@ ProgressBar::ProgressBar(float progress,
else
{
for (int f = 0; f < 9; f ++)
- mBorder.grid[f] = 0;
+ mBorder.grid[f] = nullptr;
}
}
@@ -108,7 +108,7 @@ ProgressBar::~ProgressBar()
if (mInstances == 0)
for_each(mBorder.grid, mBorder.grid + 9, dtor<Image*>());
delete mVertexes;
- mVertexes = 0;
+ mVertexes = nullptr;
}
void ProgressBar::logic()
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index feedeae7b..7d344b09d 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -112,7 +112,7 @@ void RadioButton::drawBox(gcn::Graphics* graphics)
radioCheckedHi->setAlpha(mAlpha);
}
- Image *box = NULL;
+ Image *box = nullptr;
if (isEnabled())
{
diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp
index 861dde29e..c8822eea9 100644
--- a/src/gui/widgets/resizegrip.cpp
+++ b/src/gui/widgets/resizegrip.cpp
@@ -34,7 +34,7 @@
#include "debug.h"
-Image *ResizeGrip::gripImage = 0;
+Image *ResizeGrip::gripImage = nullptr;
int ResizeGrip::mInstances = 0;
float ResizeGrip::mAlpha = 1.0;
@@ -69,7 +69,7 @@ ResizeGrip::~ResizeGrip()
if (mInstances == 0 && gripImage)
{
gripImage->decRef();
- gripImage = 0;
+ gripImage = nullptr;
}
}
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 3204028dc..0ec4a2027 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -111,7 +111,7 @@ ScrollArea::~ScrollArea()
buttons[RIGHT][1]->decRef();
}
delete mVertexes;
- mVertexes = 0;
+ mVertexes = nullptr;
}
void ScrollArea::init()
@@ -147,7 +147,7 @@ void ScrollArea::init()
}
else
{
- background.grid[a] = 0;
+ background.grid[a] = nullptr;
}
a++;
}
@@ -179,7 +179,7 @@ void ScrollArea::init()
}
else
{
- vMarker.grid[a] = 0;
+ vMarker.grid[a] = nullptr;
}
if (vscrollHi)
{
@@ -192,7 +192,7 @@ void ScrollArea::init()
}
else
{
- vMarkerHi.grid[a] = 0;
+ vMarkerHi.grid[a] = nullptr;
}
a++;
}
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 698e133dd..8081f5d7b 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -53,7 +53,7 @@ SetupItem::SetupItem(std::string text, std::string description,
mUseDefault(false),
mValue(""),
mDefault(""),
- mWidget(0),
+ mWidget(nullptr),
mValueType(VBOOL)
{
}
@@ -70,7 +70,7 @@ SetupItem::SetupItem(std::string text, std::string description,
mUseDefault(true),
mValue(""),
mDefault(def),
- mWidget(0),
+ mWidget(nullptr),
mValueType(VBOOL)
{
}
@@ -184,7 +184,7 @@ SetupItemCheckBox::SetupItemCheckBox(std::string text, std::string description,
SetupItemCheckBox::~SetupItemCheckBox()
{
- mWidget = 0;
+ mWidget = nullptr;
}
void SetupItemCheckBox::createControls()
@@ -225,11 +225,11 @@ SetupItemTextField::SetupItemTextField(std::string text,
std::string eventName,
bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
- mHorizont(0),
- mLabel(0),
- mTextField(0),
- mButton(0),
- mEditDialog(0)
+ mHorizont(nullptr),
+ mLabel(nullptr),
+ mTextField(nullptr),
+ mButton(nullptr),
+ mEditDialog(nullptr)
{
mValueType = VSTR;
createControls();
@@ -242,11 +242,11 @@ SetupItemTextField::SetupItemTextField(std::string text,
std::string eventName, std::string def,
bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
- mHorizont(0),
- mLabel(0),
- mTextField(0),
- mButton(0),
- mEditDialog(0)
+ mHorizont(nullptr),
+ mLabel(nullptr),
+ mTextField(nullptr),
+ mButton(nullptr),
+ mEditDialog(nullptr)
{
mValueType = VSTR;
createControls();
@@ -254,11 +254,11 @@ SetupItemTextField::SetupItemTextField(std::string text,
SetupItemTextField::~SetupItemTextField()
{
- mHorizont = 0;
- mWidget = 0;
- mTextField = 0;
- mLabel = 0;
- mButton = 0;
+ mHorizont = nullptr;
+ mWidget = nullptr;
+ mTextField = nullptr;
+ mLabel = nullptr;
+ mButton = nullptr;
}
void SetupItemTextField::createControls()
@@ -318,7 +318,7 @@ void SetupItemTextField::action(const gcn::ActionEvent &event)
else if (event.getId() == mEventName + "_EDIT_OK")
{
mTextField->setText(mEditDialog->getMsg());
- mEditDialog = 0;
+ mEditDialog = nullptr;
}
}
@@ -339,13 +339,13 @@ SetupItemIntTextField::SetupItemIntTextField(std::string text,
int min, int max,
bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
- mHorizont(0),
- mLabel(0),
- mTextField(0),
- mButton(0),
+ mHorizont(nullptr),
+ mLabel(nullptr),
+ mTextField(nullptr),
+ mButton(nullptr),
mMin(min),
mMax(max),
- mEditDialog(0)
+ mEditDialog(nullptr)
{
mValueType = VSTR;
createControls();
@@ -360,13 +360,13 @@ SetupItemIntTextField::SetupItemIntTextField(std::string text,
std::string def,
bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
- mHorizont(0),
- mLabel(0),
- mTextField(0),
- mButton(0),
+ mHorizont(nullptr),
+ mLabel(nullptr),
+ mTextField(nullptr),
+ mButton(nullptr),
mMin(min),
mMax(max),
- mEditDialog(0)
+ mEditDialog(nullptr)
{
mValueType = VSTR;
createControls();
@@ -374,11 +374,11 @@ SetupItemIntTextField::SetupItemIntTextField(std::string text,
SetupItemIntTextField::~SetupItemIntTextField()
{
- mHorizont = 0;
- mWidget = 0;
- mTextField = 0;
- mLabel = 0;
- mButton = 0;
+ mHorizont = nullptr;
+ mWidget = nullptr;
+ mTextField = nullptr;
+ mLabel = nullptr;
+ mButton = nullptr;
}
void SetupItemIntTextField::createControls()
@@ -441,7 +441,7 @@ void SetupItemIntTextField::action(const gcn::ActionEvent &event)
else if (event.getId() == mEventName + "_EDIT_OK")
{
mTextField->setValue(atoi(mEditDialog->getMsg().c_str()));
- mEditDialog = 0;
+ mEditDialog = nullptr;
}
}
@@ -459,7 +459,7 @@ void SetupItemIntTextField::apply(std::string eventName)
SetupItemLabel::SetupItemLabel(std::string text, std::string description,
SetupTabScroll *parent, bool separator) :
SetupItem(text, description, "", parent, "", "", true),
- mLabel(0),
+ mLabel(nullptr),
mIsSeparator(separator)
{
mValueType = VNONE;
@@ -468,8 +468,8 @@ SetupItemLabel::SetupItemLabel(std::string text, std::string description,
SetupItemLabel::~SetupItemLabel()
{
- mWidget = 0;
- mLabel = 0;
+ mWidget = nullptr;
+ mLabel = nullptr;
}
void SetupItemLabel::createControls()
@@ -517,10 +517,10 @@ SetupItemDropDown::SetupItemDropDown(std::string text,
gcn::ListModel *model,
bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
- mHorizont(0),
- mLabel(0),
+ mHorizont(nullptr),
+ mLabel(nullptr),
mModel(model),
- mDropDown(0)
+ mDropDown(nullptr)
{
mValueType = VSTR;
createControls();
@@ -535,10 +535,10 @@ SetupItemDropDown::SetupItemDropDown(std::string text,
std::string def,
bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
- mHorizont(0),
- mLabel(0),
+ mHorizont(nullptr),
+ mLabel(nullptr),
mModel(model),
- mDropDown(0)
+ mDropDown(nullptr)
{
mValueType = VSTR;
createControls();
@@ -546,11 +546,11 @@ SetupItemDropDown::SetupItemDropDown(std::string text,
SetupItemDropDown::~SetupItemDropDown()
{
- mHorizont = 0;
- mWidget = 0;
- mModel = 0;
- mDropDown = 0;
- mLabel = 0;
+ mHorizont = nullptr;
+ mWidget = nullptr;
+ mModel = nullptr;
+ mDropDown = nullptr;
+ mLabel = nullptr;
}
void SetupItemDropDown::createControls()
diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp
index e9917b090..4fb092070 100644
--- a/src/gui/widgets/setuptabscroll.cpp
+++ b/src/gui/widgets/setuptabscroll.cpp
@@ -43,10 +43,10 @@ SetupTabScroll::SetupTabScroll() :
SetupTabScroll::~SetupTabScroll()
{
- mScroll = 0;
+ mScroll = nullptr;
delete mContainer;
- mContainer = 0;
+ mContainer = nullptr;
std::set<SetupItem*>::iterator it = mAllItems.begin();
std::set<SetupItem*>::iterator it_end = mAllItems.end();
diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp
index e15445b77..d3aac5c56 100644
--- a/src/gui/widgets/shopitems.cpp
+++ b/src/gui/widgets/shopitems.cpp
@@ -75,7 +75,7 @@ void ShopItems::addItemNoDup(int id, unsigned char color,
void ShopItems::addItem2(int inventoryIndex, int id, unsigned char color,
int quantity, int price)
{
- ShopItem *item = 0;
+ ShopItem *item = nullptr;
if (mMergeDuplicates)
item = findItem(id, color);
@@ -93,7 +93,7 @@ void ShopItems::addItem2(int inventoryIndex, int id, unsigned char color,
ShopItem *ShopItems::at(unsigned int i) const
{
if (i >= mShopItems.size())
- return 0;
+ return nullptr;
return mShopItems.at(i);
}
@@ -137,5 +137,5 @@ ShopItem *ShopItems::findItem(int id, unsigned char color) const
++it;
}
- return 0;
+ return nullptr;
}
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 793491808..b649a81ef 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -47,7 +47,7 @@ float ShopListBox::mAlpha = 1.0;
ShopListBox::ShopListBox(gcn::ListModel *listModel):
ListBox(listModel),
mPlayerMoney(0),
- mShopItems(0)
+ mShopItems(nullptr)
{
mRowHeight = getFont()->getHeight();
init();
diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp
index 9fd9b26c6..36f88da08 100644
--- a/src/gui/widgets/shortcutcontainer.cpp
+++ b/src/gui/widgets/shortcutcontainer.cpp
@@ -33,7 +33,7 @@
float ShortcutContainer::mAlpha = 1.0;
ShortcutContainer::ShortcutContainer():
- mBackgroundImg(0),
+ mBackgroundImg(nullptr),
mMaxItems(0),
mBoxWidth(1),
mBoxHeight(1),
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index d29c2211f..3822d40c9 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -101,9 +101,9 @@ void Slider::init()
}
else
{
- hStart = 0;
- hMid = 0;
- hEnd = 0;
+ hStart = nullptr;
+ hMid = nullptr;
+ hEnd = nullptr;
}
if (sliderHi)
{
@@ -113,9 +113,9 @@ void Slider::init()
}
else
{
- hStartHi = 0;
- hMidHi = 0;
- hEndHi = 0;
+ hStartHi = nullptr;
+ hMidHi = nullptr;
+ hEndHi = nullptr;
}
x = 6; y = 8;
@@ -123,11 +123,11 @@ void Slider::init()
if (slider)
hGrip = slider->getSubImage(x, y, w, h);
else
- hGrip = 0;
+ hGrip = nullptr;
if (sliderHi)
hGripHi = sliderHi->getSubImage(x, y, w, h);
else
- hGripHi = 0;
+ hGripHi = nullptr;
x = 0; y = 6;
w = 6; h = 21;
@@ -140,9 +140,9 @@ void Slider::init()
}
else
{
- vStart = 0;
- vMid = 0;
- vEnd = 0;
+ vStart = nullptr;
+ vMid = nullptr;
+ vEnd = nullptr;
}
if (sliderHi)
{
@@ -152,9 +152,9 @@ void Slider::init()
}
else
{
- vStartHi = 0;
- vMidHi = 0;
- vEndHi = 0;
+ vStartHi = nullptr;
+ vMidHi = nullptr;
+ vEndHi = nullptr;
}
x = 6; y = 8;
@@ -162,12 +162,12 @@ void Slider::init()
if (slider)
vGrip = slider->getSubImage(x, y, w, h);
else
- vGrip = 0;
+ vGrip = nullptr;
if (sliderHi)
vGripHi = sliderHi->getSubImage(x, y, w, h);
else
- vGripHi = 0;
+ vGripHi = nullptr;
if (slider)
slider->decRef();
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 6317dd56f..5c4dbc9a1 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -54,7 +54,7 @@
SpellShortcutContainer::SpellShortcutContainer(unsigned number):
ShortcutContainer(),
mSpellClicked(false),
- mSpellMoved(NULL),
+ mSpellMoved(nullptr),
mNumber(number)
{
mBoxWidth = mBoxWidth;
@@ -88,9 +88,9 @@ SpellShortcutContainer::~SpellShortcutContainer()
{
if (mBackgroundImg)
mBackgroundImg->decRef();
- mBackgroundImg = 0;
+ mBackgroundImg = nullptr;
delete mSpellPopup;
- mSpellPopup = 0;
+ mSpellPopup = nullptr;
}
void SpellShortcutContainer::draw(gcn::Graphics *graphics)
@@ -251,7 +251,7 @@ void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event)
}
else if (event.getButton() == gcn::MouseEvent::RIGHT)
{
- TextCommand *spell = NULL;
+ TextCommand *spell = nullptr;
if (itemId >= 0)
spell = spellManager->getSpell(itemId);
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index 530f1ac82..8e4b1fe6f 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -91,7 +91,7 @@ Tab::~Tab()
for_each(tabImg[mode].grid, tabImg[mode].grid + 9, dtor<Image*>());
}
delete mVertexes;
- mVertexes = 0;
+ mVertexes = nullptr;
}
void Tab::init()
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 47b02c925..fb9279343 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -46,15 +46,15 @@ TabbedArea::TabbedArea()
mArrowButton[0] = new Button("<", "shift_left", this);
mArrowButton[1] = new Button(">", "shift_right", this);
- widgetResized(NULL);
+ widgetResized(nullptr);
}
TabbedArea::~TabbedArea()
{
delete mArrowButton[0];
- mArrowButton[0] = 0;
+ mArrowButton[0] = nullptr;
delete mArrowButton[1];
- mArrowButton[1] = 0;
+ mArrowButton[1] = nullptr;
}
void TabbedArea::enableScrollButtons(bool enable)
@@ -90,7 +90,7 @@ Tab *TabbedArea::getTab(const std::string &name) const
++itr;
}
- return NULL;
+ return nullptr;
}
void TabbedArea::draw(gcn::Graphics *graphics)
@@ -112,7 +112,7 @@ gcn::Widget *TabbedArea::getWidget(const std::string &name) const
++itr;
}
- return NULL;
+ return nullptr;
}
gcn::Widget *TabbedArea::getCurrentWidget()
@@ -122,7 +122,7 @@ gcn::Widget *TabbedArea::getCurrentWidget()
if (tab)
return getWidget(tab->getCaption());
else
- return NULL;
+ return nullptr;
}
void TabbedArea::addTab(gcn::Tab* tab, gcn::Widget* widget)
@@ -192,7 +192,7 @@ void TabbedArea::removeTab(gcn::Tab *tab)
if (tabIndexToBeSelected == -1)
{
- mSelectedTab = 0;
+ mSelectedTab = nullptr;
mWidgetContainer->clear();
}
else
@@ -238,7 +238,7 @@ void TabbedArea::setSelectedTab(gcn::Tab *tab)
if (newTab)
newTab->setCurrent();
- widgetResized(NULL);
+ widgetResized(nullptr);
}
void TabbedArea::setSelectedTab(const std::string &name)
@@ -266,7 +266,7 @@ void TabbedArea::widgetResized(const gcn::Event &event A_UNUSED)
if (w)
{
int newScroll = 0;
- ScrollArea* scr = 0;
+ ScrollArea* scr = nullptr;
if (mFollowDownScroll && height != 0)
{
gcn::Rectangle rect = w->getDimension();
@@ -444,14 +444,14 @@ void TabbedArea::updateArrowEnableState()
Tab *TabbedArea::getTabByIndex(int index) const
{
if (index < 0 || index >= static_cast<int>(mTabs.size()))
- return 0;
+ return nullptr;
return static_cast<Tab*>(mTabs[index].first);
}
gcn::Widget *TabbedArea::getWidgetByIndex(int index) const
{
if (index < 0 || index >= static_cast<int>(mTabs.size()))
- return 0;
+ return nullptr;
return mTabs[index].second;
}
diff --git a/src/gui/widgets/tablemodel.cpp b/src/gui/widgets/tablemodel.cpp
index 6c932a411..f54b4281a 100644
--- a/src/gui/widgets/tablemodel.cpp
+++ b/src/gui/widgets/tablemodel.cpp
@@ -68,7 +68,7 @@ StaticTableModel::StaticTableModel(int row, int column) :
mColumns(column),
mHeight(1)
{
- mTableModel.resize(row * column, NULL);
+ mTableModel.resize(row * column, nullptr);
mWidths.resize(column, 1);
}
@@ -82,7 +82,7 @@ void StaticTableModel::resize()
{
mRows = getRows();
mColumns = getColumns();
- mTableModel.resize(mRows * mColumns, NULL);
+ mTableModel.resize(mRows * mColumns, nullptr);
}
void StaticTableModel::set(int row, int column, gcn::Widget *widget)
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 6ce4cbf3b..b4584947a 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -86,7 +86,7 @@ TextField::TextField(const std::string &text, bool loseFocusOnTab,
}
else
{
- skin.grid[a] = 0;
+ skin.grid[a] = nullptr;
}
a++;
}
diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h
index 93f970168..e530cfef2 100644
--- a/src/gui/widgets/textfield.h
+++ b/src/gui/widgets/textfield.h
@@ -25,6 +25,8 @@
#include <guichan/widgets/textfield.hpp>
+#include "localconsts.h"
+
class ImageRect;
class TextField;
@@ -40,7 +42,7 @@ class TextField : public gcn::TextField
* Constructor, initializes the text field with the given string.
*/
TextField(const std::string &text = "", bool loseFocusOnTab = true,
- gcn::ActionListener* listener = NULL,
+ gcn::ActionListener* listener = nullptr,
std::string eventId = "", bool sendAlwaysEvents = false);
~TextField();
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index 07cf19b61..9be2d5b3f 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -44,7 +44,7 @@ TextPreview::TextPreview(const std::string &text):
mTextAlpha = false;
mFont = gui->getFont();
mTextColor = &Theme::getThemeColor(Theme::TEXT);
- mTextBGColor = NULL;
+ mTextBGColor = nullptr;
mBGColor = &Theme::getThemeColor(Theme::BACKGROUND);
mOpaque = false;
}
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index c52bf744e..273695a1a 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -49,9 +49,9 @@ int Window::mouseResize = 0;
Window::Window(const std::string &caption, bool modal, Window *parent,
std::string skin):
gcn::Window(caption),
- mGrip(0),
+ mGrip(nullptr),
mParent(parent),
- mLayout(NULL),
+ mLayout(nullptr),
mWindowName("window"),
mShowTitle(true),
mModal(modal),
@@ -91,7 +91,7 @@ Window::Window(const std::string &caption, bool modal, Window *parent,
}
else
{
- mSkin = 0;
+ mSkin = nullptr;
}
// Add this window to the window container
@@ -118,7 +118,7 @@ Window::~Window()
saveWindowState();
delete mLayout;
- mLayout = 0;
+ mLayout = nullptr;
while (!mWidgets.empty())
delete mWidgets.front();
@@ -127,7 +127,7 @@ Window::~Window()
removeWidgetListener(this);
delete mVertexes;
- mVertexes = 0;
+ mVertexes = nullptr;
instances--;
@@ -135,7 +135,7 @@ Window::~Window()
{
if (Theme::instance())
Theme::instance()->unload(mSkin);
- mSkin = 0;
+ mSkin = nullptr;
}
}
@@ -348,7 +348,7 @@ void Window::setResizable(bool r)
{
remove(mGrip);
delete mGrip;
- mGrip = 0;
+ mGrip = nullptr;
}
}
@@ -947,7 +947,7 @@ void Window::reflowLayout(int w, int h)
mLayout->reflow(w, h);
delete mLayout;
- mLayout = 0;
+ mLayout = nullptr;
setContentSize(w, h);
}
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index ffc27ab10..5ace2328e 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -25,6 +25,7 @@
#include "graphics.h"
#include "guichanfwd.h"
+#include "localconsts.h"
#include <guichan/widgetlistener.hpp>
@@ -65,7 +66,7 @@ class Window : public gcn::Window, gcn::WidgetListener
* @param skin The location where the window's skin XML can be found.
*/
Window(const std::string &caption = "Window", bool modal = false,
- Window *parent = NULL, std::string skin = "");
+ Window *parent = nullptr, std::string skin = "");
/**
* Destructor. Deletes all the added widgets.
diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp
index 5a3c16037..34a6b68c7 100644
--- a/src/gui/widgets/windowcontainer.cpp
+++ b/src/gui/widgets/windowcontainer.cpp
@@ -26,7 +26,7 @@
#include "debug.h"
-WindowContainer *windowContainer = NULL;
+WindowContainer *windowContainer = nullptr;
void WindowContainer::logic()
{
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 487035350..3f41be466 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -58,7 +58,7 @@ extern Window *botCheckerWindow;
extern Window *socialWindow;
WindowMenu::WindowMenu():
- mEmotePopup(0)
+ mEmotePopup(nullptr)
{
int x = 0, h = 0;
@@ -115,7 +115,7 @@ WindowMenu::WindowMenu():
WindowMenu::~WindowMenu()
{
delete mTextPopup;
- mTextPopup = 0;
+ mTextPopup = nullptr;
mButtonNames.clear();
std::vector <gcn::Button*>::iterator it, it_end;
for (it = mButtons.begin(), it_end = mButtons.end(); it != it_end; ++it)
@@ -132,7 +132,7 @@ WindowMenu::~WindowMenu()
void WindowMenu::action(const gcn::ActionEvent &event)
{
- Window *window = 0;
+ Window *window = nullptr;
if (event.getId() == ":-)")
{
@@ -153,14 +153,14 @@ void WindowMenu::action(const gcn::ActionEvent &event)
}
else
{
- mEmotePopup = 0;
+ mEmotePopup = nullptr;
}
}
else
{
if (windowContainer)
windowContainer->scheduleDelete(mEmotePopup);
- mEmotePopup = 0;
+ mEmotePopup = nullptr;
}
}
else if (event.getId() == "STA")
@@ -238,7 +238,7 @@ void WindowMenu::valueChanged(const gcn::SelectionEvent &event)
if (windowContainer)
windowContainer->scheduleDelete(mEmotePopup);
- mEmotePopup = 0;
+ mEmotePopup = nullptr;
}
}
diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp
index b4f697ba3..ae5345031 100644
--- a/src/gui/worldselectdialog.cpp
+++ b/src/gui/worldselectdialog.cpp
@@ -74,7 +74,7 @@ class WorldListModel : public gcn::ListModel
};
WorldSelectDialog::WorldSelectDialog(Worlds worlds):
- Window(_("Select World"), false, 0, "world.xml")
+ Window(_("Select World"), false, nullptr, "world.xml")
{
mWorldListModel = new WorldListModel(worlds);
mWorldList = new ListBox(mWorldListModel);
@@ -114,7 +114,7 @@ WorldSelectDialog::WorldSelectDialog(Worlds worlds):
WorldSelectDialog::~WorldSelectDialog()
{
delete mWorldListModel;
- mWorldListModel = 0;
+ mWorldListModel = nullptr;
}
void WorldSelectDialog::action(const gcn::ActionEvent &event)
@@ -140,7 +140,12 @@ void WorldSelectDialog::keyPressed(gcn::KeyEvent &keyEvent)
gcn::Key key = keyEvent.getKey();
if (key.getValue() == Key::ESCAPE)
- action(gcn::ActionEvent(NULL, mChangeLoginButton->getActionEventId()));
+ {
+ action(gcn::ActionEvent(nullptr,
+ mChangeLoginButton->getActionEventId()));
+ }
else if (key.getValue() == Key::ENTER)
- action(gcn::ActionEvent(NULL, mChooseWorld->getActionEventId()));
+ {
+ action(gcn::ActionEvent(nullptr, mChooseWorld->getActionEventId()));
+ }
}