summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-05-15 18:42:27 +0300
committerAndrei Karas <akaras@inbox.ru>2019-05-15 19:29:09 +0300
commit28155aa478caf68fc5d73e2c38a48ba94c3ecbef (patch)
treee42a91f656c28a7173eaaf652444d67192badb97
parent21fe0039406e8ce5cb664aff89875638e4a31d8a (diff)
downloadmv-28155aa478caf68fc5d73e2c38a48ba94c3ecbef.tar.gz
mv-28155aa478caf68fc5d73e2c38a48ba94c3ecbef.tar.bz2
mv-28155aa478caf68fc5d73e2c38a48ba94c3ecbef.tar.xz
mv-28155aa478caf68fc5d73e2c38a48ba94c3ecbef.zip
Fix special card constants for clients with item id with size 4
Also drop support for 65535 item id on old packet versions.
-rw-r--r--src/const/resources/item/cards.h2
-rw-r--r--src/gui/popups/itempopup.cpp6
-rw-r--r--src/net/messagein.cpp2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/const/resources/item/cards.h b/src/const/resources/item/cards.h
index d11e99dfa..e8ce9bce1 100644
--- a/src/const/resources/item/cards.h
+++ b/src/const/resources/item/cards.h
@@ -26,6 +26,6 @@
#define CARD0_FORGE 0x00FF
#define CARD0_CREATE 0x00FE
-#define CARD0_PET static_cast<uint16_t>(0xFF00)
+#define CARD0_PET static_cast<int16_t>(0xFF00)
#endif // CONST_RESOURCES_ITEM_CARDS_H
diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp
index 0d38d0355..e96d2845b 100644
--- a/src/gui/popups/itempopup.cpp
+++ b/src/gui/popups/itempopup.cpp
@@ -335,7 +335,7 @@ std::string ItemPopup::getCardsString(const int *const cards)
switch (cards[0])
{
- case 0xfe: // named item
+ case CARD0_CREATE: // named item
{
const int32_t charId = cards[2] + 65536 * cards[3];
std::string name = actorManager->findCharById(charId);
@@ -349,11 +349,11 @@ std::string ItemPopup::getCardsString(const int *const cards)
label.append(strprintf(_("Item named: %s"), name.c_str()));
return label;
}
- case 0x00FFU: // forged item
+ case CARD0_FORGE: // forged item
{
return label;
}
- case 0xFF00U:
+ case CARD0_PET:
{
return label;
}
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index 22d0510ce..b0abf9999 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -216,7 +216,7 @@ uint32_t MessageIn::readUInt32(const char *const str)
int MessageIn::readItemId(const char *const str)
{
if (itemIdLen == 2)
- return readUInt16(str);
+ return readInt16(str);
return readInt32(str);
}