From 45e13ea02a191668457f87b33bffd33c371d5fba Mon Sep 17 00:00:00 2001 From: Pierre Curto Date: Thu, 18 Jan 2024 14:31:42 +0100 Subject: [PATCH] datatypes,examples: fix typos, and silence notice in the quadtree example (#20577) --- examples/quadtree_demo/quadtree_demo.v | 2 +- vlib/datatypes/quadtree.v | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/quadtree_demo/quadtree_demo.v b/examples/quadtree_demo/quadtree_demo.v index 0dd024d334..9a1e40ab11 100644 --- a/examples/quadtree_demo/quadtree_demo.v +++ b/examples/quadtree_demo/quadtree_demo.v @@ -112,7 +112,7 @@ fn (mut app App) find_particles() { fn main() { mut app := &App{ - gg: 0 + gg: unsafe { nil } } app.gg = gg.new_context( bg_color: gx.white diff --git a/vlib/datatypes/quadtree.v b/vlib/datatypes/quadtree.v index 3d4587878f..75c8bbc8c9 100644 --- a/vlib/datatypes/quadtree.v +++ b/vlib/datatypes/quadtree.v @@ -35,7 +35,7 @@ pub fn (mut q Quadtree) create(x f64, y f64, width f64, height f64, capacity int } } -// insert recursevely adds a particle in the correct index of the tree. +// insert recursively adds a particle in the correct index of the tree. pub fn (mut q Quadtree) insert(p AABB) { mut indexes := []int{} @@ -64,7 +64,7 @@ pub fn (mut q Quadtree) insert(p AABB) { } } -// retrieve recursevely checks if a particle is in a specific index of the tree. +// retrieve recursively checks if a particle is in a specific index of the tree. pub fn (mut q Quadtree) retrieve(p AABB) []AABB { mut indexes := q.get_index(p) mut detected_particles := q.particles.clone() @@ -77,7 +77,7 @@ pub fn (mut q Quadtree) retrieve(p AABB) []AABB { return detected_particles } -// clear flushes out nodes and partcles from the tree. +// clear flushes out nodes and particles from the tree. pub fn (mut q Quadtree) clear() { q.particles = [] for j in 0 .. q.nodes.len { @@ -88,7 +88,7 @@ pub fn (mut q Quadtree) clear() { q.nodes = [] } -// get_nodes recursevely returns the subdivisions the tree has. +// get_nodes recursively returns the subdivisions the tree has. pub fn (q Quadtree) get_nodes() []Quadtree { mut nodes := []Quadtree{} if q.nodes.len > 0 {