mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
Fix server-side formspec state keeping issue (#13332)
This commit is contained in:
parent
6fe9bc8ae1
commit
5fa63a0b0c
@ -1539,10 +1539,13 @@ void Server::SendShowFormspecMessage(session_t peer_id, const std::string &forms
|
|||||||
{
|
{
|
||||||
NetworkPacket pkt(TOCLIENT_SHOW_FORMSPEC, 0, peer_id);
|
NetworkPacket pkt(TOCLIENT_SHOW_FORMSPEC, 0, peer_id);
|
||||||
if (formspec.empty()){
|
if (formspec.empty()){
|
||||||
//the client should close the formspec
|
// The client should close the formspec
|
||||||
//but make sure there wasn't another one open in meantime
|
// But make sure there wasn't another one open in meantime
|
||||||
|
// If the formname is empty, any open formspec will be closed so the
|
||||||
|
// form name should always be erased from the state.
|
||||||
const auto it = m_formspec_state_data.find(peer_id);
|
const auto it = m_formspec_state_data.find(peer_id);
|
||||||
if (it != m_formspec_state_data.end() && it->second == formname) {
|
if (it != m_formspec_state_data.end() &&
|
||||||
|
(it->second == formname || formname.empty())) {
|
||||||
m_formspec_state_data.erase(peer_id);
|
m_formspec_state_data.erase(peer_id);
|
||||||
}
|
}
|
||||||
pkt.putLongString("");
|
pkt.putLongString("");
|
||||||
|
Loading…
Reference in New Issue
Block a user