1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

fixed some warnings and errors with ll to int assignment

This commit is contained in:
Zeno Rogue 2020-04-06 08:39:31 +02:00
parent 1b9cdab98c
commit cfbd5f830c
10 changed files with 23 additions and 23 deletions

View File

@ -1892,7 +1892,7 @@ EX void draw_backside() {
} }
else { else {
reverse_side_priorities(); 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)) if(!among(ptds[i]->prio, PPR::MOBILE_ARROW, PPR::OUTCIRCLE, PPR::CIRCLE))
ptds[i]->draw_back(); ptds[i]->draw_back();

View File

@ -192,7 +192,7 @@ struct fpattern {
void add(const matrix& M) { void add(const matrix& M) {
if(!matcode.count(M)) { if(!matcode.count(M)) {
int i = matrices.size(); int i = isize(matrices);
matcode[M] = i, matrices.push_back(M); matcode[M] = i, matrices.push_back(M);
for(int j=0; j<isize(qcoords); j++) for(int j=0; j<isize(qcoords); j++)
addas(mmul(M, qcoords[j]), i); addas(mmul(M, qcoords[j]), i);
@ -445,14 +445,14 @@ vector<matrix> fpattern::generate_isometries3() {
void fpattern::add1(const matrix& M) { void fpattern::add1(const matrix& M) {
if(!matcode.count(M)) { if(!matcode.count(M)) {
int i = matrices.size(); int i = isize(matrices);
matcode[M] = i, matrices.push_back(M); matcode[M] = i, matrices.push_back(M);
} }
} }
void fpattern::add1(const matrix& M, const transmatrix& Full) { void fpattern::add1(const matrix& M, const transmatrix& Full) {
if(!matcode.count(M)) { if(!matcode.count(M)) {
int i = matrices.size(); int i = isize(matrices);
matcode[M] = i, matrices.push_back(M), fullv.push_back(Full); 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))); DEBB(DF_FIELD, ("variation = %d\n", int(variation)));
int N = connections.size(); int N = isize(connections);
markers.resize(N); markers.resize(N);
@ -1214,7 +1214,7 @@ EX void nextPrime(fgeomextra& ex) {
fp.Prime = nextprime; fp.Prime = nextprime;
if(fp.solve() == 0) { if(fp.solve() == 0) {
fp.build(); 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.primes.emplace_back(primeinfo{nextprime, cells, (bool) fp.wsquare});
ex.dualval.emplace_back(fp.dual); ex.dualval.emplace_back(fp.dual);
break; break;

View File

@ -2835,7 +2835,7 @@ EX bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, col
else if(isWorm(m)) { else if(isWorm(m)) {
ld depth = geom3::factor_to_lev(wormhead(c) == c ? cgi.AHEAD : cgi.ABODY); ld depth = geom3::factor_to_lev(wormhead(c) == c ? cgi.AHEAD : cgi.ABODY);
footphase = 0; footphase = 0;
int q = ptds.size(); int q = isize(ptds);
drawMonsterType(moPlayer, c, Vs, col, footphase, asciicol); drawMonsterType(moPlayer, c, Vs, col, footphase, asciicol);
pushdown(c, q, Vs, -depth, true, false); pushdown(c, q, Vs, -depth, true, false);
} }

View File

@ -1214,12 +1214,12 @@ EX ld raddif(ld a, ld b) {
return d; return d;
} }
EX int bucketer(ld x) { EX unsigned bucketer(ld x) {
return (long long)(x * 10000 + 100000.5) - 100000; return unsigned((long long)(x * 10000 + 100000.5) - 100000);
} }
EX int bucketer(hyperpoint h) { EX unsigned bucketer(hyperpoint h) {
int dx = 0; unsigned dx = 0;
if(prod) { if(prod) {
auto d = product_decompose(h); auto d = product_decompose(h);
h = d.second; h = d.second;

View File

@ -178,7 +178,7 @@ EX int hrand_monster(int x) {
// in 3D monster generation depends on the sight range // in 3D monster generation depends on the sight range
if(WDIM == 3 && !sphere) { if(WDIM == 3 && !sphere) {
int t = isize(gmatrix); 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); return hrand(x);
} }

View File

@ -288,7 +288,7 @@ shared_ptr<glhr::GLprogram> write_shader(flagtype shader_flags) {
if(glhr::noshaders || !vid.usingGL) fsh = vsh = ""; 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)) if(compiled_programs.count(both))
return compiled_programs[both]; return compiled_programs[both];
else { else {

View File

@ -2922,7 +2922,7 @@ bool celldrawer::draw_shmup_monster() {
isBullet(m) ? 0x00FFFFFF : isBullet(m) ? 0x00FFFFFF :
(isFriendly(m->type) || m->type == moPlayer) ? 0x00FF00FF : 0xFF0000FF; (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(q != isize(ptds) && !m->inBoat) pushdown(c, q, view, zlev, true, false);
if(callhandlers(false, hooks_draw, V, c, m)) continue; if(callhandlers(false, hooks_draw, V, c, m)) continue;

View File

@ -140,7 +140,7 @@ bool handleKeyTour(int sym, int uni) {
if(!tour::on) return false; if(!tour::on) return false;
if(!(cmode & sm::DOTOUR)) return false; if(!(cmode & sm::DOTOUR)) return false;
bool inhelp = cmode & sm::HELP; 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))) { if((sym == SDLK_RETURN || sym == SDLK_KP_ENTER) && (!inhelp || (flags & QUICKSKIP))) {
popScreenAll(); popScreenAll();
if(gamestack::pushed()) { if(gamestack::pushed()) {

View File

@ -476,7 +476,7 @@ bignum bignum::randomized_div(int x) const {
carry += digits[i]; carry += digits[i];
// strange compiler buug: // strange compiler buug:
// if I do / and %, function 'divmod' is called, and it complains on launch that divmod is unimplemented // 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); carry -= res.digits[i] * (long long)(x);
} }
while(isize(res.digits) && res.digits.back() == 0) res.digits.pop_back(); 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; l += carry;
if(i < K) l += b.digits[i] * factor; if(i < K) l += b.digits[i] * factor;
carry = 0; carry = 0;
if(l >= BASE) carry = l / BASE; if(l >= BASE) carry = int(l / BASE);
if(l < 0) carry = -(BASE-1-l) / BASE; if(l < 0) carry = -int((BASE-1-l) / BASE);
l -= carry * BASE; l -= carry * BASE;
digits[i] = l; digits[i] = int(l);
} }
if(carry < 0) digits.back() -= BASE; if(carry < 0) digits.back() -= BASE;
while(isize(digits) && digits.back() == 0) digits.pop_back(); while(isize(digits) && digits.back() == 0) digits.pop_back();
@ -578,7 +578,7 @@ EX string short_form(bignum b) {
int digits = q * 9; int digits = q * 9;
while(val >= 1000) { val /= 10; digits++; } 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, "."); str.insert(1, ".");
return str; return str;
} }

View File

@ -853,7 +853,7 @@ EX namespace tactic {
return hiitemsMax(treasureType(l)) * landMultiplier(l) >= 20; 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) { if(land >=0 && land < landtypes) {
for(int i=MAXTAC-1; i; i--) lsc[xc][land][i] = lsc[xc][land][i-1]; for(int i=MAXTAC-1; i; i--) lsc[xc][land][i] = lsc[xc][land][i-1];
tactic::lsc[xc][land][0] = score; tactic::lsc[xc][land][0] = score;
@ -868,7 +868,7 @@ EX namespace tactic {
record(lasttactic, items[treasureType(lasttactic)]); record(lasttactic, items[treasureType(lasttactic)]);
} }
void unrecord(eLand land, int xc = modecode()) { void unrecord(eLand land, flagtype xc = modecode()) {
if(land >=0 && land < landtypes) { if(land >=0 && land < landtypes) {
for(int i=0; i<MAXTAC-1; i++) lsc[xc][land][i] = lsc[xc][land][i+1]; for(int i=0; i<MAXTAC-1; i++) lsc[xc][land][i] = lsc[xc][land][i+1];
lsc[xc][land][MAXTAC-1] = -1; lsc[xc][land][MAXTAC-1] = -1;
@ -904,7 +904,7 @@ EX namespace tactic {
EX void showMenu() { EX void showMenu() {
int xc = modecode(); flagtype xc = modecode();
if(xc == 0) set_priority_board(LB_PURE_TACTICS); if(xc == 0) set_priority_board(LB_PURE_TACTICS);
if(xc == 2) set_priority_board(LB_PURE_TACTICS_SHMUP); if(xc == 2) set_priority_board(LB_PURE_TACTICS_SHMUP);