summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-09 02:15:28 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-09 04:03:03 +0300
commit333745260338c876989744468a5f9c707e9bcc66 (patch)
tree46a2a99bd2b1a88810f016896a77d4ddd872ec63 /src
parente60ac0a6bc0fd662cb7a5834896b3953a1bd07e8 (diff)
downloadplus-333745260338c876989744468a5f9c707e9bcc66.tar.gz
plus-333745260338c876989744468a5f9c707e9bcc66.tar.bz2
plus-333745260338c876989744468a5f9c707e9bcc66.tar.xz
plus-333745260338c876989744468a5f9c707e9bcc66.zip
Fix code style.
Diffstat (limited to 'src')
-rw-r--r--src/actionmanager.cpp1
-rw-r--r--src/game.cpp3
-rw-r--r--src/gui/buydialog.cpp5
-rw-r--r--src/gui/gui.cpp4
-rw-r--r--src/gui/minimap.cpp4
-rw-r--r--src/gui/npcdialog.cpp2
-rw-r--r--src/gui/widgets/chattab.cpp3
-rw-r--r--src/gui/widgets/label.cpp2
-rw-r--r--src/guichan/gui.cpp16
-rw-r--r--src/inputmanager.cpp5
-rw-r--r--src/inputmanager.h2
-rw-r--r--src/keyboardconfig.cpp6
-rw-r--r--src/keyboardconfig.h2
-rw-r--r--src/keyboarddata.h1
14 files changed, 31 insertions, 25 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index b913f7d15..d3e34daa8 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -26,7 +26,6 @@
#include "inputevent.h"
#include "itemshortcut.h"
#include "inputmanager.h"
-#include "keyboardconfig.h"
#include "localplayer.h"
#include "logger.h"
#include "playerinfo.h"
diff --git a/src/game.cpp b/src/game.cpp
index 250028b88..95e450dbf 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -804,7 +804,8 @@ void Game::handleMoveAndAttack()
{
Being *target = nullptr;
- bool newTarget = !inputManager.isActionActive(Input::KEY_TARGET);
+ bool newTarget = !inputManager.isActionActive(
+ Input::KEY_TARGET);
// A set target has highest priority
if (!player_node->getTarget())
{
diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp
index c41f22de7..83207b3d8 100644
--- a/src/gui/buydialog.cpp
+++ b/src/gui/buydialog.cpp
@@ -91,8 +91,7 @@ void BuyDialog::init()
mSlider = new Slider(1.0);
mQuantityLabel = new Label(strprintf("%d / %d", mAmountItems, mMaxItems));
mQuantityLabel->setAlignment(gcn::Graphics::CENTER);
- mMoneyLabel = new Label(strprintf(_("Price: %s / Total: %s"),
- "", ""));
+ mMoneyLabel = new Label(strprintf(_("Price: %s / Total: %s"), "", ""));
mAmountField = new IntTextField(1, 1, 123);
mAmountField->setActionEventId("amount");
@@ -196,7 +195,7 @@ void BuyDialog::action(const gcn::ActionEvent &event)
// The following actions require a valid selection
if (selectedItem < 0 ||
- selectedItem >= static_cast<int>(mShopItems->getNumberOfElements()))
+ selectedItem >= mShopItems->getNumberOfElements())
{
return;
}
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 19361cf2d..e45bc71c0 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -492,7 +492,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
if (!gcn::Widget::widgetExists(widget))
break;
- parent = static_cast<gcn::Widget*>(widget->getParent());
+ parent = widget->getParent();
if (widget->isEnabled() || force)
{
@@ -551,7 +551,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
gcn::Widget* swap = widget;
widget = parent;
- parent = static_cast<gcn::Widget*>(swap->getParent());
+ parent = swap->getParent();
// If a non modal focused widget has been reach
// and we have modal focus cancel the distribution.
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 8089a2feb..9c7ab76cb 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -229,10 +229,10 @@ void Minimap::draw(gcn::Graphics *graphics)
mMapImage->mBounds.h > a.height)
{
const Vector &p = player_node->getPosition();
- mMapOriginX = ((a.width) / 2) - (static_cast<float>(p.x
+ mMapOriginX = (a.width / 2) - (static_cast<float>(p.x
+ viewport->getCameraRelativeX()) * mWidthProportion) / 32;
- mMapOriginY = ((a.height) / 2) - (static_cast<float>(p.y
+ mMapOriginY = (a.height / 2) - (static_cast<float>(p.y
+ viewport->getCameraRelativeY()) * mHeightProportion) / 32;
const int minOriginX = a.width - mMapImage->mBounds.w;
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 5e0e9d56f..24d94dc3f 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -84,7 +84,7 @@ NpcDialog::NpcDialog(int npcId) :
// Setup output text box
mTextBox = new BrowserBox(BrowserBox::AUTO_WRAP);
mTextBox->setOpaque(false);
- mTextBox->setMaxRow(static_cast<int>(config.getIntValue("ChatLogLength")));
+ mTextBox->setMaxRow(config.getIntValue("ChatLogLength"));
mTextBox->setLinkHandler(mItemLinkHandler);
mScrollArea = new ScrollArea(mTextBox);
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 9b3a00963..5f97cd613 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -60,8 +60,7 @@ ChatTab::ChatTab(const std::string &name) :
mTextOutput = new BrowserBox(BrowserBox::AUTO_WRAP);
mTextOutput->setOpaque(false);
- mTextOutput->setMaxRow(static_cast<int>(
- config.getIntValue("ChatLogLength")));
+ mTextOutput->setMaxRow(config.getIntValue("ChatLogLength"));
if (chatWindow)
mTextOutput->setLinkHandler(chatWindow->mItemLinkHandler);
mTextOutput->setAlwaysUpdate(false);
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index 640010c62..dde7ddca3 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -38,5 +38,5 @@ Label::Label(const std::string &caption) :
void Label::draw(gcn::Graphics *graphics)
{
- gcn::Label::draw(static_cast<gcn::Graphics*>(graphics));
+ gcn::Label::draw(graphics);
}
diff --git a/src/guichan/gui.cpp b/src/guichan/gui.cpp
index bd811014f..c96c61737 100644
--- a/src/guichan/gui.cpp
+++ b/src/guichan/gui.cpp
@@ -340,7 +340,7 @@ namespace gcn
while (parent)
{
- parent = static_cast<Widget*>(widget->getParent());
+ parent = widget->getParent();
// Check if the widget is present in the "widget with mouse" queue.
bool widgetIsPresentInQueue = false;
@@ -373,7 +373,7 @@ namespace gcn
Widget* swap = widget;
widget = parent;
- parent = static_cast<Widget*>(swap->getParent());
+ parent = swap->getParent();
}
if (mFocusHandler->getDraggedWidget())
@@ -608,7 +608,7 @@ namespace gcn
if (!Widget::widgetExists(widget))
break;
- parent = static_cast<Widget*>(widget->getParent());
+ parent = widget->getParent();
if (widget->isEnabled() || force)
{
@@ -667,7 +667,7 @@ namespace gcn
Widget* swap = widget;
widget = parent;
- parent = static_cast<Widget*>(swap->getParent());
+ parent = swap->getParent();
// If a non modal focused widget has been reach
// and we have modal focus cancel the distribution.
@@ -711,7 +711,7 @@ namespace gcn
if (!Widget::widgetExists(widget))
break;
- parent = static_cast<Widget*>(widget->getParent());
+ parent = widget->getParent();
if (widget->isEnabled())
{
@@ -740,7 +740,7 @@ namespace gcn
Widget* swap = widget;
widget = parent;
- parent = static_cast<Widget*>(swap->getParent());
+ parent = swap->getParent();
// If a non modal focused widget has been reach
// and we have modal focus cancel the distribution.
@@ -853,7 +853,7 @@ namespace gcn
while (parent)
{
- parent = static_cast<Widget*>(widget->getParent());
+ parent = widget->getParent();
// Check if the widget is present in the "widget with mouse" queue.
bool widgetIsPresentInQueue = false;
@@ -885,7 +885,7 @@ namespace gcn
Widget* swap = widget;
widget = parent;
- parent = static_cast<Widget*>(swap->getParent());
+ parent = swap->getParent();
}
}
}
diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp
index 22af8438c..b539c4bcf 100644
--- a/src/inputmanager.cpp
+++ b/src/inputmanager.cpp
@@ -164,7 +164,8 @@ void InputManager::store()
}
else
{
- keyStr += strprintf(",%s%d", tmp.c_str(), key.value);
+ keyStr += strprintf(",%s%d",
+ tmp.c_str(), key.value);
}
}
}
@@ -504,7 +505,7 @@ void InputManager::updateKeyActionMap(KeyToActionMap &actionMap, int type)
KeyFunction &key = mKey[i];
for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++)
{
- if (key.values[i2].type == INPUT_KEYBOARD)
+ if (key.values[i2].type == type)
actionMap[key.values[i2].value].push_back(i);
}
}
diff --git a/src/inputmanager.h b/src/inputmanager.h
index 0c78e1e09..374b402fb 100644
--- a/src/inputmanager.h
+++ b/src/inputmanager.h
@@ -146,7 +146,7 @@ class InputManager
int mNewKeyIndex; /**< Index of new key to be assigned */
- KeyFunction mKey[Input::KEY_TOTAL]; /**< Pointer to all the key data */
+ KeyFunction mKey[Input::KEY_TOTAL]; /**< Pointer to all the key data */
};
extern InputManager inputManager;
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index 4dfab8852..483b7d511 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -37,6 +37,12 @@
#include "debug.h"
+KeyboardConfig::KeyboardConfig() :
+ mEnabled(true),
+ mActiveKeys(nullptr)
+{
+}
+
void KeyboardConfig::init()
{
mEnabled = true;
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h
index 71e43c230..4d57acc7f 100644
--- a/src/keyboardconfig.h
+++ b/src/keyboardconfig.h
@@ -38,6 +38,8 @@ union SDL_Event;
class KeyboardConfig
{
public:
+ KeyboardConfig();
+
/**
* Initializes the keyboard config explicitly.
*/
diff --git a/src/keyboarddata.h b/src/keyboarddata.h
index 5f8294104..c5bc7b7f2 100644
--- a/src/keyboarddata.h
+++ b/src/keyboarddata.h
@@ -25,7 +25,6 @@
#include "actionmanager.h"
#include "inputmanager.h"
-#include "keyboardconfig.h"
#include "keydata.h"
#include "localconsts.h"