mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
Huge engine change, replace all std::shared_ptrs
Create a new shared pointer type stdext::shared_object_ptr and stdext::shared_obj using boost::intrusive_ptr Advantages: * half memory usage * faster and lightweight Disadvantages: * using weak_ptr is not supported anymore * compiling seems slower
This commit is contained in:
@@ -113,13 +113,13 @@ function doCreatureFitFilters(creature)
|
||||
local hideSkulls = hideSkullsButton:isChecked()
|
||||
local hideParty = hidePartyButton:isChecked()
|
||||
|
||||
if hidePlayers and creature:asPlayer() then
|
||||
if hidePlayers and creature:isPlayer() then
|
||||
return false
|
||||
elseif hideNPCs and creature:asNpc() then
|
||||
elseif hideNPCs and creature:isNpc() then
|
||||
return false
|
||||
elseif hideMonsters and creature:asMonster() then
|
||||
elseif hideMonsters and creature:isMonster() then
|
||||
return false
|
||||
elseif hideSkulls and creature:asPlayer() and creature:getSkull() == SkullNone then
|
||||
elseif hideSkulls and creature:isPlayer() and creature:getSkull() == SkullNone then
|
||||
return false
|
||||
elseif hideParty and creature:getShield() > ShieldWhiteBlue then
|
||||
return false
|
||||
|
@@ -150,7 +150,7 @@ function onChooseItemMouseRelease(self, mousePosition, mouseButton)
|
||||
if tile then
|
||||
local thing = tile:getTopMoveThing()
|
||||
if thing then
|
||||
item = thing:asItem()
|
||||
item = thing:isItem()
|
||||
end
|
||||
end
|
||||
elseif clickedWidget:getClassName() == 'UIItem' and not clickedWidget:isVirtual() then
|
||||
|
@@ -267,7 +267,7 @@ function createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
||||
|
||||
end
|
||||
|
||||
if lookThing and not lookThing:asCreature() and not lookThing:isNotMoveable() and lookThing:isPickupable() then
|
||||
if lookThing and not lookThing:isCreature() and not lookThing:isNotMoveable() and lookThing:isPickupable() then
|
||||
menu:addSeparator()
|
||||
menu:addOption(tr('Trade with ...'), function() startTradeWith(lookThing) end)
|
||||
end
|
||||
@@ -282,7 +282,7 @@ function createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
||||
if creatureThing then
|
||||
menu:addSeparator()
|
||||
|
||||
if creatureThing:asLocalPlayer() then
|
||||
if creatureThing:isLocalPlayer() then
|
||||
menu:addOption(tr('Set Outfit'), function() g_game.requestOutfit() end)
|
||||
|
||||
if creatureThing:isPartyMember() --[[and not fighting]] then
|
||||
@@ -310,7 +310,7 @@ function createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
||||
menu:addOption(tr('Stop Follow'), function() g_game.cancelFollow() end)
|
||||
end
|
||||
|
||||
if creatureThing:asPlayer() then
|
||||
if creatureThing:isPlayer() then
|
||||
menu:addSeparator()
|
||||
local creatureName = creatureThing:getName()
|
||||
menu:addOption(tr('Message to %s', creatureName), function() g_game.openPrivateChannel(creatureName) end)
|
||||
@@ -322,7 +322,7 @@ function createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
||||
menu:addOption(tr('Add to VIP list'), function() g_game.addVip(creatureName) end)
|
||||
end
|
||||
|
||||
local localPlayerShield = localPlayer:asCreature():getShield()
|
||||
local localPlayerShield = localPlayer:isCreature():getShield()
|
||||
local creatureShield = creatureThing:getShield()
|
||||
|
||||
if localPlayerShield == ShieldNone or localPlayerShield == ShieldWhiteBlue then
|
||||
@@ -394,8 +394,8 @@ function processMouseAction(menuPosition, mouseButton, autoWalkPos, lookThing, u
|
||||
else
|
||||
if multiUseThing and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton and not g_mouse.isPressed(MouseLeftButton) then
|
||||
local player = g_game.getLocalPlayer()
|
||||
if multiUseThing:asCreature() and multiUseThing:asCreature() ~= player then
|
||||
g_game.attack(multiUseThing:asCreature())
|
||||
if multiUseThing:isCreature() and multiUseThing:isCreature() ~= player then
|
||||
g_game.attack(multiUseThing:isCreature())
|
||||
return true
|
||||
elseif multiUseThing:isContainer() then
|
||||
if multiUseThing:getParentContainer() then
|
||||
|
@@ -38,7 +38,7 @@ function UIGameMap:onDrop(widget, mousePos)
|
||||
local thingPos = thing:getPosition()
|
||||
if thingPos.x == toPos.x and thingPos.y == toPos.y and thingPos.z == toPos.z then return false end
|
||||
|
||||
if thing:asItem() and thing:getCount() > 1 then
|
||||
if thing:isItem() and thing:getCount() > 1 then
|
||||
modules.game_interface.moveStackableItem(thing, toPos)
|
||||
else
|
||||
g_game.move(thing, toPos, 1)
|
||||
|
Reference in New Issue
Block a user