summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-13 01:11:50 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-13 01:11:50 +0300
commit308e352fbf2fd4f96d797e596fc41083e53e6106 (patch)
treee874de1b2ebcaec013f6b1c3363faacc698a438d /src/gui
parentc67648bcc2ebd94da7ad90dc1f886b9f8206de8e (diff)
downloadmanaverse-308e352fbf2fd4f96d797e596fc41083e53e6106.tar.gz
manaverse-308e352fbf2fd4f96d797e596fc41083e53e6106.tar.bz2
manaverse-308e352fbf2fd4f96d797e596fc41083e53e6106.tar.xz
manaverse-308e352fbf2fd4f96d797e596fc41083e53e6106.zip
Fix code style.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/charselectdialog.cpp26
-rw-r--r--src/gui/windowmenu.cpp12
2 files changed, 17 insertions, 21 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index c127f9bf8..ffa88cb75 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -139,8 +139,8 @@ class CharacterScroller final : public Container,
public gcn::ActionListener
{
public:
- CharacterScroller(CharSelectDialog *widget,
- std::vector<CharacterDisplay*> *entries) :
+ CharacterScroller(CharSelectDialog *const widget,
+ std::vector<CharacterDisplay*> *const entries) :
Container(widget),
gcn::ActionListener(),
mSelectedEntry(nullptr),
@@ -168,7 +168,7 @@ class CharacterScroller final : public Container,
void show(const int i)
{
- const int sz = (signed)mCharacterEntries->size();
+ const int sz = static_cast<signed>(mCharacterEntries->size());
if (mSelectedEntry)
mSelectedEntry->setVisible(false);
if (i >= sz)
@@ -185,14 +185,13 @@ class CharacterScroller final : public Container,
void resize()
{
- CharacterDisplay *firtChar = (*mCharacterEntries)[0];
+ const CharacterDisplay *const firtChar = (*mCharacterEntries)[0];
const int x = (getWidth() - firtChar->getWidth()) / 2;
const int y = (getHeight() - firtChar->getHeight()) / 2;
FOR_EACHP (std::vector<CharacterDisplay*>::iterator,
it, mCharacterEntries)
{
- CharacterDisplay *character = *it;
- character->setPosition(x, y);
+ (*it)->setPosition(x, y);
}
const int y2 = (getHeight() - mPrevious->getHeight()) / 2;
const int y3 = y2 - 55;
@@ -216,7 +215,7 @@ class CharacterScroller final : public Container,
}
}
- int getSelected()
+ int getSelected() const
{
return mSelected;
}
@@ -297,23 +296,20 @@ CharSelectDialog::CharSelectDialog(LoginData *const data):
{
for (int i = 0; i < static_cast<int>(mLoginData->characterSlots); i++)
{
- CharacterDisplay *character = new CharacterDisplay(this, this);
+ CharacterDisplay *const character
+ = new CharacterDisplay(this, this);
character->setVisible(false);
mCharacterEntries.push_back(character);
-// placer(i % SLOTS_PER_ROW, static_cast<int>(i) / SLOTS_PER_ROW,
-// mCharacterEntries[i]);
}
mCharacterScroller = new CharacterScroller(this, &mCharacterEntries);
- mCharacterScroller->setWidth(mainGraphics->getWidth() - 2 * getPadding());
+ mCharacterScroller->setWidth(mainGraphics->getWidth()
+ - 2 * getPadding());
mCharacterScroller->setHeight(200);
placer(0, 0, mCharacterScroller);
-// placer(0, 0, mCharacterEntries[0]);
}
reflowLayout();
-
addKeyListener(this);
-
center();
setVisible(true);
@@ -673,7 +669,7 @@ bool CharSelectDialog::selectByName(const std::string &name,
{
if (character->dummy && character->dummy->getName() == name)
{
- focusCharacter(i);
+ focusCharacter(static_cast<int>(i));
if (selAction == Choose)
attemptCharacterSelect(static_cast<int>(i));
return true;
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 6139d410a..c9fb9c40c 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -199,12 +199,12 @@ void WindowMenu::action(const gcn::ActionEvent &event)
{
const std::string &eventId = event.getId();
- std::map <std::string, ButtonInfo*>::iterator
+ const std::map <std::string, ButtonInfo*>::iterator
it = mButtonNames.find(eventId);
if (it == mButtonNames.end())
return;
- ButtonInfo *const info = (*it).second;
+ const ButtonInfo *const info = (*it).second;
if (!info)
return;
@@ -296,7 +296,7 @@ void WindowMenu::mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED)
void WindowMenu::showButton(const std::string &name, const bool visible)
{
- ButtonInfo *const info = dynamic_cast<ButtonInfo *const>(
+ const ButtonInfo *const info = dynamic_cast<ButtonInfo *const>(
mButtonNames[name]);
if (!info || !info->button)
return;
@@ -340,7 +340,7 @@ void WindowMenu::loadButtons()
it = mButtonNames.begin(),
it_end = mButtonNames.end(); it != it_end; ++it)
{
- ButtonInfo *info = (*it).second;
+ const ButtonInfo *const info = (*it).second;
if (!info || !info->button || info->visible)
continue;
info->button->setVisible(false);
@@ -354,7 +354,7 @@ void WindowMenu::loadButtons()
std::string str = config.getValue("windowmenu" + toString(f), "");
if (str == "" || str == "SET")
continue;
- ButtonInfo *const info = dynamic_cast<ButtonInfo *const>(
+ const ButtonInfo *const info = dynamic_cast<ButtonInfo *const>(
mButtonNames[str]);
if (!info || !info->button)
continue;
@@ -367,7 +367,7 @@ void WindowMenu::loadButtons()
it = mButtonNames.begin(),
it_end = mButtonNames.end(); it != it_end; ++it)
{
- ButtonInfo *info = (*it).second;
+ const ButtonInfo *const info = (*it).second;
if (!info || !info->button)
continue;
Button *const button = info->button;