Skip to content

Commit 547d8aa

Browse files
Disable some features in tagged releases
fixes #1842
1 parent 5ae048a commit 547d8aa

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

build.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ pub fn build(b: *std.Build) !void {
156156
const isRelease = b.option(bool, "release", "Removes the -dev flag from the version") orelse false;
157157
const version = b.fmt("0.0.0{s}", .{if(isRelease) "" else "-dev"});
158158
options.addOption([]const u8, "version", version);
159+
options.addOption(bool, "isTaggedRelease", isRelease);
159160

160161
const useLocalDeps = b.option(bool, "local", "Use local cubyz_deps") orelse false;
161162

src/gui/windows/save_creation.zig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const std = @import("std");
22

3+
const build_options = @import("build_options");
4+
35
const main = @import("main");
46
const ConnectionManager = main.network.ConnectionManager;
57
const settings = main.settings;
@@ -161,7 +163,9 @@ pub fn onOpen() void {
161163

162164
list.add(CheckBox.init(.{0, 0}, 128, "Allow Cheats", true, &allowCheatsCallback));
163165

164-
list.add(CheckBox.init(.{0, 0}, 128, "Testing mode (for developers)", false, &testingModeCallback));
166+
if(!build_options.isTaggedRelease) {
167+
list.add(CheckBox.init(.{0, 0}, 128, "Testing mode (for developers)", false, &testingModeCallback));
168+
}
165169

166170
list.add(Button.initText(.{0, 0}, 128, "Create World", .{.callback = &createWorld}));
167171

src/server/terrain/climategen/NoiseBasedVoronoi.zig

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const std = @import("std");
22

3+
const build_options = @import("build_options");
4+
35
const main = @import("main");
46
const Array2D = main.utils.Array2D;
57
const random = main.random;
@@ -34,18 +36,20 @@ pub fn generateMapFragment(map: *ClimateMapFragment, worldSeed: u64) void {
3436
generator.toMap(map, ClimateMapFragment.mapSize, ClimateMapFragment.mapSize, worldSeed);
3537

3638
// TODO: Remove debug image:
37-
const image = main.graphics.Image.init(main.stackAllocator, @intCast(map.map.len), @intCast(map.map[0].len));
38-
defer image.deinit(main.stackAllocator);
39-
var x: u31 = 0;
40-
while(x < map.map.len) : (x += 1) {
41-
var y: u31 = 0;
42-
while(y < map.map[0].len) : (y += 1) {
43-
const bp = map.map[x][y];
44-
seed = std.hash.Adler32.hash(bp.biome.id) ^ 4371741;
45-
image.setRGB(x, y, @bitCast(0xff000000 | main.random.nextInt(u32, &seed)));
39+
if(!build_options.isTaggedRelease) {
40+
const image = main.graphics.Image.init(main.stackAllocator, @intCast(map.map.len), @intCast(map.map[0].len));
41+
defer image.deinit(main.stackAllocator);
42+
var x: u31 = 0;
43+
while(x < map.map.len) : (x += 1) {
44+
var y: u31 = 0;
45+
while(y < map.map[0].len) : (y += 1) {
46+
const bp = map.map[x][y];
47+
seed = std.hash.Adler32.hash(bp.biome.id) ^ 4371741;
48+
image.setRGB(x, y, @bitCast(0xff000000 | main.random.nextInt(u32, &seed)));
49+
}
4650
}
51+
image.exportToFile("test.png") catch {};
4752
}
48-
image.exportToFile("test.png") catch {};
4953
}
5054

5155
const BiomePoint = struct {

0 commit comments

Comments
 (0)