From 31cce4c22b369148f77d7092903af9462d8151c8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 18 Jul 2014 18:40:59 +0300 Subject: Fix code style. --- src/graphicsmanager.cpp | 2 +- src/gui/popups/itempopup.cpp | 2 +- src/gui/windows/logindialog.cpp | 2 +- src/input/inputactiondata.h | 6 +++--- src/input/inputactionmap.h | 6 +++--- src/input/inputmanager.cpp | 11 ++++++++--- src/net/ea/inventoryhandler.cpp | 5 +++-- src/net/ea/inventoryitem.h | 8 ++++++++ src/net/sdltcpnet.cpp | 4 ++++ src/net/tmwa/charserverhandler.cpp | 2 +- src/net/tmwa/generalhandler.cpp | 3 ++- src/resources/atlasmanager.cpp | 1 - 12 files changed, 35 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index fca6cd014..4f2b147d8 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -495,7 +495,7 @@ void GraphicsManager::initGraphics() settings.textureSize = 1024; else settings.textureSize = sizes[pos]; - logger->log("Detected max texture size: %d", settings.textureSize); + logger->log("Detected max texture size: %u", settings.textureSize); #endif // !defined(ANDROID) && !defined(__APPLE__) #endif } diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp index df245370c..36f971849 100644 --- a/src/gui/popups/itempopup.cpp +++ b/src/gui/popups/itempopup.cpp @@ -124,7 +124,7 @@ void ItemPopup::setItem(const Item *const item, const bool showImage) } else { - mItemName->setCaption(strprintf("%s (+%d), %d", + mItemName->setCaption(strprintf("%s (+%u), %d", ii.getName().c_str(), static_cast(item->getRefine()), ii.getId())); diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp index af87605d3..510470ada 100644 --- a/src/gui/windows/logindialog.cpp +++ b/src/gui/windows/logindialog.cpp @@ -174,7 +174,7 @@ void LoginDialog::postInit() { setVisible(true); - int h = 200; + const int h = 200; if (mUpdateHostLabel) setContentSize(310, 250); setContentSize(310, h); diff --git a/src/input/inputactiondata.h b/src/input/inputactiondata.h index 95c55e689..403f5050e 100644 --- a/src/input/inputactiondata.h +++ b/src/input/inputactiondata.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef INPUT_KEYDATA_H -#define INPUT_KEYDATA_H +#ifndef INPUT_INPUTACTIONDATA_H +#define INPUT_INPUTACTIONDATA_H #include "events/inputevent.h" @@ -59,4 +59,4 @@ namespace Input } // namespace Input -#endif // INPUT_KEYDATA_H +#endif // INPUT_INPUTACTIONDATA_H diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 538ba8675..cb1278d08 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef INPUT_KEYBOARDDATA_H -#define INPUT_KEYBOARDDATA_H +#ifndef INPUT_INPUTACTIONMAP_H +#define INPUT_INPUTACTIONMAP_H #include "actionmanager.h" #include "sdlshared.h" @@ -2221,4 +2221,4 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { | InputCondition::VALIDSPEED} }; -#endif // INPUT_KEYBOARDDATA_H +#endif // INPUT_INPUTACTIONMAP_H diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index 68950f4cf..22ea7f85b 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -107,7 +107,8 @@ void InputManager::retrieve() for (int i = 0; i < InputAction::TOTAL; i++) { #ifdef USE_SDL2 - const std::string cf = std::string("sdl2") + inputActionData[i].configField; + const std::string cf = std::string("sdl2") + + inputActionData[i].configField; #else const std::string cf = inputActionData[i].configField; #endif @@ -162,7 +163,8 @@ void InputManager::store() const for (int i = 0; i < InputAction::TOTAL; i++) { #ifdef USE_SDL2 - const std::string cf = std::string("sdl2") + inputActionData[i].configField; + const std::string cf = std::string("sdl2") + + inputActionData[i].configField; #else const std::string cf = inputActionData[i].configField; #endif @@ -276,8 +278,11 @@ bool InputManager::hasConflicts(int &restrict key1, int &restrict key2) const size_t j; for (j = i, j++; j < InputAction::TOTAL; j++) { - if ((kdi.grp & inputActionData[j].grp) == 0 || !*kdi.configField) + if ((kdi.grp & inputActionData[j].grp) == 0 + || !*kdi.configField) + { continue; + } for (size_t j2 = 0; j2 < inputFunctionSize; j2 ++) { diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 2b2d1cc9e..b7c827a4d 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -266,11 +266,12 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) if (mDebugInventory) { - logger->log("Index: %d, ID: %d, Type: %d, Identified: %d, " + logger->log("Index: %d, ID: %d, Type: %d, Identified: %u, " "Qty: %d, Cards: %d, %d, %d, %d, Refine: %u", index, itemId, itemType, static_cast(identified), amount, - cards[0], cards[1], cards[2], cards[3], refine); + cards[0], cards[1], cards[2], cards[3], + static_cast(refine)); } if (serverVersion < 1 && identified > 1U) diff --git a/src/net/ea/inventoryitem.h b/src/net/ea/inventoryitem.h index f46ff48be..0f1e372ee 100644 --- a/src/net/ea/inventoryitem.h +++ b/src/net/ea/inventoryitem.h @@ -23,6 +23,14 @@ #ifndef NET_EA_INVENTORYITEM_H #define NET_EA_INVENTORYITEM_H +#if defined(__GXX_EXPERIMENTAL_CXX0X__) +#include +#else +#include +#endif + +#include "localconsts.h" + namespace Ea { diff --git a/src/net/sdltcpnet.cpp b/src/net/sdltcpnet.cpp index 2bbb9837a..ebe165125 100644 --- a/src/net/sdltcpnet.cpp +++ b/src/net/sdltcpnet.cpp @@ -44,6 +44,9 @@ #include "debug.h" +#if !defined(__native_client__) \ + && (defined(TCP_THIN_LINEAR_TIMEOUTS) \ + || defined(TCP_THIN_DUPACK)) // because actual struct is hidden in SDL_net we reinroducing it here struct TCPsocketHack final { @@ -53,6 +56,7 @@ struct TCPsocketHack final IPaddress localAddress; int sflag; }; +#endif void TcpNet::init() { diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 67fff4029..c01ec4666 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -178,7 +178,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, const int hat = msg.readInt16(); // head option top const int topClothes = msg.readInt16(); - uint8_t hairColor = msg.readUInt8(); + const uint8_t hairColor = msg.readUInt8(); msg.readUInt8(); // free tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1, ItemDB::get(-hairStyle).getDyeColorsString(hairColor)); diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 7ef237bbc..a31f6d1dc 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -133,7 +133,8 @@ void GeneralHandler::handleMessage(Net::MessageIn &msg) case SMSG_CONNECTION_PROBLEM: { const uint8_t code = msg.readUInt8(); - logger->log("Connection problem: %u", static_cast(code)); + logger->log("Connection problem: %u", + static_cast(code)); switch (code) { diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp index c78c9911f..8b1cfe374 100644 --- a/src/resources/atlasmanager.cpp +++ b/src/resources/atlasmanager.cpp @@ -24,7 +24,6 @@ #include "resources/atlasmanager.h" -#include "configuration.h" #include "settings.h" #ifdef DEBUG_IMAGES -- cgit v1.2.3-60-g2f50