Always use explicit direction

This commit is contained in:
IntegratedQuantum 2025-07-27 14:48:27 +02:00
parent be9069c8df
commit b882e81c73
6 changed files with 25 additions and 25 deletions

View File

@ -58,11 +58,11 @@ const GuiCommandQueue = struct { // MARK: GuiCommandQueue
}
fn scheduleCommand(command: Command) void {
commands.push(command);
commands.pushBack(command);
}
fn executeCommands() void {
while(commands.pop()) |command| {
while(commands.popFront()) |command| {
switch(command.action) {
.open => {
executeOpenWindowCommand(command.window);

View File

@ -121,7 +121,7 @@ pub fn deinit() void {
label.deinit();
}
history.deinit();
while(messageQueue.pop()) |msg| {
while(messageQueue.popFront()) |msg| {
main.globalAllocator.free(msg);
}
messageHistory.deinit();
@ -190,7 +190,7 @@ pub fn onClose() void {
while(history.popOrNull()) |label| {
label.deinit();
}
while(messageQueue.pop()) |msg| {
while(messageQueue.popFront()) |msg| {
main.globalAllocator.free(msg);
}
messageHistory.clear();
@ -206,7 +206,7 @@ pub fn onClose() void {
pub fn update() void {
if(!messageQueue.isEmpty()) {
const currentTime: i32 = @truncate(std.time.milliTimestamp());
while(messageQueue.pop()) |msg| {
while(messageQueue.popFront()) |msg| {
history.append(Label.init(.{0, 0}, 256, msg, .left));
main.globalAllocator.free(msg);
expirationTime.append(currentTime +% messageTimeout);
@ -243,7 +243,7 @@ pub fn render() void {
}
pub fn addMessage(msg: []const u8) void {
messageQueue.push(main.globalAllocator.dupe(u8, msg));
messageQueue.pushBack(main.globalAllocator.dupe(u8, msg));
}
pub fn sendMessage(_: usize) void {

View File

@ -237,7 +237,7 @@ pub const ItemDropManager = struct { // MARK: ItemDropManager
}
self.emptyMutex.unlock();
self.changeQueue.push(.{.add = .{i, drop}});
self.changeQueue.pushBack(.{.add = .{i, drop}});
}
fn addWithIndex(self: *ItemDropManager, i: u16, pos: Vec3d, vel: Vec3d, rot: Vec3f, itemStack: ItemStack, despawnTime: i32, pickupCooldown: i32) void {
@ -269,11 +269,11 @@ pub const ItemDropManager = struct { // MARK: ItemDropManager
}
self.emptyMutex.unlock();
self.changeQueue.push(.{.add = .{i, drop}});
self.changeQueue.pushBack(.{.add = .{i, drop}});
}
fn processChanges(self: *ItemDropManager) void {
while(self.changeQueue.pop()) |data| {
while(self.changeQueue.popFront()) |data| {
switch(data) {
.add => |addData| {
self.internalAdd(addData[0], addData[1]);
@ -506,7 +506,7 @@ pub const ClientItemDropManager = struct { // MARK: ClientItemDropManager
self.super.emptyMutex.lock();
self.super.isEmpty.set(i);
self.super.emptyMutex.unlock();
self.super.changeQueue.push(.{.remove = i});
self.super.changeQueue.pushBack(.{.remove = i});
}
pub fn loadFrom(self: *ClientItemDropManager, zon: ZonElement) void {

View File

@ -110,12 +110,12 @@ pub fn deinit() void {
}
updatableList.clearAndFree();
while(mapUpdatableList.pop()) |map| {
while(mapUpdatableList.popFront()) |map| {
map.deferredDeinit();
}
mapUpdatableList.deinit();
priorityMeshUpdateList.deinit();
while(blockUpdateList.pop()) |blockUpdate| {
while(blockUpdateList.popFront()) |blockUpdate| {
blockUpdate.deinitManaged(main.globalAllocator);
}
blockUpdateList.deinit();
@ -745,7 +745,7 @@ pub fn updateMeshes(targetTime: i64) void { // MARK: updateMeshes()=
mutex.lock();
defer mutex.unlock();
while(priorityMeshUpdateList.pop()) |pos| {
while(priorityMeshUpdateList.popFront()) |pos| {
const mesh = getMesh(pos) orelse continue;
if(!mesh.needsMeshUpdate) {
continue;
@ -756,7 +756,7 @@ pub fn updateMeshes(targetTime: i64) void { // MARK: updateMeshes()=
mesh.uploadData();
if(std.time.milliTimestamp() >= targetTime) break; // Update at least one mesh.
}
while(mapUpdatableList.pop()) |map| {
while(mapUpdatableList.popFront()) |map| {
if(!isMapInRenderDistance(map.pos)) {
map.deferredDeinit();
} else {
@ -814,7 +814,7 @@ fn batchUpdateBlocks() void {
defer regenerateMeshList.deinit();
// First of all process all the block updates:
while(blockUpdateList.pop()) |blockUpdate| {
while(blockUpdateList.popFront()) |blockUpdate| {
defer blockUpdate.deinitManaged(main.globalAllocator);
const pos = chunk.ChunkPosition{.wx = blockUpdate.x, .wy = blockUpdate.y, .wz = blockUpdate.z, .voxelSize = 1};
if(getMesh(pos)) |mesh| {
@ -839,7 +839,7 @@ pub fn addToUpdateList(mesh: *chunk_meshing.ChunkMesh) void {
mutex.lock();
defer mutex.unlock();
if(mesh.finishedMeshing) {
priorityMeshUpdateList.push(mesh.pos);
priorityMeshUpdateList.pushBack(mesh.pos);
mesh.needsMeshUpdate = true;
}
}
@ -910,7 +910,7 @@ pub const MeshGenerationTask = struct { // MARK: MeshGenerationTask
// MARK: updaters
pub fn updateBlock(update: BlockUpdate) void {
blockUpdateList.push(BlockUpdate.initManaged(main.globalAllocator, update));
blockUpdateList.pushBack(BlockUpdate.initManaged(main.globalAllocator, update));
}
pub fn updateChunkMesh(mesh: *chunk.Chunk) void {
@ -918,7 +918,7 @@ pub fn updateChunkMesh(mesh: *chunk.Chunk) void {
}
pub fn updateLightMap(map: *LightMap.LightMapFragment) void {
mapUpdatableList.push(map);
mapUpdatableList.pushBack(map);
}
// MARK: Block breaking animation

View File

@ -336,7 +336,7 @@ fn init(name: []const u8, singlePlayerPort: ?u16) void { // MARK: init()
fn deinit() void {
users.clearAndFree();
while(userDeinitList.pop()) |user| {
while(userDeinitList.popFront()) |user| {
user.deinit();
}
userDeinitList.deinit();
@ -390,7 +390,7 @@ fn getInitialEntityList(allocator: main.heap.NeverFailingAllocator) []const u8 {
fn update() void { // MARK: update()
world.?.update();
while(userConnectList.pop()) |user| {
while(userConnectList.popFront()) |user| {
connectInternal(user);
}
@ -429,7 +429,7 @@ fn update() void { // MARK: update()
}
}
while(userDeinitList.pop()) |user| {
while(userDeinitList.popFront()) |user| {
user.decreaseRefCount();
}
}
@ -462,7 +462,7 @@ pub fn stop() void {
pub fn disconnect(user: *User) void { // MARK: disconnect()
if(!user.connected.load(.unordered)) return;
removePlayer(user);
userDeinitList.push(user);
userDeinitList.pushBack(user);
user.connected.store(false, .unordered);
}
@ -497,7 +497,7 @@ pub fn removePlayer(user: *User) void { // MARK: removePlayer()
}
pub fn connect(user: *User) void {
userConnectList.push(user);
userConnectList.pushBack(user);
}
pub fn connectInternal(user: *User) void {

View File

@ -596,13 +596,13 @@ pub fn ConcurrentQueue(comptime T: type) type { // MARK: ConcurrentQueue
self.super.deinit();
}
pub fn push(self: *Self, elem: T) void {
pub fn pushBack(self: *Self, elem: T) void {
self.mutex.lock();
defer self.mutex.unlock();
self.super.pushBack(elem);
}
pub fn pop(self: *Self) ?T {
pub fn popFront(self: *Self) ?T {
self.mutex.lock();
defer self.mutex.unlock();
return self.super.popFront();