mirror of
https://gitea.sffnetwork.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-11-23 02:49:48 +00:00
the whole game
This commit is contained in:
parent
816e9060b4
commit
f0617a5d22
2069 changed files with 581500 additions and 0 deletions
41
src/world/inventory/BaseContainerMenu.cpp
Executable file
41
src/world/inventory/BaseContainerMenu.cpp
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
#include "BaseContainerMenu.h"
|
||||
#include "../item/ItemInstance.h"
|
||||
|
||||
BaseContainerMenu::BaseContainerMenu( int containerType )
|
||||
: containerId(-1),
|
||||
containerType(containerType),
|
||||
listener(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
void BaseContainerMenu::setListener( IContainerListener* listener )
|
||||
{
|
||||
if (!(this->listener = listener))
|
||||
return;
|
||||
|
||||
if (listener)
|
||||
listener->refreshContainer(this, lastSlots = getItems());
|
||||
}
|
||||
|
||||
void BaseContainerMenu::broadcastChanges()
|
||||
{
|
||||
//LOGI("broadcast: Base. Listener: %p\n", listener);
|
||||
if (!listener)
|
||||
return;
|
||||
|
||||
ItemList slots = getItems();
|
||||
if (slots.size() != lastSlots.size()) {
|
||||
listener->refreshContainer(this, lastSlots = slots);
|
||||
return;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < slots.size(); i++) {
|
||||
ItemInstance& current = slots[i];
|
||||
ItemInstance& expected = lastSlots[i];
|
||||
if (!ItemInstance::matches(&expected, ¤t)) {
|
||||
expected = current;
|
||||
//LOGI("Broadcasting a change!\n");
|
||||
listener->slotChanged(this, i, expected, isResultSlot(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue