mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-08 11:44:21 -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 {
|
pub fn deinit() void {
|
||||||
|
reset();
|
||||||
|
commands.deinit();
|
||||||
|
freeIdList.deinit();
|
||||||
|
serverToClientMap.deinit();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn reset() void {
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
while(commands.dequeue()) |cmd| {
|
while(commands.dequeue()) |cmd| {
|
||||||
var reader = utils.BinaryReader.init(&.{});
|
var reader = utils.BinaryReader.init(&.{});
|
||||||
@ -44,10 +51,7 @@ pub const Sync = struct { // MARK: Sync
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
commands.deinit();
|
|
||||||
std.debug.assert(freeIdList.items.len == maxId); // leak
|
std.debug.assert(freeIdList.items.len == maxId); // leak
|
||||||
freeIdList.deinit();
|
|
||||||
serverToClientMap.deinit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn executeCommand(payload: Command.Payload) void {
|
pub fn executeCommand(payload: Command.Payload) void {
|
||||||
|
@ -686,6 +686,7 @@ pub const World = struct { // MARK: World
|
|||||||
main.gui.deinit();
|
main.gui.deinit();
|
||||||
main.gui.init();
|
main.gui.init();
|
||||||
Player.inventory.deinit(main.globalAllocator);
|
Player.inventory.deinit(main.globalAllocator);
|
||||||
|
main.items.Inventory.Sync.ClientSide.reset();
|
||||||
|
|
||||||
main.threadPool.clear();
|
main.threadPool.clear();
|
||||||
self.itemDrops.deinit();
|
self.itemDrops.deinit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user