From 955d2dab6f5e75c913bdfa15ed2d6b9c3cdf3338 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 9 Nov 2011 03:16:39 +0300 Subject: Fix code style. --- src/client.cpp | 3 ++- src/game.cpp | 7 ++++++- src/gui/quitdialog.cpp | 3 ++- src/gui/updaterwindow.cpp | 3 ++- src/gui/worldselectdialog.cpp | 7 ++++++- src/joystick.cpp | 4 ++++ src/joystick.h | 5 ++++- src/mumblemanager.cpp | 5 +++-- src/particlecontainer.h | 4 +++- src/utils/base64.cpp | 2 +- src/utils/copynpaste.cpp | 3 ++- 11 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index c842d0d00..8e3babf2e 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -342,7 +342,8 @@ Client::Client(const Options &options): SDL_EnableUNICODE(1); SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); - SDL_WM_SetCaption(branding.getValue("appName", "ManaPlus").c_str(), nullptr); + SDL_WM_SetCaption(branding.getValue("appName", + "ManaPlus").c_str(), nullptr); ResourceManager *resman = ResourceManager::getInstance(); diff --git a/src/game.cpp b/src/game.cpp index d5cfad13a..0825a74cf 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -840,9 +840,14 @@ void Game::handleInput() helpWindow->setVisible(false); // Close the config window, cancelling changes if opened else if (setupWindow->isVisible()) - setupWindow->action(gcn::ActionEvent(nullptr, "cancel")); + { + setupWindow->action(gcn::ActionEvent( + nullptr, "cancel")); + } else if (dialog) + { dialog->action(gcn::ActionEvent(nullptr, "ok")); + } } if (chatWindow && keyboard.isKeyActive( keyboard.KEY_TOGGLE_CHAT)) diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp index 0f4d7f6f7..450cfd86e 100644 --- a/src/gui/quitdialog.cpp +++ b/src/gui/quitdialog.cpp @@ -165,7 +165,8 @@ void QuitDialog::keyPressed(gcn::KeyEvent &keyEvent) action(gcn::ActionEvent(nullptr, mOkButton->getActionEventId())); break; case Key::ESCAPE: - action(gcn::ActionEvent(nullptr, mCancelButton->getActionEventId())); + action(gcn::ActionEvent(nullptr, + mCancelButton->getActionEventId())); break; case Key::UP: dir = -1; diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index ed745aa74..ac51cc76f 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -268,7 +268,8 @@ void UpdaterWindow::keyPressed(gcn::KeyEvent &keyEvent) } else { - action(gcn::ActionEvent(nullptr, mCancelButton->getActionEventId())); + action(gcn::ActionEvent(nullptr, + mCancelButton->getActionEventId())); } } } diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp index f7b505610..ae5345031 100644 --- a/src/gui/worldselectdialog.cpp +++ b/src/gui/worldselectdialog.cpp @@ -140,7 +140,12 @@ void WorldSelectDialog::keyPressed(gcn::KeyEvent &keyEvent) gcn::Key key = keyEvent.getKey(); if (key.getValue() == Key::ESCAPE) - action(gcn::ActionEvent(nullptr, mChangeLoginButton->getActionEventId())); + { + action(gcn::ActionEvent(nullptr, + mChangeLoginButton->getActionEventId())); + } else if (key.getValue() == Key::ENTER) + { action(gcn::ActionEvent(nullptr, mChooseWorld->getActionEventId())); + } } diff --git a/src/joystick.cpp b/src/joystick.cpp index 29e2c31cc..3084a5ae6 100644 --- a/src/joystick.cpp +++ b/src/joystick.cpp @@ -51,6 +51,10 @@ void Joystick::init() Joystick::Joystick(int no): mDirection(0), mJoystick(nullptr), + mUpTolerance(0), + mDownTolerance(0), + mLeftTolerance(0), + mRightTolerance(0), mCalibrating(false), mCalibrated(false), mButtonsNumber(MAX_BUTTONS) diff --git a/src/joystick.h b/src/joystick.h index 3a2258cd5..6a8a1a1b9 100644 --- a/src/joystick.h +++ b/src/joystick.h @@ -114,7 +114,10 @@ class Joystick bool mButtons[MAX_BUTTONS]; SDL_Joystick *mJoystick; - int mUpTolerance, mDownTolerance, mLeftTolerance, mRightTolerance; + int mUpTolerance; + int mDownTolerance; + int mLeftTolerance; + int mRightTolerance; bool mCalibrating; int mNumber; bool mCalibrated; diff --git a/src/mumblemanager.cpp b/src/mumblemanager.cpp index 0757f5f96..766f4085e 100644 --- a/src/mumblemanager.cpp +++ b/src/mumblemanager.cpp @@ -116,8 +116,9 @@ void MumbleManager::init() return; } - mLinkedMem = static_cast(mmap(nullptr, sizeof(struct LinkedMem), - PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, 0)); + mLinkedMem = static_cast(mmap(nullptr, + sizeof(struct LinkedMem), PROT_READ | PROT_WRITE, + MAP_SHARED, shmfd, 0)); if (mLinkedMem == reinterpret_cast(-1)) { diff --git a/src/particlecontainer.h b/src/particlecontainer.h index 75cda83fc..937c4dd63 100644 --- a/src/particlecontainer.h +++ b/src/particlecontainer.h @@ -44,7 +44,9 @@ public: * * delParent means that the destructor should also free the parent. */ - ParticleContainer(ParticleContainer *parent = nullptr, bool delParent = true); + ParticleContainer(ParticleContainer *parent = nullptr, + bool delParent = true); + virtual ~ParticleContainer(); /** diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp index 1ea75322b..843a0b534 100644 --- a/src/utils/base64.cpp +++ b/src/utils/base64.cpp @@ -102,7 +102,7 @@ unsigned char *php3_base64_decode(const unsigned char *string, unsigned char *result = static_cast( calloc(length + 1, 1)); - if (result == nullptr) + if (!result) return nullptr; /* run through the whole string, converting as we go */ diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index 98b98fbe9..3e37afd9d 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -94,7 +94,8 @@ bool retrieveBuffer(std::string& text, std::string::size_type& pos) bool sendBuffer(std::string& text) { - int wCharsLen = MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, nullptr, 0); + int wCharsLen = MultiByteToWideChar(CP_UTF8, + 0, text.c_str(), -1, nullptr, 0); if (!wCharsLen) return false; -- cgit v1.2.3-60-g2f50