diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/being/localplayer.cpp | 19 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 1 | ||||
-rw-r--r-- | src/gui/shortcut/emoteshortcut.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/selldialog.cpp | 3 | ||||
-rw-r--r-- | src/gui/windows/npcdialog.cpp | 6 | ||||
-rw-r--r-- | src/gui/windows/npcdialog.h | 2 | ||||
-rw-r--r-- | src/net/eathena/inventoryrecv.cpp | 1 | ||||
-rw-r--r-- | src/resources/db/emotedb.cpp | 2 |
8 files changed, 19 insertions, 18 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 0f6f434d0..6a6d541b7 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -299,10 +299,10 @@ void LocalPlayer::logic() { if (mMessageTime == 0) { - const MessagePair info = mMessages.front(); - if ((particleEngine != nullptr) && (gui != nullptr)) { + const MessagePair& info = mMessages.front(); + particleEngine->addTextRiseFadeOutEffect( info.first, mPixelX, @@ -328,14 +328,15 @@ void LocalPlayer::logic() else { // Find whether target is in range - const int rangeX = CAST_S32( - abs(mTarget->mX - mX)); - const int rangeY = CAST_S32( - abs(mTarget->mY - mY)); + const int dx = abs(mTarget->mX - mX); + const int dy = abs(mTarget->mY - mY); const int attackRange = getAttackRange(); - const TargetCursorTypeT targetType - = rangeX > attackRange || rangeY > attackRange - ? TargetCursorType::NORMAL : TargetCursorType::IN_RANGE; + const bool inRange = (dx <= attackRange + && dy <= attackRange); + const TargetCursorTypeT targetType = + inRange ? TargetCursorType::IN_RANGE + : TargetCursorType::NORMAL; + mTarget->setTargetType(targetType); if (!mTarget->isAlive() && (!mTargetDeadPlayers diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index be44210a8..f2c5de51e 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -2636,6 +2636,7 @@ void PopupMenu::addBuySell(const Being *const being) // TRANSLATORS: buy item mBrowserBox->addRow("/buy 'NAME'", _("Buy (?)")); } + if (being->isBuyShopEnabled()) { // TRANSLATORS: popup menu item diff --git a/src/gui/shortcut/emoteshortcut.cpp b/src/gui/shortcut/emoteshortcut.cpp index 578a75ade..52597edad 100644 --- a/src/gui/shortcut/emoteshortcut.cpp +++ b/src/gui/shortcut/emoteshortcut.cpp @@ -51,8 +51,7 @@ EmoteShortcut::~EmoteShortcut() void EmoteShortcut::load() { - for (unsigned char i = 0, j = 0, - fsz = CAST_U8(EmoteDB::getLast()); + for (unsigned char i = 0, j = 0, fsz = CAST_U8(EmoteDB::getLast()); i <= fsz && j < SHORTCUT_EMOTES; i++) { diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp index 5badc538a..a6b79b2f1 100644 --- a/src/gui/widgets/selldialog.cpp +++ b/src/gui/widgets/selldialog.cpp @@ -94,8 +94,7 @@ void SellDialog::postInit() setupWindow->registerWindowForReset(this); // Create a ShopItems instance, that is aware of duplicate entries. - mShopItems = new ShopItems(true, - DEFAULT_CURRENCY); + mShopItems = new ShopItems(true, DEFAULT_CURRENCY); if (mAdvanced == Advanced_true) mShopItems->setMergeDuplicates(false); diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 4ace1d6f8..4f87cfebc 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -296,8 +296,7 @@ void NpcDialog::addText(const std::string &text, const bool save) mText.clear(); mNewText.append(text); - mTextBox->addRow(text, - false); + mTextBox->addRow(text, false); } mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll()); mActionState = NpcActionState::WAIT; @@ -1318,8 +1317,7 @@ void NpcDialog::createSkinControls() splitToStringVector(parts, info->text, '\n'); FOR_EACH (StringVectCIter, it2, parts) { - box->addRow(*it2, - false); + box->addRow(*it2, false); } } FOR_EACH (STD_VECTOR<NpcButtonInfo*>::const_iterator, diff --git a/src/gui/windows/npcdialog.h b/src/gui/windows/npcdialog.h index 15d0441c7..89cfa817b 100644 --- a/src/gui/windows/npcdialog.h +++ b/src/gui/windows/npcdialog.h @@ -167,7 +167,7 @@ class NpcDialog final : public Window, static bool isAnyInputFocused() A_WARN_UNUSED; /** - * Requests a interger from the user. + * Requests an integer from the user. */ void integerRequest(const int defaultValue, const int min, diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp index b7fb91af1..8ad7bb617 100644 --- a/src/net/eathena/inventoryrecv.cpp +++ b/src/net/eathena/inventoryrecv.cpp @@ -302,6 +302,7 @@ void InventoryRecv::processPlayerInventoryAdd(Net::MessageIn &msg) UNIMPLEMENTEDPACKETFIELD(err); break; } + if (localPlayer != nullptr) { if (itemId == 0) diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp index 6785b9516..9d05c3d26 100644 --- a/src/resources/db/emotedb.cpp +++ b/src/resources/db/emotedb.cpp @@ -116,8 +116,10 @@ void EmoteDB::loadXmlFile(const std::string &fileName, currentInfo = mEmoteInfos[id]; else currentInfo = new EmoteInfo; + if (currentInfo == nullptr) continue; + currentInfo->time = XML::getProperty(emoteNode, "time", 500); currentInfo->effectId = XML::getProperty(emoteNode, "effect", -1); |