From eccb323501a88461a1e777bf52dfab4d9c79f373 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 23 Aug 2025 16:57:38 +0200 Subject: [PATCH] initialized some variables to silence warnings --- arbitrile.cpp | 2 +- bigstuff.cpp | 2 +- complex.cpp | 2 +- rogueviz/ads/map.cpp | 2 +- rogueviz/dhrg/gridmapping.cpp | 2 +- rogueviz/dhrg/mycell.cpp | 2 +- rogueviz/dpgen.cpp | 4 ++-- rogueviz/flocking.cpp | 2 +- rogueviz/sag/annealing.cpp | 2 +- rogueviz/som/voronoi.cpp | 2 +- rogueviz/sunflower.cpp | 2 +- sky.cpp | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arbitrile.cpp b/arbitrile.cpp index 0352ba9c..6e46336e 100644 --- a/arbitrile.cpp +++ b/arbitrile.cpp @@ -912,7 +912,7 @@ EX void add_connection(arbi_tiling& c, int ai, int as, int bi, int bs, int m) { auto& ash = c.shapes[ai]; auto& bsh = c.shapes[bi]; add_connection_sub(c, ai, as, bi, bs, m); - int as1, bs1; + int as1 = 0, bs1 = 0; /* set to 0 to silence warning */ if(ash.symmetric_value) { as1 = ash.reflect(as); add_connection_sub(c, ai, as1, bi, bs, !m); diff --git a/bigstuff.cpp b/bigstuff.cpp index 6b73ab1a..88dd299b 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -542,7 +542,7 @@ EX void generateTreasureIsland(cell *c) { if(c->wall == waCTree) return; } vector ctab; - int qlo, qhi; + int qlo = 0, qhi = 0; /* set to 0 to silence warning */ for(int i=0; itype; i++) { cell *c2 = createMov(c, i); if(!eubinary) currentmap->extend_altmap(c2->master); diff --git a/complex.cpp b/complex.cpp index 931b4607..3aca2509 100644 --- a/complex.cpp +++ b/complex.cpp @@ -945,7 +945,7 @@ EX namespace clearing { int steps = 0; - int ds; + int ds = 0; /* set to 0 to silence warning */ int stepcount = 0; while(true) { diff --git a/rogueviz/ads/map.cpp b/rogueviz/ads/map.cpp index 6dbcddca..ddc99cb2 100644 --- a/rogueviz/ads/map.cpp +++ b/rogueviz/ads/map.cpp @@ -30,7 +30,7 @@ void compute_life(cell *c, transmatrix S1, const worldline_visitor& wv) { auto last_w = cur_w; auto next_w = cur_w; transmatrix next_S1; - ld next_t; + ld next_t = 0; /* set to 0 to silence warning */ ld last_time = t; cell *next_c = nullptr; binsearch(t, t+90._deg, [&] (ld t1) { diff --git a/rogueviz/dhrg/gridmapping.cpp b/rogueviz/dhrg/gridmapping.cpp index 70229c83..8787e6fe 100644 --- a/rogueviz/dhrg/gridmapping.cpp +++ b/rogueviz/dhrg/gridmapping.cpp @@ -46,7 +46,7 @@ void do_analyze_grid(int maxv) { println(hlog, "log(gamma) = ", log(cgi.expansion->get_growth())); - ld lE, dif, lwE; + ld lE = 0, dif = 0, lwE; for(int d=0; d<32; d++) if(stats[d][0]) { int q = stats[d][0]; if(q != cgi.expansion->get_descendants(d).approx_int()) continue; diff --git a/rogueviz/dhrg/mycell.cpp b/rogueviz/dhrg/mycell.cpp index 4438276f..33cd5992 100644 --- a/rogueviz/dhrg/mycell.cpp +++ b/rogueviz/dhrg/mycell.cpp @@ -124,7 +124,7 @@ void generate_root() { mroot->leftsibling = mroot->rightsibling = mroot; mroot->leftparent = mroot->rightparent = NULL; - mycell *child; + mycell *child = nullptr; /* silence warning */ bool first = true; for(int c: cgi.expansion->children[origtype]) { if(first) { diff --git a/rogueviz/dpgen.cpp b/rogueviz/dpgen.cpp index 64c196df..4a0eb671 100644 --- a/rogueviz/dpgen.cpp +++ b/rogueviz/dpgen.cpp @@ -116,7 +116,7 @@ void launch(int seed, int elimit, int hlimit) { pair worst; if(1) { - int wdist = -1, wdcount; + int wdist = -1, wdcount = 0; /* set to silence warning */ for(cell* x0: cl0) for(cell *x1: cl1) { int x = 9999; for(int d=0; d<4; d++) @@ -133,7 +133,7 @@ void launch(int seed, int elimit, int hlimit) { while(true) { int wdist = -1, wdcount = 0; - cell *worst_block; + cell *worst_block = nullptr; /* set to silence warning */ for(cell *c: clboth) if(c->wall == waNone && c != c0 && c != c1) { c->wall = waSea; solve(start); diff --git a/rogueviz/flocking.cpp b/rogueviz/flocking.cpp index 7436bf51..128266a1 100644 --- a/rogueviz/flocking.cpp +++ b/rogueviz/flocking.cpp @@ -508,7 +508,7 @@ bool drawVertex(const shiftmatrix &V, cell *c, shmup::monster *m) { } } - ld angle; + ld angle = 0; if(swarm) angle = hrand(1000); printf("setting up...\n"); diff --git a/rogueviz/sag/annealing.cpp b/rogueviz/sag/annealing.cpp index 82fb8c08..92bfeb2d 100644 --- a/rogueviz/sag/annealing.cpp +++ b/rogueviz/sag/annealing.cpp @@ -175,7 +175,7 @@ void dofullsa_iterations(long long saiter) { // println(hlog, "before dofullsa_iterations, cost = ", double(sag::cost), " iterations = ", fts(saiter)); - ld last_ratio; + ld last_ratio = 0; int lpct = 0; diff --git a/rogueviz/som/voronoi.cpp b/rogueviz/som/voronoi.cpp index a935549f..50798bc3 100644 --- a/rogueviz/som/voronoi.cpp +++ b/rogueviz/som/voronoi.cpp @@ -125,7 +125,7 @@ vector > compute_voronoi_edges(manifold& m) { /* project all the net[ni].net on the manifold */ for(int ni=0; ni triangles_to_visit; diff --git a/rogueviz/sunflower.cpp b/rogueviz/sunflower.cpp index 823ed862..381d0d95 100644 --- a/rogueviz/sunflower.cpp +++ b/rogueviz/sunflower.cpp @@ -70,7 +70,7 @@ bool overlay = false; bool sunflower_cell(cell *c, shiftmatrix V) { density = zdensity / 100; - ld qd; + ld qd = 1; if(sphere) { if(infer == 'r') diff --git a/sky.cpp b/sky.cpp index 7ab1a860..e78a2de0 100644 --- a/sky.cpp +++ b/sky.cpp @@ -261,7 +261,7 @@ void compute_skyvertices(const vector& sky) { int k = isize(vertices); - color_t ccolor; + color_t ccolor = 0; for(int i=0; i