ManaPlus
inventoryhandler.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
25 
26 #include "net/ea/equipbackend.h"
27 #include "net/ea/inventoryrecv.h"
28 
29 #include "utils/delete2.h"
30 
31 #include "debug.h"
32 
33 namespace Ea
34 {
35 
38 {
41  InventoryRecv::mStorage = nullptr;
42  storageWindow = nullptr;
46 }
47 
49 {
50  if (storageWindow != nullptr)
51  {
53  storageWindow = nullptr;
54  }
55 
57 }
58 
60 {
62 }
63 
64 bool InventoryHandler::canSplit(const Item *const item A_UNUSED) const
65 {
66  return false;
67 }
68 
69 void InventoryHandler::splitItem(const Item *const item A_UNUSED,
70  const int amount A_UNUSED) const
71 {
72  // Not implemented for eAthena (possible?)
73 }
74 
75 void InventoryHandler::moveItem(const int oldIndex A_UNUSED,
76  const int newIndex A_UNUSED) const
77 {
78  // Not implemented for eAthena (possible?)
79 }
80 
81 size_t InventoryHandler::getSize(const InventoryTypeT type) const
82 {
83  switch (type)
84  {
87  return 100;
89  return 0; // Comes from server after items
91  return 12;
92  case InventoryType::Npc:
98  default:
99  return 0;
100  }
101 }
103 {
104  BLOCK_START("InventoryHandler::closeStorage")
105  if (storageWindow != nullptr)
106  {
107  InventoryWindow *const inv = storageWindow;
108  storageWindow->close();
109  inv->unsetInventory();
110  }
111  BLOCK_END("InventoryHandler::closeStorage")
112 }
113 
115 {
116  storageWindow = nullptr;
117 }
118 
120 {
121  InventoryRecv::mSentPickups.push(floorId);
122 }
123 
125 {
127 }
128 
129 } // namespace Ea
int BeingId
Definition: beingid.h:30
size_t getSize(const InventoryTypeT type) const A_CONST
static void pushPickup(const BeingId floorId)
void moveItem(const int oldIndex, const int newIndex) const
bool canSplit(const Item *const item) const A_CONST
Inventory * getStorage() const
void splitItem(const Item *const item, const int amount) const
Definition: item.h:50
#define delete2(var)
Definition: delete2.h:25
InventoryType ::T InventoryTypeT
Definition: inventorytype.h:42
InventoryWindow * storageWindow
#define A_UNUSED
Definition: localconsts.h:160
EquipBackend mEquips
PickupQueue mSentPickups
Inventory * mStorage
InventoryItems mStorageItems
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79
std::string empty
Definition: podict.cpp:26