From 6e26508a770d55b702b94729ad2234a9c561d395 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 4 May 2019 18:28:03 +0200 Subject: [PATCH] replaced some instances of double to ld, so that everything compiles when ld is redefined to float --- debug.cpp | 2 +- graph.cpp | 8 ++++---- hyper.h | 4 ++-- hyperpoint.cpp | 4 ++-- polygons.cpp | 4 ++-- rug.cpp | 2 +- shmup.cpp | 4 ++-- util.cpp | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/debug.cpp b/debug.cpp index c4b26b0a..5c806e95 100644 --- a/debug.cpp +++ b/debug.cpp @@ -353,7 +353,7 @@ struct debugScreen { dialog::addSelItem("land param (hex)", itsh8(what->landparam), 0); dialog::addSelItem("land param (heat)", fts(HEAT(what)), 't'); dialog::add_action([what] () { - static double d = HEAT(what); + static ld d = HEAT(what); dialog::editNumber(d, -2, 2, 0.1, d, "landparam", "Extra value that is important in some lands. The specific meaning depends on the land."); dialog::reaction = [what] () { HEAT(what) = d; }; diff --git a/graph.cpp b/graph.cpp index 242fc0da..ed7a37ef 100644 --- a/graph.cpp +++ b/graph.cpp @@ -2610,7 +2610,7 @@ void drawaura() { } #if CAP_SDL || CAP_GL - double bak[3]; + ld bak[3]; bak[0] = ((backcolor>>16)&255)/255.; bak[1] = ((backcolor>>8)&255)/255.; bak[2] = ((backcolor>>0)&255)/255.; @@ -2639,14 +2639,14 @@ void drawaura() { if(alpha >= AURA) alpha -= AURA; int rm = int(alpha); - double fr = alpha-rm; + ld fr = alpha-rm; if(rm<0 || rm >= AURA) continue; color_t& p = qpixel(s, x, y); for(int c=0; c<3; c++) { - double c1 = aurac[rm][2-c] / (aurac[rm][3]+.1); - double c2 = aurac[rm+1][2-c] / (aurac[rm+1][3]+.1); + ld c1 = aurac[rm][2-c] / (aurac[rm][3]+.1); + ld c2 = aurac[rm+1][2-c] / (aurac[rm+1][3]+.1); const ld one = 1; part(p, c) = int(255 * min(one, bak[2-c] + cmul * ((c1 + fr * (c2-c1) - bak[2-c])))); } diff --git a/hyper.h b/hyper.h index 9955cfea..1ba0ecf5 100644 --- a/hyper.h +++ b/hyper.h @@ -1339,7 +1339,7 @@ namespace rug { struct edge { struct rugpoint *target; - double len; + ld len; }; struct dexp_data { @@ -3331,7 +3331,7 @@ transmatrix rgpushxto0(const hyperpoint& H); string its(int i); -double hdist0(const hyperpoint& mh); +ld hdist0(const hyperpoint& mh); extern bool fading; extern ld fadeout; diff --git a/hyperpoint.cpp b/hyperpoint.cpp index af6b01de..c0760f3c 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -584,7 +584,7 @@ transmatrix inverse(const transmatrix& T) { } // distance between mh and 0 -double hdist0(const hyperpoint& mh) { +ld hdist0(const hyperpoint& mh) { switch(cgclass) { case gcHyperbolic: if(mh[DIM] < 1) return 0; @@ -616,7 +616,7 @@ ld circlelength(ld r) { } // distance between two points -double hdist(const hyperpoint& h1, const hyperpoint& h2) { +ld hdist(const hyperpoint& h1, const hyperpoint& h2) { // return hdist0(gpushxto0(h1) * h2); ld iv = intval(h1, h2); switch(cgclass) { diff --git a/polygons.cpp b/polygons.cpp index 3a81d1e2..3b905aaa 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -691,7 +691,7 @@ void dqi_poly::gldraw() { } #endif -double scale_at(const transmatrix& T) { +ld scale_at(const transmatrix& T) { if(DIM == 3 && pmodel == mdPerspective) return 1 / (tC0(T))[2]; using namespace hyperpoint_vec; hyperpoint h1, h2, h3; @@ -701,7 +701,7 @@ double scale_at(const transmatrix& T) { return sqrt(hypot_d(2, h2-h1) * hypot_d(2, h3-h1) / .0001); } -double linewidthat(const hyperpoint& h) { +ld linewidthat(const hyperpoint& h) { if(!(vid.antialias & AA_LINEWIDTH)) return 1; else if(hyperbolic && pmodel == mdDisk && vid.alpha == 1) { double dz = h[DIM]; diff --git a/rug.cpp b/rug.cpp index 8dffe8ed..b045a1db 100644 --- a/rug.cpp +++ b/rug.cpp @@ -1029,7 +1029,7 @@ void addNewPoints() { return; } - double dist = hdist0(points[qvalid]->h) + .1e-6; + ld dist = hdist0(points[qvalid]->h) + .1e-6; int oqvalid = qvalid; diff --git a/shmup.cpp b/shmup.cpp index 7b44f2d6..61163b6d 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -1418,8 +1418,8 @@ hyperpoint keytarget(int i) { return 0; } */ -double getSwordSize() { return sword_size; } -double getHornsSize() { return scalefactor * 0.33; } +ld getSwordSize() { return sword_size; } +ld getHornsSize() { return scalefactor * 0.33; } // used in 3D transmatrix swordmatrix[MAXPLAYER]; diff --git a/util.cpp b/util.cpp index 8bac3667..01dd80f5 100644 --- a/util.cpp +++ b/util.cpp @@ -167,7 +167,7 @@ cld exp_parser::parse(int prio) { else if(eat("conj(")) res = std::conj(parsepar()); else if(eat("floor(")) res = floor(real(parsepar())); else if(eat("frac(")) { res = parsepar(); res = res - floor(real(res)); } - else if(eat("to01(")) { res = parsepar(); return atan(res) / M_PI + 0.5; } + else if(eat("to01(")) { res = parsepar(); return atan(res) / ld(M_PI) + ld(0.5); } else if(eat("ifp(")) { cld cond = parse(0); if(next() != ',') {at = -1; return 0; } at++;