Skip to content

Commit

Permalink
fix room password
Browse files Browse the repository at this point in the history
  • Loading branch information
dankmeme01 committed Jun 28, 2024
1 parent 95191e2 commit f8bf04c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## v1.4.3

* Fix crash on ARM MacOS when a player with an animated name is online
* Fix rare crash with devtools
* Add error message when entering wrong room password
* Minor UI changes

## v1.4.2

Expand Down
18 changes: 17 additions & 1 deletion src/net/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,24 @@ class PacketListenerPool : public CCObject {
bool invoked = false;
auto& lsm = listeners[id];

// reorder them based on priority
std::sort(lsm.begin(), lsm.end(), [](auto& l1, auto& l2) -> bool {
auto r1 = l1.lock();
auto r2 = l2.lock();

if (!r1) return false;
if (!r2) return true;

return r1->priority < r2->priority;
});

for (auto& listener : lsm) {
if (auto l = listener.lock()) {
l->invokeCallback(packet);

if (l->isFinal) {
break;
}
}
}
}
Expand Down Expand Up @@ -581,7 +596,8 @@ class NetworkManager::Impl {
if (packet->wasInvalid) reason = "Room doesn't exist";
if (packet->wasProtected) reason = "Room password is wrong";
if (packet->wasFull) reason = "Room is full";
if (!packet->wasProtected) ErrorQueues::get().error(fmt::format("Failed to join room: {}", reason)); //TEMPORARY disable wrong password alerts

ErrorQueues::get().error(fmt::format("Failed to join room: {}", reason));
});

// Admin packets
Expand Down
2 changes: 1 addition & 1 deletion src/ui/menu/room/room_join_popup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ bool RoomJoinPopup::setup() {
this->onClose(nullptr);
});
}
});
}, -123456789, true);

nm.addListener<RoomJoinedPacket>(this, [this](std::shared_ptr<RoomJoinedPacket> packet) {
this->onClose(nullptr);
Expand Down

0 comments on commit f8bf04c

Please sign in to comment.