From 2257406db0fd374e929def04525671c2826306c2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 18 Feb 2012 02:06:44 +0300 Subject: Fix code style. --- src/animatedsprite.cpp | 7 ++++++- src/game.cpp | 4 ++-- src/graphics.cpp | 2 +- src/gui/emotepopup.cpp | 9 ++++++--- src/gui/setup_video.cpp | 1 - src/gui/spellpopup.cpp | 2 -- src/gui/viewport.cpp | 2 +- src/gui/whoisonline.cpp | 2 +- src/gui/widgets/browserbox.cpp | 2 +- src/gui/widgets/textbox.cpp | 4 ++-- src/localplayer.cpp | 8 ++------ src/resources/dye.cpp | 2 +- src/resources/image.cpp | 18 ++++++++++++++---- src/resources/specialdb.cpp | 1 - src/utils/process.cpp | 2 +- 15 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index 11329b321..6b791fdd4 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -214,7 +214,12 @@ bool AnimatedSprite::updateCurrentAnimation(unsigned int time) } } if (fail) - mFrameTime = mFrame->delay + 1; + { + if (mFrame) + mFrameTime = mFrame->delay + 1; + else + mFrameTime ++; + } } return true; } diff --git a/src/game.cpp b/src/game.cpp index 6adf62f12..e016d02ff 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1420,7 +1420,7 @@ void Game::handleMoveAndAttack(SDL_Event &event, bool wasDown) Net::getPlayerHandler()->setDirection(direction); } } - direction = 0; +// direction = 0; } else { @@ -1695,7 +1695,7 @@ void Game::handleInput() { if (emoteShortcut) emoteShortcut->useEmote(emotion); - used = true; +// used = true; setValidSpeed(); return; } diff --git a/src/graphics.cpp b/src/graphics.cpp index e98b1a283..5241bbcc6 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -112,7 +112,7 @@ bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, if (mTarget->format) { logger->log("Bits per pixel: %d", mTarget->format->BytesPerPixel); - bpp = mTarget->format->BytesPerPixel; +// bpp = mTarget->format->BytesPerPixel; } const SDL_VideoInfo *vi = SDL_GetVideoInfo(); diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp index a286f78e8..39017ac91 100644 --- a/src/gui/emotepopup.cpp +++ b/src/gui/emotepopup.cpp @@ -197,12 +197,15 @@ void EmotePopup::recalculateSize() ++mRowCount; if (mRowCount) + { mColumnCount = emoteCount / mRowCount; + if (emoteCount % mRowCount > 0) + ++ mColumnCount; + } else + { mColumnCount = 1; - - if (emoteCount % mRowCount > 0) - ++mColumnCount; + } setContentSize(mColumnCount * gridWidth, mRowCount * gridHeight); } diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 6b3d6d4d3..cc3063a68 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -228,7 +228,6 @@ static const char *speechModeToString(Being::Speech mode) case Being::NAME_IN_BUBBLE: return _("Bubbles with names"); } - return ""; } const char *Setup_Video::overlayDetailToString(int detail) diff --git a/src/gui/spellpopup.cpp b/src/gui/spellpopup.cpp index 66d69b197..48037f03e 100644 --- a/src/gui/spellpopup.cpp +++ b/src/gui/spellpopup.cpp @@ -114,8 +114,6 @@ void SpellPopup::view(int x, int y) { if (y > getHeight() + distance) posY = y - getHeight() - distance; - else - y = 0; } setPosition(posX, posY); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 2e1e15c92..d4c188bfb 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -879,7 +879,7 @@ bool Viewport::isPopupMenuVisible() void Viewport::moveCameraToActor(int actorId, int x, int y) { - if (!player_node) + if (!player_node || !actorSpriteManager) return; Actor *actor = actorSpriteManager->findBeing(actorId); diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 1efa9c22d..7e4f02426 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -230,7 +230,7 @@ void WhoIsOnline::updateWindow(std::vector &friends, if (addedFromSection == true && !disregard.empty()) { mBrowserBox->addRow("---"); - addedFromSection = false; +// addedFromSection = false; } for (int i = 0; i < static_cast(disregard.size()); i++) { diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 5856a91b1..49b73a76a 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -655,7 +655,7 @@ std::string BrowserBox::getTextAtPos(const int x, const int y) return ""; // mouse position ourside of correct widget (outside of tab) textX = x - textX; - textY = y - textY; +// textY = y - textY; std::string str = ""; diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index a4bc3bc09..575036612 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -116,14 +116,14 @@ void TextBox::setTextWrapped(const std::string &text, int minDimension) mMinWidth = minWidth; wrappedStream.clear(); wrappedStream.str(""); - spacePos = 0; +// spacePos = 0; lastNewlinePos = 0; newlinePos = text.find("\n", lastNewlinePos); if (newlinePos == std::string::npos) newlinePos = text.size(); line = text.substr(lastNewlinePos, newlinePos - lastNewlinePos); - width = 0; +// width = 0; break; } else diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 0576c8ddb..4675f80cf 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -3168,15 +3168,11 @@ void LocalPlayer::specialMove(unsigned char direction) && getInvertDirection() <= 4) && !mIsServerBuggy) { - int max; - if (getInvertDirection() == 2) - max = 10; - else - max = 30; - if (mAction == MOVE) return; + int max; + if (getInvertDirection() == 2) max = 5; else if (getInvertDirection() == 4) diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index 6800c5170..eec5916c4 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -309,7 +309,7 @@ void Dye::instantiate(std::string &target, const std::string &palettes) { s << palettes.substr(pal_pos); s << target.substr(next_pos); - pal_pos = std::string::npos; + //pal_pos = std::string::npos; break; } s << palettes.substr(pal_pos, pal_next_pos - pal_pos); diff --git a/src/resources/image.cpp b/src/resources/image.cpp index 0ac11f114..1e2bd6b51 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -885,10 +885,20 @@ SubImage::SubImage(Image *parent, SDL_Surface *image, mBounds.y = static_cast(y); mBounds.w = static_cast(width); mBounds.h = static_cast(height); - mInternalBounds.x = mParent->mBounds.x; - mInternalBounds.y = mParent->mBounds.y; - mInternalBounds.w = mParent->mBounds.w; - mInternalBounds.h = mParent->mBounds.h; + if (mParent) + { + mInternalBounds.x = mParent->mBounds.x; + mInternalBounds.y = mParent->mBounds.y; + mInternalBounds.w = mParent->mBounds.w; + mInternalBounds.h = mParent->mBounds.h; + } + else + { + mInternalBounds.x = 0; + mInternalBounds.y = 0; + mInternalBounds.w = 1; + mInternalBounds.h = 1; + } mUseAlphaCache = false; } diff --git a/src/resources/specialdb.cpp b/src/resources/specialdb.cpp index 664d2c73d..50ea773bc 100644 --- a/src/resources/specialdb.cpp +++ b/src/resources/specialdb.cpp @@ -129,5 +129,4 @@ SpecialInfo *SpecialDB::get(int id) return nullptr; else return i->second; - return nullptr; } diff --git a/src/utils/process.cpp b/src/utils/process.cpp index 4a2081514..fd0ec0fa8 100644 --- a/src/utils/process.cpp +++ b/src/utils/process.cpp @@ -130,7 +130,7 @@ int execFile(std::string pathName, std::string name, } else if (!sleep_pid) { // sleep pid - sleep (timeOut); + sleep (waitTime); // printf ("time out\n"); exit(-1); } -- cgit v1.2.3-70-g09d2