mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 03:06:55 -04:00
Reset the client-side inventory sync after leaving a world.
should fix #1461
This commit is contained in:
parent
6596835cf3
commit
f5fd3356d9
@ -36,6 +36,13 @@ pub const Sync = struct { // MARK: Sync
|
||||
}
|
||||
|
||||
pub fn deinit() void {
|
||||
reset();
|
||||
commands.deinit();
|
||||
freeIdList.deinit();
|
||||
serverToClientMap.deinit();
|
||||
}
|
||||
|
||||
pub fn reset() void {
|
||||
mutex.lock();
|
||||
while(commands.dequeue()) |cmd| {
|
||||
var reader = utils.BinaryReader.init(&.{});
|
||||
@ -44,10 +51,7 @@ pub const Sync = struct { // MARK: Sync
|
||||
};
|
||||
}
|
||||
mutex.unlock();
|
||||
commands.deinit();
|
||||
std.debug.assert(freeIdList.items.len == maxId); // leak
|
||||
freeIdList.deinit();
|
||||
serverToClientMap.deinit();
|
||||
}
|
||||
|
||||
pub fn executeCommand(payload: Command.Payload) void {
|
||||
|
@ -686,6 +686,7 @@ pub const World = struct { // MARK: World
|
||||
main.gui.deinit();
|
||||
main.gui.init();
|
||||
Player.inventory.deinit(main.globalAllocator);
|
||||
main.items.Inventory.Sync.ClientSide.reset();
|
||||
|
||||
main.threadPool.clear();
|
||||
self.itemDrops.deinit();
|
||||
|
Loading…
x
Reference in New Issue
Block a user