Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/assets.zig
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,6 @@ fn registerBiome(numericId: u32, stringId: []const u8, zon: ZonElement) void {
biomes_zig.register(stringId, numericId, zon);
}

fn registerRecipesFromZon(zon: ZonElement) void {
items_zig.registerRecipes(zon);
}

pub const Palette = struct { // MARK: Palette
palette: main.List([]const u8),

Expand Down Expand Up @@ -595,7 +591,7 @@ pub fn loadWorldAssets(assetFolder: []const u8, blockPalette: *Palette, itemPale

iterator = worldAssets.recipes.iterator();
while(iterator.next()) |entry| {
registerRecipesFromZon(entry.value_ptr.*);
items_zig.registerRecipes(entry.value_ptr.*);
}

try sbb.registerBlueprints(&worldAssets.blueprints);
Expand Down
2 changes: 1 addition & 1 deletion src/block_entity.zig
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ pub const BlockEntityTypes = struct {
texture.deinit();
}
textureDeinitList.deinit();
pipeline.deinit();
if(!main.settings.launchConfig.headlessServer) pipeline.deinit();
StorageServer.deinit();
StorageClient.deinit();
}
Expand Down
1 change: 0 additions & 1 deletion src/game.zig
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,6 @@ pub const World = struct { // MARK: World
main.gui.deinit();
main.gui.init();
Player.inventory.deinit(main.globalAllocator);
main.items.clearRecipeCachedInventories();
main.items.Inventory.Sync.ClientSide.reset();

main.threadPool.clear();
Expand Down
3 changes: 2 additions & 1 deletion src/items.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ pub fn registerRecipes(zon: ZonElement) void {
}
}

pub fn clearRecipeCachedInventories() void {
fn clearRecipeCachedInventories() void {
for(recipeList.items) |recipe| {
main.globalAllocator.free(recipe.sourceItems);
main.globalAllocator.free(recipe.sourceAmounts);
Expand All @@ -1271,6 +1271,7 @@ pub fn reset() void {
toolTypeList = .{};
toolTypeIdToIndex = .{};
reverseIndices = .{};
clearRecipeCachedInventories();
recipeList.clearAndFree();
itemListSize = 0;
}
Expand Down
6 changes: 3 additions & 3 deletions src/models.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const FaceData = main.renderer.chunk_meshing.FaceData;
const NeverFailingAllocator = main.heap.NeverFailingAllocator;
const Box = main.game.collision.Box;

var quadSSBO: graphics.SSBO = undefined;
var quadSSBO: ?graphics.SSBO = undefined;

pub const QuadInfo = extern struct {
normal: [3]f32 align(16),
Expand Down Expand Up @@ -807,7 +807,7 @@ pub fn reset() void {
}

pub fn deinit() void {
quadSSBO.deinit();
if(quadSSBO) |ssbo| ssbo.deinit();
nameToIndex.deinit();
for(models.items()) |model| {
model.deinit();
Expand All @@ -820,5 +820,5 @@ pub fn deinit() void {

pub fn uploadModels() void {
quadSSBO = graphics.SSBO.initStatic(QuadInfo, quads.items);
quadSSBO.bind(4);
quadSSBO.?.bind(4);
}
2 changes: 0 additions & 2 deletions src/server/server.zig
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,6 @@ fn update() void { // MARK: update()
}

pub fn start(name: []const u8, port: ?u16) void {
main.initThreadLocals();
defer main.deinitThreadLocals();
std.debug.assert(!running.load(.monotonic)); // There can only be one server.
init(name, port);
defer deinit();
Expand Down
1 change: 1 addition & 0 deletions src/server/world.zig
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ pub const ServerWorld = struct { // MARK: ServerWorld
self.toolPalette.deinit();
self.biomePalette.deinit();
self.wio.deinit();
main.assets.unloadAssets();
main.globalAllocator.free(self.path);
main.globalAllocator.free(self.name);
main.globalAllocator.destroy(self);
Expand Down