From cfbd5f830cade7cc3c64350a94b12ca566d5a3d5 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 6 Apr 2020 08:39:31 +0200 Subject: [PATCH] fixed some warnings and errors with ll to int assignment --- drawing.cpp | 2 +- fieldpattern.cpp | 10 +++++----- graph.cpp | 2 +- hyperpoint.cpp | 8 ++++---- landgen.cpp | 2 +- shaders.cpp | 2 +- shmup.cpp | 2 +- tour.cpp | 2 +- util.cpp | 10 +++++----- yendor.cpp | 6 +++--- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drawing.cpp b/drawing.cpp index e9581f12..ff221bd8 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -1892,7 +1892,7 @@ EX void draw_backside() { } else { reverse_side_priorities(); - for(int i=ptds.size()-1; i>=0; i--) + for(int i=isize(ptds)-1; i>=0; i--) if(!among(ptds[i]->prio, PPR::MOBILE_ARROW, PPR::OUTCIRCLE, PPR::CIRCLE)) ptds[i]->draw_back(); diff --git a/fieldpattern.cpp b/fieldpattern.cpp index 54a8d8d8..4639abd6 100644 --- a/fieldpattern.cpp +++ b/fieldpattern.cpp @@ -192,7 +192,7 @@ struct fpattern { void add(const matrix& M) { if(!matcode.count(M)) { - int i = matrices.size(); + int i = isize(matrices); matcode[M] = i, matrices.push_back(M); for(int j=0; j fpattern::generate_isometries3() { void fpattern::add1(const matrix& M) { if(!matcode.count(M)) { - int i = matrices.size(); + int i = isize(matrices); matcode[M] = i, matrices.push_back(M); } } void fpattern::add1(const matrix& M, const transmatrix& Full) { if(!matcode.count(M)) { - int i = matrices.size(); + int i = isize(matrices); matcode[M] = i, matrices.push_back(M), fullv.push_back(Full); } } @@ -801,7 +801,7 @@ void fpattern::analyze() { } DEBB(DF_FIELD, ("variation = %d\n", int(variation))); - int N = connections.size(); + int N = isize(connections); markers.resize(N); @@ -1214,7 +1214,7 @@ EX void nextPrime(fgeomextra& ex) { fp.Prime = nextprime; if(fp.solve() == 0) { fp.build(); - int cells = fp.matrices.size() / S7; + int cells = isize(fp.matrices) / S7; ex.primes.emplace_back(primeinfo{nextprime, cells, (bool) fp.wsquare}); ex.dualval.emplace_back(fp.dual); break; diff --git a/graph.cpp b/graph.cpp index d1e5f4cc..a665ec86 100644 --- a/graph.cpp +++ b/graph.cpp @@ -2835,7 +2835,7 @@ EX bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, col else if(isWorm(m)) { ld depth = geom3::factor_to_lev(wormhead(c) == c ? cgi.AHEAD : cgi.ABODY); footphase = 0; - int q = ptds.size(); + int q = isize(ptds); drawMonsterType(moPlayer, c, Vs, col, footphase, asciicol); pushdown(c, q, Vs, -depth, true, false); } diff --git a/hyperpoint.cpp b/hyperpoint.cpp index bca31c3c..b4c98c41 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -1214,12 +1214,12 @@ EX ld raddif(ld a, ld b) { return d; } -EX int bucketer(ld x) { - return (long long)(x * 10000 + 100000.5) - 100000; +EX unsigned bucketer(ld x) { + return unsigned((long long)(x * 10000 + 100000.5) - 100000); } -EX int bucketer(hyperpoint h) { - int dx = 0; +EX unsigned bucketer(hyperpoint h) { + unsigned dx = 0; if(prod) { auto d = product_decompose(h); h = d.second; diff --git a/landgen.cpp b/landgen.cpp index b2575519..5647fac5 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -178,7 +178,7 @@ EX int hrand_monster(int x) { // in 3D monster generation depends on the sight range if(WDIM == 3 && !sphere) { int t = isize(gmatrix); - if(t > 500) x = ((long long)(x)) * t / 500; + if(t > 500) x = int(((long long)(x)) * t / 500); } return hrand(x); } diff --git a/shaders.cpp b/shaders.cpp index cbe6d2f6..8760e090 100644 --- a/shaders.cpp +++ b/shaders.cpp @@ -288,7 +288,7 @@ shared_ptr write_shader(flagtype shader_flags) { if(glhr::noshaders || !vid.usingGL) fsh = vsh = ""; - string both = fsh + "*" + vsh + "*" + its(shader_flags); + string both = fsh + "*" + vsh + "*" + llts(shader_flags); if(compiled_programs.count(both)) return compiled_programs[both]; else { diff --git a/shmup.cpp b/shmup.cpp index de4ebde6..94579ef2 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -2922,7 +2922,7 @@ bool celldrawer::draw_shmup_monster() { isBullet(m) ? 0x00FFFFFF : (isFriendly(m->type) || m->type == moPlayer) ? 0x00FF00FF : 0xFF0000FF; - int q = ptds.size(); + int q = isize(ptds); if(q != isize(ptds) && !m->inBoat) pushdown(c, q, view, zlev, true, false); if(callhandlers(false, hooks_draw, V, c, m)) continue; diff --git a/tour.cpp b/tour.cpp index e93c5bb0..25259d24 100644 --- a/tour.cpp +++ b/tour.cpp @@ -140,7 +140,7 @@ bool handleKeyTour(int sym, int uni) { if(!tour::on) return false; if(!(cmode & sm::DOTOUR)) return false; bool inhelp = cmode & sm::HELP; - int flags = slides[currentslide].flags; + flagtype flags = slides[currentslide].flags; if((sym == SDLK_RETURN || sym == SDLK_KP_ENTER) && (!inhelp || (flags & QUICKSKIP))) { popScreenAll(); if(gamestack::pushed()) { diff --git a/util.cpp b/util.cpp index 301ce9f8..139690a2 100644 --- a/util.cpp +++ b/util.cpp @@ -476,7 +476,7 @@ bignum bignum::randomized_div(int x) const { carry += digits[i]; // strange compiler buug: // if I do / and %, function 'divmod' is called, and it complains on launch that divmod is unimplemented - res.digits[i] = carry / x; + res.digits[i] = int(carry / x); carry -= res.digits[i] * (long long)(x); } while(isize(res.digits) && res.digits.back() == 0) res.digits.pop_back(); @@ -494,10 +494,10 @@ void bignum::addmul(const bignum& b, int factor) { l += carry; if(i < K) l += b.digits[i] * factor; carry = 0; - if(l >= BASE) carry = l / BASE; - if(l < 0) carry = -(BASE-1-l) / BASE; + if(l >= BASE) carry = int(l / BASE); + if(l < 0) carry = -int((BASE-1-l) / BASE); l -= carry * BASE; - digits[i] = l; + digits[i] = int(l); } if(carry < 0) digits.back() -= BASE; while(isize(digits) && digits.back() == 0) digits.pop_back(); @@ -578,7 +578,7 @@ EX string short_form(bignum b) { int digits = q * 9; while(val >= 1000) { val /= 10; digits++; } - string str = its(val) + "E" + its(digits + 2); + string str = its(int(val)) + "E" + its(digits + 2); str.insert(1, "."); return str; } diff --git a/yendor.cpp b/yendor.cpp index 83493d75..7abbd2e5 100644 --- a/yendor.cpp +++ b/yendor.cpp @@ -853,7 +853,7 @@ EX namespace tactic { return hiitemsMax(treasureType(l)) * landMultiplier(l) >= 20; } - EX void record(eLand land, int score, int xc IS(modecode())) { + EX void record(eLand land, int score, flagtype xc IS(modecode())) { if(land >=0 && land < landtypes) { for(int i=MAXTAC-1; i; i--) lsc[xc][land][i] = lsc[xc][land][i-1]; tactic::lsc[xc][land][0] = score; @@ -868,7 +868,7 @@ EX namespace tactic { record(lasttactic, items[treasureType(lasttactic)]); } - void unrecord(eLand land, int xc = modecode()) { + void unrecord(eLand land, flagtype xc = modecode()) { if(land >=0 && land < landtypes) { for(int i=0; i