diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-11-05 01:09:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-11-05 01:09:30 +0300 |
commit | 485e9bb12bf5dda318ac0ccbf1d2a1cd86cf8c70 (patch) | |
tree | ce74f5a2fb646439cb58c2d85bc67ff29b70dbb7 /src | |
parent | 33f4a30373c8978d4e4f29422a5b0132fd14a0ec (diff) | |
download | plus-485e9bb12bf5dda318ac0ccbf1d2a1cd86cf8c70.tar.gz plus-485e9bb12bf5dda318ac0ccbf1d2a1cd86cf8c70.tar.bz2 plus-485e9bb12bf5dda318ac0ccbf1d2a1cd86cf8c70.tar.xz plus-485e9bb12bf5dda318ac0ccbf1d2a1cd86cf8c70.zip |
Fix code style.
Diffstat (limited to 'src')
-rw-r--r-- | src/actormanager.cpp | 6 | ||||
-rw-r--r-- | src/being/localplayer.cpp | 11 | ||||
-rw-r--r-- | src/being/playerinfo.cpp | 3 | ||||
-rw-r--r-- | src/fs/virtfs/zipentry.h | 2 | ||||
-rw-r--r-- | src/gui/fonts/font.cpp | 3 | ||||
-rw-r--r-- | src/gui/gui.cpp | 6 | ||||
-rw-r--r-- | src/gui/sdlinput.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/layoutarray.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/popup.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_input.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/textbox.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 12 | ||||
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 19 | ||||
-rw-r--r-- | src/net/eathena/gamerecv.cpp | 3 | ||||
-rw-r--r-- | src/net/eathena/playerrecv.cpp | 5 | ||||
-rw-r--r-- | src/net/tmwa/beingrecv.cpp | 24 | ||||
-rw-r--r-- | src/net/tmwa/gamerecv.cpp | 3 | ||||
-rw-r--r-- | src/net/tmwa/playerrecv.cpp | 5 | ||||
-rw-r--r-- | src/render/sdlgraphics.cpp | 5 | ||||
-rw-r--r-- | src/resources/dye/dye.cpp | 3 | ||||
-rw-r--r-- | src/utils/base64.cpp | 5 |
22 files changed, 99 insertions, 43 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp index f052edd99..974eef64a 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -900,10 +900,8 @@ Being *ActorManager::findNearestByName(const std::string &name, int dist = 0; Being* closestBeing = nullptr; - int x, y; - - x = localPlayer->getTileX(); - y = localPlayer->getTileY(); + int x = localPlayer->getTileX(); + int y = localPlayer->getTileY(); for_actorsm { diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 54c95bd85..d344926fa 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -667,7 +667,8 @@ void LocalPlayer::startWalking(const unsigned char dir) return; } - int dx = 0, dy = 0; + int dx = 0; + int dy = 0; if ((dir & BeingDirection::UP) != 0) dy--; if ((dir & BeingDirection::DOWN) != 0) @@ -1579,7 +1580,10 @@ bool LocalPlayer::pickUpItems(int pickUpType) if (pickUpType == 0) return status; - int x1, y1, x2, y2; + int x1; + int y1; + int x2; + int y2; switch (pickUpType) { case 1: @@ -1662,7 +1666,8 @@ bool LocalPlayer::pickUpItems(int pickUpType) void LocalPlayer::moveByDirection(const unsigned char dir) { - int dx = 0, dy = 0; + int dx = 0; + int dy = 0; if ((dir & BeingDirection::UP) != 0) dy--; if ((dir & BeingDirection::DOWN) != 0) diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp index 15c2eb939..32a39e0c7 100644 --- a/src/being/playerinfo.cpp +++ b/src/being/playerinfo.cpp @@ -173,7 +173,8 @@ int getStatEffective(const AttributesT id) const std::pair<int, int> getStatExperience(const AttributesT id) { const StatMap::const_iterator it = mData.mStats.find(id); - int a, b; + int a; + int b; if (it != mData.mStats.end()) { a = it->second.exp; diff --git a/src/fs/virtfs/zipentry.h b/src/fs/virtfs/zipentry.h index 9a1a3cbea..84b9cf6db 100644 --- a/src/fs/virtfs/zipentry.h +++ b/src/fs/virtfs/zipentry.h @@ -36,7 +36,7 @@ struct ZipEntry final : public FsEntry { ZipEntry(const std::string &restrict archiveName, const std::string &subDir0, - FsFuncs *restrict const funcs); + FsFuncs *restrict const funcs0); A_DELETE_COPY(ZipEntry) diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp index e7a69225b..9d09d7855 100644 --- a/src/gui/fonts/font.cpp +++ b/src/gui/fonts/font.cpp @@ -351,7 +351,8 @@ int Font::getWidth(const std::string &text) const } // if string was not drawed - int w, h; + int w; + int h; getSafeUtf8String(text, strBuf); TTF_SizeUTF8(mFont, strBuf, &w, &h); return w; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 1f8589b50..be516ebe9 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -698,7 +698,8 @@ void Gui::handleMouseMoved(const MouseInput &mouseInput) && Widget::widgetExists(widget) && (widget != nullptr)) { - int x, y; + int x; + int y; widget->getAbsolutePosition(x, y); if (x > mouseX || y > mouseY @@ -1273,7 +1274,8 @@ Widget* Gui::getWidgetAt(const int x, const int y) const while (child != nullptr) { Widget *const swap = child; - int parentX, parentY; + int parentX; + int parentY; parent->getAbsolutePosition(parentX, parentY); child = parent->getWidgetAt(x - parentX, y - parentY); parent = swap; diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index f1da58cbc..541eb460e 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -367,7 +367,8 @@ void SDLInput::simulateMouseMove() return; mMouseMoveTime = cur_time; - int x, y; + int x; + int y; Gui::getMouseState(x, y); MouseInput mouseInput; diff --git a/src/gui/widgets/layoutarray.cpp b/src/gui/widgets/layoutarray.cpp index 46dd07085..a86d0111e 100644 --- a/src/gui/widgets/layoutarray.cpp +++ b/src/gui/widgets/layoutarray.cpp @@ -299,7 +299,10 @@ void LayoutArray::reflow(const int nx, const int ny, [CAST_SIZE(gridX)]; if ((cell != nullptr) && cell->mType != LayoutCell::NONE) { - int dx = x, dy = y, dw = 0, dh = 0; + int dx = x; + int dy = y; + int dw = 0; + int dh = 0; align(dx, dw, 0, *cell, &widths[CAST_SIZE(gridX)], szW - gridX); align(dy, dh, 1, *cell, diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 4ae11bbd1..c676de26e 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -175,8 +175,10 @@ void Popup::setLocationRelativeTo(const Widget *const widget) if (widget == nullptr) return; - int wx, wy; - int x, y; + int wx; + int wy; + int x; + int y; widget->getAbsolutePosition(wx, wy); getAbsolutePosition(x, y); diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 52372c385..cce45deee 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -1019,7 +1019,8 @@ Rect ScrollArea::getVerticalMarkerDimension() if (!mVBarVisible) return Rect(0, 0, 0, 0); - int length, pos; + int length; + int pos; int height; const int h2 = mShowButtons ? mScrollbarWidth : mMarkerSize / 2; @@ -1076,7 +1077,8 @@ Rect ScrollArea::getHorizontalMarkerDimension() if (!mHBarVisible) return Rect(0, 0, 0, 0); - int length, pos; + int length; + int pos; int width; const int w2 = mShowButtons ? mScrollbarWidth : mMarkerSize / 2; diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index adf9245bf..49b31c5fe 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -151,7 +151,8 @@ Setup_Input::~Setup_Input() void Setup_Input::apply() { keyUnresolved(); - InputActionT key1, key2; + InputActionT key1; + InputActionT key2; if (inputManager.hasConflicts(key1, key2)) { diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 905347f89..545f52fa3 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -554,9 +554,9 @@ void TextBox::setCaretRow(const int row) unsigned int TextBox::getCaretPosition() const { - int pos = 0, row; + int pos = 0; - for (row = 0; row < mCaretRow; row++) + for (int row = 0; row < mCaretRow; row++) pos += CAST_S32(mTextRows[row].size()); return pos + mCaretColumn; diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 3df552404..f76c5fb9e 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -510,8 +510,10 @@ void Window::setLocationRelativeTo(const Widget *const widget) if (widget == nullptr) return; - int wx, wy; - int x, y; + int wx; + int wy; + int x; + int y; widget->getAbsolutePosition(wx, wy); getAbsolutePosition(x, y); @@ -527,8 +529,10 @@ void Window::setLocationHorisontallyRelativeTo(const Widget *const widget) if (widget == nullptr) return; - int wx, wy; - int x, y; + int wx; + int wy; + int x; + int y; widget->getAbsolutePosition(wx, wy); getAbsolutePosition(x, y); diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index f05148810..ec7f4dc09 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -546,7 +546,8 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg) true); uint8_t dir; - uint16_t x, y; + uint16_t x; + uint16_t y; msg.readCoordinates(x, y, dir, "position"); msg.readInt8("xs"); msg.readInt8("ys"); @@ -728,7 +729,10 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) gloves, !serverFeatures->haveMove3()); - uint16_t srcX, srcY, dstX, dstY; + uint16_t srcX; + uint16_t srcY; + uint16_t dstX; + uint16_t dstY; msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); msg.readUInt8("(sx<<4) | (sy&0x0f)"); msg.readInt8("xs"); @@ -915,7 +919,8 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg) true); uint8_t dir; - uint16_t x, y; + uint16_t x; + uint16_t y; msg.readCoordinates(x, y, dir, "position"); msg.readInt8("xs"); msg.readInt8("ys"); @@ -1153,7 +1158,10 @@ void BeingRecv::processBeingMove2(Net::MessageIn &msg) Being *const dstBeing = actorManager->findBeing( msg.readBeingId("being id")); - uint16_t srcX, srcY, dstX, dstY; + uint16_t srcX; + uint16_t srcY; + uint16_t dstX; + uint16_t dstY; msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); msg.readUInt8("(sx<<4) | (sy&0x0f)"); msg.readInt32("tick"); @@ -1707,7 +1715,8 @@ void BeingRecv::processBeingRemoveSkill(Net::MessageIn &msg) void BeingRecv::processBeingFakeName(Net::MessageIn &msg) { - uint16_t x, y; + uint16_t x; + uint16_t y; uint8_t dir; if (msg.getVersion() < 20071106) { diff --git a/src/net/eathena/gamerecv.cpp b/src/net/eathena/gamerecv.cpp index 9a517c74f..d78d5d92d 100644 --- a/src/net/eathena/gamerecv.cpp +++ b/src/net/eathena/gamerecv.cpp @@ -47,7 +47,8 @@ void GameRecv::processMapAccountId(Net::MessageIn &msg) void GameRecv::processMapLogin(Net::MessageIn &msg) { unsigned char direction; - uint16_t x, y; + uint16_t x; + uint16_t y; msg.readInt32("start time"); msg.readCoordinates(x, y, direction, "position"); msg.readInt8("x size"); diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp index dfaa98b75..32336249d 100644 --- a/src/net/eathena/playerrecv.cpp +++ b/src/net/eathena/playerrecv.cpp @@ -255,7 +255,10 @@ void PlayerRecv::processWalkResponse(Net::MessageIn &msg) * and that the server will send a correction notice * otherwise. */ - uint16_t srcX, srcY, dstX, dstY; + uint16_t srcX; + uint16_t srcY; + uint16_t dstX; + uint16_t dstY; msg.readInt32("tick"); msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); msg.readUInt8("(sx<<4) | (sy&0x0f)"); diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp index 69744946b..72ba7e2ab 100644 --- a/src/net/tmwa/beingrecv.cpp +++ b/src/net/tmwa/beingrecv.cpp @@ -353,7 +353,8 @@ void BeingRecv::processPlayerUpdate1(Net::MessageIn &msg) } localPlayer->imitateOutfit(dstBeing, -1); - uint16_t x, y; + uint16_t x; + uint16_t y; msg.readCoordinates(x, y, dir, "position"); dstBeing->setTileCoords(x, y); dstBeing->setDirection(dir); @@ -497,7 +498,8 @@ void BeingRecv::processPlayerUpdate2(Net::MessageIn &msg) } localPlayer->imitateOutfit(dstBeing, -1); - uint16_t x, y; + uint16_t x; + uint16_t y; msg.readCoordinates(x, y, dir, "position"); dstBeing->setTileCoords(x, y); dstBeing->setDirection(dir); @@ -641,7 +643,10 @@ void BeingRecv::processPlayerMove(Net::MessageIn &msg) } localPlayer->imitateOutfit(dstBeing, -1); - uint16_t srcX, srcY, dstX, dstY; + uint16_t srcX; + uint16_t srcY; + uint16_t dstX; + uint16_t dstY; msg.readCoordinatePair(srcX, srcY, dstX, dstY, "moving path"); localPlayer->followMoveTo(dstBeing, srcX, srcY, dstX, dstY); @@ -875,7 +880,8 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg) } uint8_t dir; - uint16_t x, y; + uint16_t x; + uint16_t y; msg.readCoordinates(x, y, dir, "position"); dstBeing->setTileCoords(x, y); @@ -1083,7 +1089,10 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg) setServerGender(dstBeing, gender); } - uint16_t srcX, srcY, dstX, dstY; + uint16_t srcX; + uint16_t srcY; + uint16_t dstX; + uint16_t dstY; msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); if (disguiseId == 0) { @@ -1187,7 +1196,10 @@ void BeingRecv::processBeingMove2(Net::MessageIn &msg) return; } - uint16_t srcX, srcY, dstX, dstY; + uint16_t srcX; + uint16_t srcY; + uint16_t dstX; + uint16_t dstY; msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); msg.readInt32("tick"); diff --git a/src/net/tmwa/gamerecv.cpp b/src/net/tmwa/gamerecv.cpp index c1b1c399a..76c2e6bfa 100644 --- a/src/net/tmwa/gamerecv.cpp +++ b/src/net/tmwa/gamerecv.cpp @@ -41,7 +41,8 @@ extern ServerInfo mapServer; void GameRecv::processMapLogin(Net::MessageIn &msg) { unsigned char direction; - uint16_t x, y; + uint16_t x; + uint16_t y; msg.readInt32("tick"); msg.readCoordinates(x, y, direction, "position"); msg.readInt16("unknown?"); diff --git a/src/net/tmwa/playerrecv.cpp b/src/net/tmwa/playerrecv.cpp index 8cb0bbc5d..844297b92 100644 --- a/src/net/tmwa/playerrecv.cpp +++ b/src/net/tmwa/playerrecv.cpp @@ -173,7 +173,10 @@ void PlayerRecv::processWalkResponse(Net::MessageIn &msg) * and that the server will send a correction notice * otherwise. */ - uint16_t srcX, srcY, dstX, dstY; + uint16_t srcX; + uint16_t srcY; + uint16_t dstX; + uint16_t dstY; msg.readInt32("tick"); msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path"); msg.readUInt8("unused"); diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index ad7ea9fcd..c1d0846b1 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -839,7 +839,10 @@ int SDLGraphics::SDL_FakeUpperBlit(const SDL_Surface *restrict const src, const SDL_Surface *restrict const dst, SDL_Rect *restrict dstrect) const restrict2 { - int srcx, srcy, w, h; + int srcx; + int srcy; + int w; + int h; // Make sure the surfaces aren't locked if ((src == nullptr) || (dst == nullptr)) diff --git a/src/resources/dye/dye.cpp b/src/resources/dye/dye.cpp index 0e8f87a78..df4d165cc 100644 --- a/src/resources/dye/dye.cpp +++ b/src/resources/dye/dye.cpp @@ -105,7 +105,8 @@ void Dye::instantiate(std::string &restrict target, std::ostringstream s; s << target.substr(0, next_pos); - size_t last_pos = target.length(), pal_pos = 0; + size_t last_pos = target.length(); + size_t pal_pos = 0; do { const size_t pos = next_pos; diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp index 62ba76f21..5a87f517c 100644 --- a/src/utils/base64.cpp +++ b/src/utils/base64.cpp @@ -102,7 +102,10 @@ unsigned char *php3_base64_decode(const unsigned char *restrict const string, int *restrict const ret_length) { const unsigned char *current = string; - int ch, i = 0, j = 0, k; + int ch; + int i = 0; + int j = 0; + int k; unsigned char *result = static_cast<unsigned char *>( calloc(length + 1, 1)); |