fix container update item

This commit is contained in:
Henrique Santiago 2012-01-20 02:27:36 -02:00
parent f21927e8d9
commit b17cc43fc6
2 changed files with 7 additions and 1 deletions

View File

@ -98,6 +98,7 @@ function Containers.onContainerUpdateItem(containerId, slot, item)
local itemWidget = container:getChildByIndex(slot + 1) local itemWidget = container:getChildByIndex(slot + 1)
if not itemWidget then return end if not itemWidget then return end
itemWidget:setItem(item) itemWidget:setItem(item)
item:setPos(itemWidget.position)
end end
function Containers.onContainerRemoveItem(containerId, slot) function Containers.onContainerRemoveItem(containerId, slot)

View File

@ -369,7 +369,12 @@ int Game::getThingStackpos(const ThingPtr& thing)
// thing is at map // thing is at map
if(thing->getPos().x != 65535) { if(thing->getPos().x != 65535) {
TilePtr tile = g_map.getTile(thing->getPos()); TilePtr tile = g_map.getTile(thing->getPos());
return tile->getThingStackpos(thing); if(tile)
return tile->getThingStackpos(thing);
else {
logError("could not get tile");
return -1;
}
} }
// thing is at container or inventory // thing is at container or inventory