Update zig version to 0.11.0-dev.3655+a2f54fce5

This commit is contained in:
IntegratedQuantum 2023-06-17 11:04:01 +02:00
parent e2280c2b63
commit b0a358f63c
9 changed files with 18 additions and 18 deletions

View File

@ -98,9 +98,9 @@ pub const ChunkPosition = struct {
var dx = @fabs(@intToFloat(f64, self.wx) + halfWidth - playerPosition[0]);
var dy = @fabs(@intToFloat(f64, self.wy) + halfWidth - playerPosition[1]);
var dz = @fabs(@intToFloat(f64, self.wz) + halfWidth - playerPosition[2]);
dx = @max(0.0, dx - halfWidth); // TODO: #15644
dy = @max(0.0, dy - halfWidth); // TODO: #15644
dz = @max(0.0, dz - halfWidth); // TODO: #15644
dx = @max(0, dx - halfWidth);
dy = @max(0, dy - halfWidth);
dz = @max(0, dz - halfWidth);
return dx*dx + dy*dy + dz*dz;
}

View File

@ -631,7 +631,7 @@ pub const TextBuffer = struct {
}
pub fn mousePosToIndex(self: TextBuffer, mousePos: Vec2f, bufferLen: usize) u32 {
var line: usize = @floatToInt(usize, @max(0.0, mousePos[1]/16.0)); // TODO: #15644
var line: usize = @floatToInt(usize, @max(0, mousePos[1]/16.0));
line = @min(line, self.lineBreaks.items.len - 2);
var x: f32 = self.getLineOffset(line);
const start = self.lineBreaks.items[line].index;
@ -781,7 +781,7 @@ pub const TextBuffer = struct {
else y += 8;
draw.setColor(line.color | (@as(u32, 0xff000000) & draw.color));
for(lineWraps, 0..) |lineWrap, j| {
const lineStart = @max(0.0, line.start); // TODO: #15644
const lineStart = @max(0, line.start);
const lineEnd = @min(lineWrap, line.end);
if(lineStart < lineEnd) {
var start = Vec2f{lineStart + self.getLineOffset(j), y};
@ -848,7 +848,7 @@ pub const TextBuffer = struct {
else y += 8;
draw.setColor(shadowColor(line.color) | (@as(u32, 0xff000000) & draw.color));
for(lineWraps, 0..) |lineWrap, j| {
const lineStart = @max(0.0, line.start); // TODO: #15644
const lineStart = @max(0, line.start);
const lineEnd = @min(lineWrap, line.end);
if(lineStart < lineEnd) {
var start = Vec2f{lineStart + self.getLineOffset(j), y};
@ -1089,7 +1089,7 @@ pub const Shader = struct {
const self = try Shader.init(vertex, fragment);
inline for(@typeInfo(@TypeOf(ptrToUniformStruct.*)).Struct.fields) |field| {
if(field.type == c_int) {
@field(ptrToUniformStruct, field.name) = c.glGetUniformLocation(self.id, field.name[0..]);
@field(ptrToUniformStruct, field.name) = c.glGetUniformLocation(self.id, field.name[0..] ++ "\x00"); // TODO: #16072
}
}
return self;

View File

@ -364,7 +364,7 @@ pub fn updateWindowPosition(self: *GuiWindow) void {
switch(relPos) {
.ratio => |ratio| {
self.pos[i] = windowSize[i]*ratio - self.size[i]/2;
self.pos[i] = @max(self.pos[i], 0.0); // TODO: #15644
self.pos[i] = @max(self.pos[i], 0);
self.pos[i] = @min(self.pos[i], windowSize[i] - self.size[i]);
},
.attachedToFrame => |attachedToFrame| {

View File

@ -76,7 +76,7 @@ fn updateValueFromButtonPos(self: *ScrollBar) void {
pub fn scroll(self: *ScrollBar, offset: f32) void {
self.currentState += offset;
self.currentState = @min(1.0, @max(0.0, self.currentState)); // TODO: #15644
self.currentState = @min(1, @max(0, self.currentState));
}
pub fn updateHovered(self: *ScrollBar, mousePosition: Vec2f) void {
@ -106,7 +106,7 @@ pub fn render(self: *ScrollBar, mousePosition: Vec2f) !void {
self.setButtonPosFromValue();
if(self.button.pressed) {
self.button.pos[1] = mousePosition[1] - self.mouseAnchor;
self.button.pos[1] = @min(@max(self.button.pos[1], 0.0), range - 0.001); // TODO: #15644
self.button.pos[1] = @min(@max(self.button.pos[1], 0), range - 0.001);
self.updateValueFromButtonPos();
}
const oldTranslation = draw.setTranslation(self.pos);

View File

@ -352,7 +352,7 @@ pub const ItemDropManager = struct {
}
// Apply drag:
vel.* += acceleration;
vel.* *= @splat(3, @max(0.0, 1 - drag*deltaTime)); // TODO: #15644
vel.* *= @splat(3, @max(0, 1 - drag*deltaTime));
}
fn fixStuckInBlock(self: *ItemDropManager, chunk: *Chunk, pos: *Vec3d, vel: *Vec3d, deltaTime: f64) void {

View File

@ -34,7 +34,7 @@ const Material = struct {
self.density = json.get(f32, "density", 1.0);
self.resistance = json.get(f32, "resistance", 1.0);
self.power = json.get(f32, "power", 1.0);
self.roughness = @max(0.0, json.get(f32, "roughness", 1.0)); // TODO: #15644
self.roughness = @max(0, json.get(f32, "roughness", 1.0));
const colors = json.getChild("colors");
self.colorPalette = try allocator.alloc(Color, colors.JsonArray.items.len);
for(colors.JsonArray.items, self.colorPalette) |item, *color| {
@ -758,7 +758,7 @@ const ToolPhysics = struct {
}
}
// Smaller tools are faster to swing. To balance that smaller tools get a lower durability.
tool.maxDurability = @floatToInt(u32, @max(1.0, std.math.pow(f32, durability/4, 1.5))); // TODO: #15644
tool.maxDurability = @floatToInt(u32, @max(1, std.math.pow(f32, durability/4, 1.5)));
tool.durability = tool.maxDurability;
}

View File

@ -670,9 +670,9 @@ pub const Frustum = struct {
inline for(self.planes) |plane| {
var dist: f32 = vec.dot(pos - plane.pos, plane.norm);
// Find the most positive corner:
dist += @max(0.0, dim[0]*plane.norm[0]); // TODO: #15644
dist += @max(0.0, dim[1]*plane.norm[1]); // TODO: #15644
dist += @max(0.0, dim[2]*plane.norm[2]); // TODO: #15644
dist += @max(0, dim[0]*plane.norm[0]);
dist += @max(0, dim[1]*plane.norm[1]);
dist += @max(0, dim[2]*plane.norm[2]);
if(dist < 128) return false;
}
return true;

View File

@ -253,7 +253,7 @@ fn considerCoordinates(x: i32, y: i32, z: i32, map: *CaveMapFragment, seed: *u64
};
// At y = caveHeightWithMaxDensity blocks the chance is saturated, while at maxCaveHeight the chance gets 0:
if(random.nextFloat(seed) >= maxCaveDensity*@min(1.0, @floatCast(f32, (maxCaveHeight - startWorldPos[1])/(maxCaveHeight - caveHeightWithMaxDensity)))) return; // TODO: #15644
if(random.nextFloat(seed) >= maxCaveDensity*@min(1, @floatCast(f32, (maxCaveHeight - startWorldPos[1])/(maxCaveHeight - caveHeightWithMaxDensity)))) return;
var starters = 1 + random.nextIntBounded(u8, seed, 4);
while(starters != 0) : (starters -= 1) {

View File

@ -188,7 +188,7 @@ fn heightDependantTemperature(temperature: f32, height: f32) f32 {
// Therefor the total equation gets: `65K*2/80K/(1 - oceanThreshold)*(height - oceanThreshold)` = `1.625/(1 - oceanThreshold)*(height - oceanThreshold)`
// Furthermore I assume that the average temperature is at 1km of height.
return temperature - 1.625*(@max(0.0, height - oceanThreshold)/(1 - oceanThreshold) - 0.1); // TODO: #15644
return temperature - 1.625*(@max(0, height - oceanThreshold)/(1 - oceanThreshold) - 0.1);
}
fn findClimate(height: f32, humid: f32, temp: f32) Biome.Type {