diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-01-17 18:36:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-01-17 19:19:58 +0300 |
commit | 55cbf74cbe2c40b4592e72621e40f8858fc376d9 (patch) | |
tree | 1adb70df7ddddde9a504d572a789e7afb5cae58c /src/net | |
parent | 261a118937d8b1cd41cf16d983f880e5957f84b1 (diff) | |
download | mv-55cbf74cbe2c40b4592e72621e40f8858fc376d9.tar.gz mv-55cbf74cbe2c40b4592e72621e40f8858fc376d9.tar.bz2 mv-55cbf74cbe2c40b4592e72621e40f8858fc376d9.tar.xz mv-55cbf74cbe2c40b4592e72621e40f8858fc376d9.zip |
Move cards constants into separate file.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/inventoryitem.h | 4 | ||||
-rw-r--r-- | src/net/eathena/auctionrecv.cpp | 4 | ||||
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 8 | ||||
-rw-r--r-- | src/net/eathena/inventoryrecv.cpp | 40 | ||||
-rw-r--r-- | src/net/eathena/itemrecv.cpp | 10 | ||||
-rw-r--r-- | src/net/eathena/mailrecv.cpp | 2 | ||||
-rw-r--r-- | src/net/eathena/partyrecv.cpp | 4 | ||||
-rw-r--r-- | src/net/eathena/searchstorerecv.cpp | 4 | ||||
-rw-r--r-- | src/net/eathena/traderecv.cpp | 4 | ||||
-rw-r--r-- | src/net/eathena/vendingrecv.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/inventoryrecv.cpp | 24 | ||||
-rw-r--r-- | src/net/tmwa/traderecv.cpp | 4 |
12 files changed, 63 insertions, 51 deletions
diff --git a/src/net/ea/inventoryitem.h b/src/net/ea/inventoryitem.h index a32b0bfde..7971c9584 100644 --- a/src/net/ea/inventoryitem.h +++ b/src/net/ea/inventoryitem.h @@ -23,6 +23,8 @@ #ifndef NET_EA_INVENTORYITEM_H #define NET_EA_INVENTORYITEM_H +#include "const/resources/item/cards.h" + #include "enums/simpletypes/damaged.h" #include "enums/simpletypes/equipm.h" #include "enums/simpletypes/favorite.h" @@ -51,7 +53,7 @@ class InventoryItem final int slot; int id; int type; - int cards[4]; + int cards[maxCards]; int quantity; uint8_t refine; ItemColor color; diff --git a/src/net/eathena/auctionrecv.cpp b/src/net/eathena/auctionrecv.cpp index e097be551..cc7723e5f 100644 --- a/src/net/eathena/auctionrecv.cpp +++ b/src/net/eathena/auctionrecv.cpp @@ -22,6 +22,8 @@ #include "logger.h" +#include "const/resources/item/cards.h" + #include "net/messagein.h" #include "debug.h" @@ -51,7 +53,7 @@ void AuctionRecv::processAuctionResults(Net::MessageIn &msg) msg.readUInt8("identify"); msg.readUInt8("attribute"); msg.readUInt8("refine"); - for (int d = 0; d < 4; d ++) + for (int d = 0; d < maxCards; d ++) msg.readInt16("card"); msg.readInt32("price"); msg.readInt32("buy now"); diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index 2d66f5152..bb6fff382 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -31,6 +31,8 @@ #include "being/mercenaryinfo.h" +#include "const/resources/item/cards.h" + #include "enums/resources/notifytypes.h" #include "particle/particle.h" @@ -94,7 +96,7 @@ void BeingRecv::processBeingChangeLook2(Net::MessageIn &msg) void BeingRecv::processBeingChangeLookCards(Net::MessageIn &msg) { Being *dstBeing = nullptr; - int cards[4]; + int cards[maxCards]; if (!actorManager) { // here can be look from char server @@ -126,7 +128,7 @@ void BeingRecv::processBeingChangeLookCards(Net::MessageIn &msg) if (type != 2) id2 = 1; - for (int f = 0; f < 4; f ++) + for (int f = 0; f < maxCards; f ++) cards[f] = msg.readInt16("card"); if (!dstBeing) @@ -1585,7 +1587,7 @@ void BeingRecv::processBeingViewEquipment(Net::MessageIn &msg) msg.readInt32("location"); msg.readInt32("wear state"); msg.readInt8("refine"); - for (int d = 0; d < 4; d ++) + for (int d = 0; d < maxCards; d ++) msg.readInt16("card"); msg.readInt32("hire expire date (?)"); msg.readInt16("equip type"); diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp index ecd0a8257..fcaada26a 100644 --- a/src/net/eathena/inventoryrecv.cpp +++ b/src/net/eathena/inventoryrecv.cpp @@ -98,8 +98,8 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg) msg.readInt32("location"); const int equipType = msg.readInt32("wear state"); const uint8_t refine = static_cast<uint8_t>(msg.readInt8("refine")); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); msg.readInt32("hire expire date (?)"); msg.readInt16("equip type"); @@ -159,8 +159,8 @@ void InventoryRecv::processPlayerInventoryAdd(Net::MessageIn &msg) uint8_t identified = msg.readUInt8("identified"); const uint8_t damaged = msg.readUInt8("is damaged"); const uint8_t refine = msg.readUInt8("refine"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); const int equipType = msg.readInt32("location"); const int itemType = msg.readUInt8("item type"); @@ -289,8 +289,8 @@ void InventoryRecv::processPlayerInventory(Net::MessageIn &msg) const int itemType = msg.readUInt8("item type"); const int amount = msg.readInt16("count"); msg.readInt32("wear state / equip"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); msg.readInt32("hire expire date (?)"); ItemFlags flags; @@ -332,8 +332,8 @@ void InventoryRecv::processPlayerStorage(Net::MessageIn &msg) const int itemType = msg.readUInt8("item type"); const int amount = msg.readInt16("count"); msg.readInt32("wear state / equip"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); msg.readInt32("hire expire date (?)"); ItemFlags flags; @@ -488,8 +488,8 @@ void InventoryRecv::processPlayerStorageEquip(Net::MessageIn &msg) msg.readInt32("location"); msg.readInt32("wear state"); const uint8_t refine = msg.readUInt8("refine level"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); msg.readInt32("hire expire date"); msg.readInt16("bind on equip"); @@ -535,8 +535,8 @@ void InventoryRecv::processPlayerStorageAdd(Net::MessageIn &msg) const unsigned char identified = msg.readUInt8("identify"); const Damaged damaged = fromBool(msg.readUInt8("attribute"), Damaged); const uint8_t refine = msg.readUInt8("refine"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); if (serverVersion >= 8 && packetVersion >= 20150226) { @@ -736,8 +736,8 @@ void InventoryRecv::processPlayerCartAdd(Net::MessageIn &msg) uint8_t identified = msg.readUInt8("identified"); const Damaged damaged = fromBool(msg.readUInt8("attribute"), Damaged); const uint8_t refine = msg.readUInt8("refine"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); if (serverVersion >= 8 && packetVersion >= 20150226) { @@ -807,8 +807,8 @@ void InventoryRecv::processPlayerCartEquip(Net::MessageIn &msg) msg.readInt32("location"); msg.readInt32("wear state"); const uint8_t refine = msg.readUInt8("refine level"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); msg.readInt32("hire expire date"); msg.readInt16("bind on equip"); @@ -856,8 +856,8 @@ void InventoryRecv::processPlayerCartItems(Net::MessageIn &msg) const int itemType = msg.readUInt8("item type"); const int amount = msg.readInt16("count"); msg.readInt32("wear state / equip"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); msg.readInt32("hire expire date (?)"); ItemFlags flags; @@ -964,7 +964,7 @@ void InventoryRecv::processPlayerRepairList(Net::MessageIn &msg) msg.readInt16("index"); msg.readInt16("item id"); msg.readUInt8("refine"); - for (int d = 0; d < 4; d ++) + for (int d = 0; d < maxCards; d ++) msg.readInt16("card"); } menu = MenuType::RepairWespon; @@ -989,7 +989,7 @@ void InventoryRecv::processPlayerRefineList(Net::MessageIn &msg) msg.readInt16("item index"); msg.readInt16("item id"); msg.readUInt8("refine"); - for (int d = 0; d < 4; d ++) + for (int d = 0; d < maxCards; d ++) msg.readInt16("card"); } menu = MenuType::WeaponeRefine; diff --git a/src/net/eathena/itemrecv.cpp b/src/net/eathena/itemrecv.cpp index de0eacd08..79892ebf7 100644 --- a/src/net/eathena/itemrecv.cpp +++ b/src/net/eathena/itemrecv.cpp @@ -26,6 +26,8 @@ #include "itemcolormanager.h" #include "logger.h" +#include "const/resources/item/cards.h" + #include "net/messagein.h" #include "debug.h" @@ -71,8 +73,8 @@ void ItemRecv::processItemDropped2(Net::MessageIn &msg) msg.readUInt8("identify"), Identified); const Damaged damaged = fromBool(msg.readUInt8("attribute"), Damaged); const uint8_t refine = msg.readUInt8("refine"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); const int x = msg.readInt16("x"); const int y = msg.readInt16("y"); @@ -145,8 +147,8 @@ void ItemRecv::processItemVisible2(Net::MessageIn &msg) msg.readUInt8("identify"), Identified); const Damaged damaged = fromBool(msg.readUInt8("attribute"), Damaged); const uint8_t refine = msg.readUInt8("refine"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); const int x = msg.readInt16("x"); const int y = msg.readInt16("y"); diff --git a/src/net/eathena/mailrecv.cpp b/src/net/eathena/mailrecv.cpp index 1198968ac..67ba37cf2 100644 --- a/src/net/eathena/mailrecv.cpp +++ b/src/net/eathena/mailrecv.cpp @@ -92,7 +92,7 @@ void MailRecv::processReadMail(Net::MessageIn &msg) mail->itemIdentify = msg.readUInt8("identify"); mail->itemAttribute = msg.readUInt8("attribute"); mail->itemRefine = msg.readUInt8("refine"); - for (int f = 0; f < 4; f ++) + for (int f = 0; f < maxCards; f ++) mail->card[f] = msg.readInt16("card"); const int msgLen = msg.readUInt8("msg len"); if (msgLen != sz) diff --git a/src/net/eathena/partyrecv.cpp b/src/net/eathena/partyrecv.cpp index b71b8d882..c5f04008f 100644 --- a/src/net/eathena/partyrecv.cpp +++ b/src/net/eathena/partyrecv.cpp @@ -26,6 +26,8 @@ #include "being/localplayer.h" +#include "const/resources/item/cards.h" + #include "enums/resources/notifytypes.h" #include "gui/windows/chatwindow.h" @@ -282,7 +284,7 @@ void PartyRecv::processPartyItemPickup(Net::MessageIn &msg) msg.readUInt8("identify"); msg.readUInt8("attribute"); msg.readUInt8("refine"); - for (int f = 0; f < 4; f++) + for (int f = 0; f < maxCards; f++) msg.readInt16("card"); msg.readInt16("equip location"); msg.readUInt8("item type"); diff --git a/src/net/eathena/searchstorerecv.cpp b/src/net/eathena/searchstorerecv.cpp index 5d2d57265..3fc2c26b8 100644 --- a/src/net/eathena/searchstorerecv.cpp +++ b/src/net/eathena/searchstorerecv.cpp @@ -23,6 +23,8 @@ #include "logger.h" #include "notifymanager.h" +#include "const/resources/item/cards.h" + #include "enums/resources/notifytypes.h" #include "net/messagein.h" @@ -49,7 +51,7 @@ void SearchStoreRecv::processSearchAck(Net::MessageIn &msg) msg.readInt32("price"); msg.readInt16("amount"); msg.readUInt8("refine"); - for (int d = 0; d < 4; d++) + for (int d = 0; d < maxCards; d++) msg.readInt16("card"); // +++ need use ItemColorManager for colors diff --git a/src/net/eathena/traderecv.cpp b/src/net/eathena/traderecv.cpp index 97dc6affd..cdae4788e 100644 --- a/src/net/eathena/traderecv.cpp +++ b/src/net/eathena/traderecv.cpp @@ -77,8 +77,8 @@ void TradeRecv::processTradeItemAdd(Net::MessageIn &msg) const uint8_t identify = msg.readUInt8("identify"); const Damaged damaged = fromBool(msg.readUInt8("attribute"), Damaged); const uint8_t refine = msg.readUInt8("refine"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); if (serverVersion >= 8 && packetVersion >= 20150226) { diff --git a/src/net/eathena/vendingrecv.cpp b/src/net/eathena/vendingrecv.cpp index 27e186d40..00618d53d 100644 --- a/src/net/eathena/vendingrecv.cpp +++ b/src/net/eathena/vendingrecv.cpp @@ -84,7 +84,7 @@ void VendingRecv::processItemsList(Net::MessageIn &msg) Being *const being = actorManager->findBeing(id); if (!being) return; - int cards[4]; + int cards[maxCards]; CREATEWIDGETV(mBuyDialog, BuyDialog, being->getName()); mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY)); msg.readInt32("vender id"); @@ -98,7 +98,7 @@ void VendingRecv::processItemsList(Net::MessageIn &msg) msg.readUInt8("identify"); msg.readUInt8("attribute"); msg.readUInt8("refine"); - for (int d = 0; d < 4; d ++) + for (int d = 0; d < maxCards; d ++) cards[d] = msg.readInt16("card"); if (serverVersion >= 8 && packetVersion >= 20150226) { @@ -141,7 +141,7 @@ void VendingRecv::processOpen(Net::MessageIn &msg) msg.readUInt8("identify"); msg.readUInt8("attribute"); msg.readUInt8("refine"); - for (int d = 0; d < 4; d ++) + for (int d = 0; d < maxCards; d ++) msg.readInt16("card"); if (serverVersion >= 8 && packetVersion >= 20150226) { diff --git a/src/net/tmwa/inventoryrecv.cpp b/src/net/tmwa/inventoryrecv.cpp index 897b8a274..ce59dc274 100644 --- a/src/net/tmwa/inventoryrecv.cpp +++ b/src/net/tmwa/inventoryrecv.cpp @@ -68,8 +68,8 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg) const int equipType = msg.readInt16("equip type"); msg.readUInt8("attribute"); const uint8_t refine = msg.readUInt8("refine"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); if (Ea::InventoryRecv::mDebugInventory) @@ -121,8 +121,8 @@ void InventoryRecv::processPlayerInventoryAdd(Net::MessageIn &msg) const uint8_t identified = msg.readUInt8("identified"); msg.readUInt8("attribute"); const uint8_t refine = msg.readUInt8("refine"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); const int equipType = msg.readInt16("equip type"); const int type = msg.readUInt8("item type"); @@ -234,14 +234,14 @@ void InventoryRecv::processPlayerInventory(Net::MessageIn &msg) for (int loop = 0; loop < number; loop++) { - int cards[4]; + int cards[maxCards]; const int index = msg.readInt16("index") - INVENTORY_OFFSET; const int itemId = msg.readInt16("item id"); const uint8_t itemType = msg.readUInt8("item type"); const uint8_t identified = msg.readUInt8("identified"); const int amount = msg.readInt16("amount"); const int arrow = msg.readInt16("arrow"); - for (int i = 0; i < 4; i++) + for (int i = 0; i < maxCards; i++) cards[i] = msg.readInt16("card"); if (Ea::InventoryRecv::mDebugInventory) @@ -284,14 +284,14 @@ void InventoryRecv::processPlayerStorage(Net::MessageIn &msg) for (int loop = 0; loop < number; loop++) { - int cards[4]; + int cards[maxCards]; const int index = msg.readInt16("index") - STORAGE_OFFSET; const int itemId = msg.readInt16("item id"); const uint8_t itemType = msg.readUInt8("item type"); const uint8_t identified = msg.readUInt8("identified"); const int amount = msg.readInt16("amount"); msg.readInt16("arrow"); - for (int i = 0; i < 4; i++) + for (int i = 0; i < maxCards; i++) cards[i] = msg.readInt16("card"); if (Ea::InventoryRecv::mDebugInventory) @@ -362,7 +362,7 @@ void InventoryRecv::processPlayerStorageEquip(Net::MessageIn &msg) for (int loop = 0; loop < number; loop++) { - int cards[4]; + int cards[maxCards]; const int index = msg.readInt16("index") - STORAGE_OFFSET; const int itemId = msg.readInt16("item id"); const uint8_t itemType = msg.readUInt8("item type"); @@ -372,7 +372,7 @@ void InventoryRecv::processPlayerStorageEquip(Net::MessageIn &msg) msg.readInt16("another equip point?"); msg.readUInt8("attribute (broken)"); const uint8_t refine = msg.readUInt8("refine"); - for (int i = 0; i < 4; i++) + for (int i = 0; i < maxCards; i++) cards[i] = msg.readInt16("card"); if (Ea::InventoryRecv::mDebugInventory) @@ -411,8 +411,8 @@ void InventoryRecv::processPlayerStorageAdd(Net::MessageIn &msg) const unsigned char identified = msg.readUInt8("identified"); msg.readUInt8("attribute"); const uint8_t refine = msg.readUInt8("refine"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); if (Item *const item = Ea::InventoryRecv::mStorage->getItem(index)) diff --git a/src/net/tmwa/traderecv.cpp b/src/net/tmwa/traderecv.cpp index 48020eca3..feb65c3a6 100644 --- a/src/net/tmwa/traderecv.cpp +++ b/src/net/tmwa/traderecv.cpp @@ -64,8 +64,8 @@ void TradeRecv::processTradeItemAdd(Net::MessageIn &msg) const uint8_t identify = msg.readUInt8("identify"); msg.readUInt8("attribute"); const uint8_t refine = msg.readUInt8("refine"); - int cards[4]; - for (int f = 0; f < 4; f++) + int cards[maxCards]; + for (int f = 0; f < maxCards; f++) cards[f] = msg.readInt16("card"); if (tradeWindow) |