close channel event
This commit is contained in:
parent
9c88c525fb
commit
c93732a44a
|
@ -111,6 +111,16 @@ local function onOpenPrivateChannel(receiver)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function onCloseChannel(channelId)
|
||||||
|
local channel = channels[channelId]
|
||||||
|
if channel then
|
||||||
|
local tab = Console.getTab(channel)
|
||||||
|
if tab then
|
||||||
|
consoleTabBar:removeTab(tab)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function doChannelListSubmit()
|
local function doChannelListSubmit()
|
||||||
local channelListPanel = channelsWindow:getChildById('channelList')
|
local channelListPanel = channelsWindow:getChildById('channelList')
|
||||||
local openPrivateChannelWith = channelsWindow:getChildById('openPrivateChannelWith'):getText()
|
local openPrivateChannelWith = channelsWindow:getChildById('openPrivateChannelWith'):getText()
|
||||||
|
@ -156,6 +166,7 @@ function Console.init()
|
||||||
onChannelList = onChannelList,
|
onChannelList = onChannelList,
|
||||||
onOpenChannel = onOpenChannel,
|
onOpenChannel = onOpenChannel,
|
||||||
onOpenPrivateChannel = onOpenPrivateChannel,
|
onOpenPrivateChannel = onOpenPrivateChannel,
|
||||||
|
onCloseChannel = onCloseChannel,
|
||||||
onGameEnd = Console.clear })
|
onGameEnd = Console.clear })
|
||||||
|
|
||||||
consolePanel = displayUI('console.otui', GameInterface.getBottomPanel())
|
consolePanel = displayUI('console.otui', GameInterface.getBottomPanel())
|
||||||
|
@ -189,6 +200,7 @@ function Console.terminate()
|
||||||
onChannelList = onChannelList,
|
onChannelList = onChannelList,
|
||||||
onOpenChannel = onOpenChannel,
|
onOpenChannel = onOpenChannel,
|
||||||
onOpenPrivateChannel = onOpenPrivateChannel,
|
onOpenPrivateChannel = onOpenPrivateChannel,
|
||||||
|
onCloseChannel = onCloseChannel,
|
||||||
onGameEnd = Console.clear })
|
onGameEnd = Console.clear })
|
||||||
|
|
||||||
for channelid, channelname in pairs(channels) do
|
for channelid, channelname in pairs(channels) do
|
||||||
|
|
|
@ -291,9 +291,13 @@ void Map::setCentralPosition(const Position& centralPosition)
|
||||||
} else {
|
} else {
|
||||||
for(const auto& pair : m_knownCreatures) {
|
for(const auto& pair : m_knownCreatures) {
|
||||||
const CreaturePtr& creature = pair.second;
|
const CreaturePtr& creature = pair.second;
|
||||||
if(!isAwareOfPosition(creature->getPosition())) {
|
if(creature) {
|
||||||
removeThing(creature);
|
if(!isAwareOfPosition(creature->getPosition())) {
|
||||||
|
removeThing(creature);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
logTraceError("invalid creature");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue