Fixes for last commits
This commit is contained in:
parent
7a08fed689
commit
f47a947bf3
|
@ -108,7 +108,7 @@ function GameInterface.terminate()
|
|||
end
|
||||
|
||||
function GameInterface.show()
|
||||
g_app.onClose = GameInterface.tryExit
|
||||
connect(g_app, { onClose = GameInterface.tryExit })
|
||||
logoutButton:show()
|
||||
Background.hide()
|
||||
gameRootPanel:show()
|
||||
|
@ -117,6 +117,7 @@ function GameInterface.show()
|
|||
end
|
||||
|
||||
function GameInterface.hide()
|
||||
disconnect(g_app, { onClose = GameInterface.tryExit })
|
||||
if logoutWindow then
|
||||
logoutWindow:destroy()
|
||||
logoutWindow = nil
|
||||
|
@ -132,7 +133,6 @@ function GameInterface.hide()
|
|||
gameRootPanel:hide()
|
||||
logoutButton:hide()
|
||||
Background.show()
|
||||
g_app.onClose = nil
|
||||
end
|
||||
|
||||
function GameInterface.exit()
|
||||
|
@ -154,7 +154,6 @@ function GameInterface.tryExit()
|
|||
|
||||
local exitFunc = function()
|
||||
GameInterface.exit()
|
||||
exitButton:getParent():destroy()
|
||||
end
|
||||
local logoutFunc = function()
|
||||
GameInterface.logout()
|
||||
|
|
|
@ -1,30 +1,15 @@
|
|||
PlayerMount = {}
|
||||
|
||||
-- private variables
|
||||
|
||||
-- private functions
|
||||
|
||||
-- public functions
|
||||
function PlayerMount.init()
|
||||
g_ui.importStyle('playermount.otui')
|
||||
|
||||
connect(g_game, { onDeath = PlayerMount.dismount,
|
||||
onGameEnd = PlayerMount.dismount })
|
||||
|
||||
g_keyboard.bindKeyDown('Ctrl+R', PlayerMount.toggleMount, gameRootPanel)
|
||||
end
|
||||
|
||||
function PlayerMount.terminate()
|
||||
disconnect(g_game, { onDeath = PlayerMount.dismount,
|
||||
onGameEnd = PlayerMount.dismount })
|
||||
|
||||
g_keyboard.unbindKeyDown('Ctrl+R', PlayerMount.toggleMount, gameRootPanel)
|
||||
PlayerMount.reset()
|
||||
g_keyboard.unbindKeyDown('Ctrl+R', gameRootPanel)
|
||||
|
||||
PlayerMount = nil
|
||||
end
|
||||
|
||||
-- hooked events
|
||||
function PlayerMount.toggleMount()
|
||||
if g_game.isMounted() then
|
||||
g_game.mount(false)
|
||||
|
|
|
@ -2,10 +2,7 @@ Module
|
|||
name: game_playermount
|
||||
description: Manage player mounts
|
||||
author: BeniS
|
||||
website: www.otclient.info
|
||||
|
||||
dependencies:
|
||||
- client_entergame
|
||||
website: www.otclient.infox
|
||||
|
||||
@onLoad: |
|
||||
dofile 'playermount'
|
||||
|
|
|
@ -489,10 +489,11 @@ void Map::saveOtcm(const std::string& fileName)
|
|||
const auto& list = tile->getThings();
|
||||
auto first = std::find_if(list.begin(), list.end(), [](const ThingPtr& thing) { return thing->isItem(); });
|
||||
for(auto it = first, end = list.end(); it != end; ++it) {
|
||||
ItemPtr item = (*it)->asItem();
|
||||
if(ItemPtr item = (*it)->asItem()) {
|
||||
fin->addU16(item->getId());
|
||||
fin->addU8(item->getCountOrSubType());
|
||||
}
|
||||
}
|
||||
|
||||
// end of tile
|
||||
fin->addU16(0xFFFF);
|
||||
|
|
|
@ -512,7 +512,13 @@ void ProtocolGame::parseCreatureMove(const InputMessagePtr& msg)
|
|||
if(!g_map.removeThing(thing))
|
||||
g_logger.traceError("could not remove thing");
|
||||
|
||||
g_map.addThing(thing, newPos, -1);
|
||||
int stackPos = -2;
|
||||
|
||||
// older protocols stores creatures in reverse order
|
||||
if(!g_game.getFeature(Otc::GameReverseCreatureStack))
|
||||
stackPos = -1;
|
||||
|
||||
g_map.addThing(thing, newPos, stackPos);
|
||||
}
|
||||
|
||||
void ProtocolGame::parseOpenContainer(const InputMessagePtr& msg)
|
||||
|
|
|
@ -171,16 +171,10 @@ ThingPtr Tile::addThing(const ThingPtr& thing, int stackPos)
|
|||
// 4 - creatures, from top to bottom
|
||||
// 5 - items, from top to bottom
|
||||
if(stackPos < 0) {
|
||||
stackPos = 0;
|
||||
int priority = thing->getStackPriority();
|
||||
bool prepend = (stackPos == -2 || priority <= 3);
|
||||
for(stackPos = 0; stackPos < (int)m_things.size(); ++stackPos) {
|
||||
int otherPriority = m_things[stackPos]->getStackPriority();
|
||||
if(!g_game.getFeature(Otc::GameReverseCreatureStack)) {
|
||||
// older protocols stores creatures in reverse order
|
||||
if(priority == 4 && otherPriority == 4)
|
||||
break;
|
||||
}
|
||||
if((prepend && otherPriority > priority) || (!prepend && otherPriority >= priority))
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
void addWalkingCreature(const CreaturePtr& creature);
|
||||
void removeWalkingCreature(const CreaturePtr& creature);
|
||||
|
||||
ThingPtr addThing(const ThingPtr& thing, int stackPos = -1);
|
||||
ThingPtr addThing(const ThingPtr& thing, int stackPos);
|
||||
bool removeThing(ThingPtr thing);
|
||||
ThingPtr getThing(int stackPos);
|
||||
EffectPtr getEffect(uint16 id);
|
||||
|
|
Loading…
Reference in New Issue