renamed the size function to isize

This commit is contained in:
Zeno Rogue 2018-06-22 14:47:24 +02:00
parent 23874e0de4
commit 63869c6d33
51 changed files with 596 additions and 595 deletions

View File

@ -106,7 +106,7 @@ void achievement_log(const char* s, char flags) {
if(wrongMode(flags)) return;
for(int i=0; i<size(achievementsReceived); i++)
for(int i=0; i<isize(achievementsReceived); i++)
if(achievementsReceived[i] == s) return;
achievementsReceived.push_back(s);

View File

@ -108,14 +108,14 @@ void loadfont(int siz) {
#if !ISFAKEMOBILE && !ISANDROID & !ISIOS
int textwidth(int siz, const string &str) {
if(size(str) == 0) return 0;
if(isize(str) == 0) return 0;
#if CAP_SDLTTF
loadfont(siz);
int w, h;
TTF_SizeUTF8(font[siz], str.c_str(), &w, &h);
// printf("width = %d [%d]\n", w, size(str));
// printf("width = %d [%d]\n", w, isize(str));
return w;
#elif CAP_GL
@ -608,7 +608,7 @@ bool displaychr(int x, int y, int shift, int size, char chr, int col) {
void gdpush_utf8(const string& s) {
int g = (int) graphdata.size(), q = 0;
gdpush((int) s.size()); for(int i=0; i<size(s); i++) {
gdpush((int) s.size()); for(int i=0; i<isize(s); i++) {
#if ISANDROID
unsigned char uch = (unsigned char) s[i];
if(uch >= 192 && uch < 224) {
@ -761,7 +761,7 @@ vector<msginfo> msgs;
vector<msginfo> gamelog;
void flashMessages() {
for(int i=0; i<size(msgs); i++)
for(int i=0; i<isize(msgs); i++)
if(msgs[i].stamp < ticks - 1000 && !msgs[i].flashout) {
msgs[i].flashout = true;
msgs[i].stamp = ticks;
@ -776,19 +776,19 @@ string fullmsg(msginfo& m) {
void addMessageToLog(msginfo& m, vector<msginfo>& log) {
if(size(log) != 0) {
msginfo& last = log[size(log)-1];
if(isize(log) != 0) {
msginfo& last = log[isize(log)-1];
if(last.msg == m.msg) {
int q = m.quantity + last.quantity;
last = m; last.quantity = q;
return;
}
}
if(size(log) < 1000)
if(isize(log) < 1000)
log.push_back(m);
else {
for(int i=0; i<size(log)-1; i++) swap(log[i], log[i+1]);
log[size(log)-1] = m;
for(int i=0; i<isize(log)-1; i++) swap(log[i], log[i+1]);
log[isize(log)-1] = m;
}
}
@ -850,7 +850,7 @@ void drawmessage(const string& s, int& y, int col) {
return;
}
for(int i=1; i<size(s); i++)
for(int i=1; i<isize(s); i++)
if(s[i-1] == ' ' && textwidth(vid.fsize, "..."+s.substr(i)) <= space) {
displayfr(0, y, 1, vid.fsize, "..."+s.substr(i), col, 0);
y -= vid.fsize;
@ -868,11 +868,11 @@ void drawmessages() {
DEBB(DF_GRAPH, (debugfile,"draw messages\n"));
int i = 0;
int t = ticks;
for(int j=0; j<size(msgs); j++) {
if(j < size(msgs) - vid.msglimit) continue;
for(int j=0; j<isize(msgs); j++) {
if(j < isize(msgs) - vid.msglimit) continue;
int age = msgs[j].flashout * (t - msgs[j].stamp);
if(msgs[j].spamtype) {
for(int i=j+1; i<size(msgs); i++) if(msgs[i].spamtype == msgs[j].spamtype)
for(int i=j+1; i<isize(msgs); i++) if(msgs[i].spamtype == msgs[j].spamtype)
msgs[j].flashout = 2;
}
if(age < 256*vid.flashtime)
@ -881,7 +881,7 @@ void drawmessages() {
msgs.resize(i);
if(vid.msgleft == 2) {
int y = vid.yres - vid.fsize - (ISIOS ? 4 : 0);
for(int j=size(msgs)-1; j>=0; j--) {
for(int j=isize(msgs)-1; j>=0; j--) {
int age = msgs[j].flashout * (t - msgs[j].stamp);
poly_outline = gradient(bordcolor, backcolor, 0, age, 256*vid.flashtime) << 8;
int col = gradient(forecolor, backcolor, 0, age, 256*vid.flashtime);
@ -889,10 +889,10 @@ void drawmessages() {
}
}
else {
for(int j=0; j<size(msgs); j++) {
for(int j=0; j<isize(msgs); j++) {
int age = msgs[j].flashout * (t - msgs[j].stamp);
int x = vid.msgleft ? 0 : vid.xres / 2;
int y = vid.yres - vid.fsize * (size(msgs) - j) - (ISIOS ? 4 : 0);
int y = vid.yres - vid.fsize * (isize(msgs) - j) - (ISIOS ? 4 : 0);
poly_outline = gradient(bordcolor, backcolor, 0, age, 256*vid.flashtime) << 8;
displayfr(x, y, 1, vid.fsize, fullmsg(msgs[j]), gradient(forecolor, backcolor, 0, age, 256*vid.flashtime), vid.msgleft ? 0 : 8);
}

View File

@ -320,7 +320,7 @@ cell *buildAnotherEquidistant(cell *c, int radius) {
cellwalker cw(c, (gdir+3) % c->type);
vector<cell*> coastpath;
while(size(coastpath) < radius || (cw.c->type != 7 && !weirdhyperbolic)) {
while(isize(coastpath) < radius || (cw.c->type != 7 && !weirdhyperbolic)) {
// this leads to bugs for some reason!
if(cw.c->land == laCrossroads2) {
#ifdef AUTOPLAY
@ -338,7 +338,7 @@ cell *buildAnotherEquidistant(cell *c, int radius) {
coastpath.push_back(cw.c);
if(cw.c->land == laNone && cw.c->mpdist <= 7) {
raiseBuggyGeneration(cw.c, "landNone 1");
for(int i=0; i<size(coastpath); i++) coastpath[i]->item = itPirate;
for(int i=0; i<isize(coastpath); i++) coastpath[i]->item = itPirate;
return NULL;
}
cw = cw + wstep + 3;
@ -346,18 +346,18 @@ cell *buildAnotherEquidistant(cell *c, int radius) {
}
coastpath.push_back(cw.c);
// printf("setdists\n");
for(int i=1; i<size(coastpath) - 1; i++) {
for(int i=1; i<isize(coastpath) - 1; i++) {
if(coastpath[i-1]->land == laNone) {
raiseBuggyGeneration(cwt.c, "landNone 3");
int mpd[10];
for(int i=0; i<10; i++) mpd[i] = coastpath[i]->mpdist;
{for(int i=0; i<10; i++) printf("%d ", mpd[i]);} printf("\n");
for(int i=0; i<size(coastpath); i++) coastpath[i]->item = itPirate;
for(int i=0; i<isize(coastpath); i++) coastpath[i]->item = itPirate;
return NULL;
}
setdist(coastpath[i], BARLEV, coastpath[i-1]);
setdist(coastpath[i], BARLEV-1, coastpath[i-1]);
if(i < size(coastpath) - 5) {
if(i < isize(coastpath) - 5) {
coastpath[i]->bardir = NOBARRIERS;
// forCellEx(c2, coastpath[i]) c2->bardir = NOBARRIERS;
}
@ -371,7 +371,7 @@ cell *buildAnotherEquidistant(cell *c, int radius) {
if(c2->land == laNone) {
raiseBuggyGeneration(c2, "landNone 2");
for(int i=0; i<size(coastpath); i++) coastpath[i]->item = itPirate;
for(int i=0; i<isize(coastpath); i++) coastpath[i]->item = itPirate;
return NULL;
}
@ -393,7 +393,7 @@ cell *buildAnotherEquidistant(cell *c, int radius) {
//printf("building barrier II\n");
if(hasbardir(c2)) extendBarrier(c2);
for(int i=size(coastpath)-(nowall?1:2); i>=0; i--) {
for(int i=isize(coastpath)-(nowall?1:2); i>=0; i--) {
for(int j=BARLEV; j>=6; j--)
setdist(coastpath[i], j, NULL);
}

View File

@ -77,7 +77,7 @@ void drawBlizzards() {
bcells.push_back(&it->second);
it++;
}
N = size(bcells);
N = isize(bcells);
for(int i=0; i<N; i++) {
auto& bc = *bcells[i];
bc.tmp = bc.c->aitmp,
@ -105,7 +105,7 @@ void drawBlizzards() {
bc.inward += z / 8, qty = -z/8;
}
bc.ward = max(bc.inward, bc.outward);
while(size(bc.inorder) < bc.ward) {
while(isize(bc.inorder) < bc.ward) {
auto sb = new snowball(c->type);
bc.inorder.push_back(sb);
bc.outorder.push_back(sb);
@ -169,7 +169,7 @@ void drawBlizzards() {
queuepoly(*bc.gm * ddspin(bc.c, i) * xpush(cellgfxdist(bc.c, i)/2), shWindArrow, col);
}
int B = size(bc.outorder);
int B = isize(bc.outorder);
if(B<2) continue;
int i = rand() % B;
int j = rand() % (B-1);

View File

@ -419,7 +419,7 @@ struct hrmap_torus : hrmap {
}
celllister cl(gamestart(), 100, 100000000, NULL);
dists.resize(q);
for(int i=0; i<size(cl.lst); i++)
for(int i=0; i<isize(cl.lst); i++)
dists[decodeId(cl.lst[i]->master)] = cl.dists[i];
}
@ -754,7 +754,7 @@ struct hrmap_quotient : hrmap {
heptagon *getOrigin() { return allh[0]; }
~hrmap_quotient() {
for(int i=0; i<size(allh); i++) {
for(int i=0; i<isize(allh); i++) {
clearHexes(allh[i]);
delete allh[i];
}
@ -1478,7 +1478,7 @@ int celldistance(cell *c1, cell *c2) {
return saved_distances[make_pair(c1,c2)];
celllister cl(c1, 100, 100000000, NULL);
for(int i=0; i<size(cl.lst); i++)
for(int i=0; i<isize(cl.lst); i++)
saved_distances[make_pair(c1, cl.lst[i])] = cl.dists[i];
if(saved_distances.count(make_pair(c1,c2)))
@ -1492,11 +1492,11 @@ int celldistance(cell *c1, cell *c2) {
if(saved_distances.count(make_pair(c1,c2)))
return saved_distances[make_pair(c1,c2)];
if(size(saved_distances) > 1000000) saved_distances.clear();
if(isize(saved_distances) > 1000000) saved_distances.clear();
celllister cl(c1, 64, 1000, c2);
for(int i=0; i<size(cl.lst); i++)
for(int i=0; i<isize(cl.lst); i++)
saved_distances[make_pair(c1, cl.lst[i])] = cl.dists[i];
if(saved_distances.count(make_pair(c1,c2)))
@ -1572,7 +1572,7 @@ int celldistance(cell *c1, cell *c2) {
}
void clearCellMemory() {
for(int i=0; i<size(allmaps); i++)
for(int i=0; i<isize(allmaps); i++)
if(allmaps[i])
delete allmaps[i];
allmaps.clear();

View File

@ -69,7 +69,7 @@ namespace arg {
void lshift() { pos++; }
void shift() {
lshift(); if(pos > size(argument)) { printf("Missing parameter\n"); exit(1); }
lshift(); if(pos > isize(argument)) { printf("Missing parameter\n"); exit(1); }
}
const string& args() { return argument[pos]; }
@ -439,8 +439,8 @@ else if(args()[0] == '-' && args()[1] == x && args()[2] == '0') { showstartmenu
PHASEFROM(2); shift(); start_game();
printf("Generating %d cells...\n", argi());
celllister cl(cwt.c, 50, argi(), NULL);
printf("Cells generated: %d\n", size(cl.lst));
for(int i=0; i<size(cl.lst); i++)
printf("Cells generated: %d\n", isize(cl.lst));
for(int i=0; i<isize(cl.lst); i++)
setdist(cl.lst[i], 7, NULL);
}
else if(argis("-sr")) {
@ -621,7 +621,7 @@ namespace arg {
void read(int phase) {
curphase = phase;
callhooks(hooks_config);
while(pos < size(argument)) {
while(pos < isize(argument)) {
for(auto& h: *hooks_args) {
int r = h.second(); if(r == 2) return; if(r == 0) { lshift(); goto cont; }
}

View File

@ -95,8 +95,8 @@ namespace whirlwind {
void build(vector<cell*>& whirlline, int d) {
again:
cell *at = whirlline[size(whirlline)-1];
cell *prev = whirlline[size(whirlline)-2];
cell *at = whirlline[isize(whirlline)-1];
cell *prev = whirlline[isize(whirlline)-2];
for(int i=0; i<at->type; i++)
if(at->mov[i] && (euclid || at->mov[i]->master->alt) && celldistAlt(at->mov[i]) == d && at->mov[i] != prev) {
whirlline.push_back(at->mov[i]);
@ -125,7 +125,7 @@ namespace whirlwind {
c2 = c2->mov[dfrom[0]];
prev = cc2;
}
int z = size(whirlline);
int z = isize(whirlline);
// printf("Cycle built from %p, length = %d\n", c, z);
for(int i=0; i<z; i++) {
// printf("%d%c", whirlline[i]->mpdist, whirlline[i]->item ? '*' : ' ');
@ -144,13 +144,13 @@ namespace whirlwind {
void move() {
sval++;
for(int i=0; i<size(dcal); i++) {
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
moveAt(c);
}
// Keys and Orbs of Yendor always move
using namespace yendor;
for(int i=0; i<size(yi); i++) {
for(int i=0; i<isize(yi); i++) {
moveAt(yi[i].path[0]);
moveAt(yi[i].path[YDIST-1]);
}
@ -265,7 +265,7 @@ namespace elec {
vector<cell*> chargecells;
bool hasdata(cell *c) {
return c->aitmp >= 0 && c->aitmp < size(charges) && charges[c->aitmp].c == c;
return c->aitmp >= 0 && c->aitmp < isize(charges) && charges[c->aitmp].c == c;
}
void connect(int from, cell *c) {
@ -277,7 +277,7 @@ namespace elec {
charges[from].lowlink = c->aitmp;
}
else {
int id = size(charges);
int id = isize(charges);
charges.push_back(chargedata());
{chargedata& ch(charges[id]);
@ -371,7 +371,7 @@ namespace elec {
chargecells.clear();
if(!haveelec && !afterOrb) return;
sval++;
for(int i=0; i<size(dcal); i++) listChargedCells(dcal[i]);
for(int i=0; i<isize(dcal); i++) listChargedCells(dcal[i]);
charges.resize(2);
charges[0].lowlink = 0; charges[1].lowlink = 1;
@ -379,12 +379,12 @@ namespace elec {
xstack.clear();
for(int i=0; i<size(chargecells); i++)
for(int i=0; i<isize(chargecells); i++)
connect(1, chargecells[i]);
havethunder = charges[1].lowlink == 0;
if(havethunder) {
for(int i=0; i<size(xstack); i++) {
for(int i=0; i<isize(xstack); i++) {
int k = xstack[i].first;
int l = xstack[i].second;
// printf("connected %d-%d\n", k, l);
@ -399,13 +399,13 @@ namespace elec {
addMessage(XLAT("There is a flash of thunder!"));
playSound(NULL, "storm");
drawLightning();
for(int i=2; i<size(charges); i++) if(charges[i].fire)
for(int i=2; i<isize(charges); i++) if(charges[i].fire)
affect(charges[i].c);
}
}
void cleanup() {
for(int i=2; i<size(charges); i++)
for(int i=2; i<isize(charges); i++)
charges[i].c->aitmp = charges[i].otmp;
charges.resize(0);
}
@ -423,13 +423,13 @@ namespace elec {
}
void drawcharges() {
for(int i=0; i<size(dcal); i++)
for(int i=0; i<isize(dcal); i++)
if(getCharge(dcal[i]) == ecCharged)
draw(dcal[i], ecCharged);
}
bool affected(cell *c) {
if(c->aitmp >= 0 && c->aitmp < size(charges) && charges[c->aitmp].c == c)
if(c->aitmp >= 0 && c->aitmp < isize(charges) && charges[c->aitmp].c == c)
return charges[c->aitmp].fire;
return false;
}
@ -495,7 +495,7 @@ namespace princess {
i->prison = c;
i->princess = c;
i->alt = c->master->alt;
i->id = size(infos);
i->id = isize(infos);
i->bestdist = 0;
i->bestnear = OUT_OF_PRISON;
infos.push_back(i);
@ -508,7 +508,7 @@ namespace princess {
i->prison = NULL;
i->princess = c;
i->alt = NULL;
i->id = size(infos);
i->id = isize(infos);
i->bestdist = items[itSavedPrincess] ? OUT_OF_PALACE : OUT_OF_PRISON;
i->bestnear = 0;
infos.push_back(i);
@ -520,13 +520,13 @@ namespace princess {
if(c->land != laPalace) return NULL;
if(!c->master->alt) return NULL;
int ev = c->master->alt->alt->emeraldval; // NEWYEARFIX
if(ev < 0 || ev >= size(infos)) return NULL;
if(ev < 0 || ev >= isize(infos)) return NULL;
if(infos[ev]->alt != c->master->alt->alt) return NULL;
return infos[ev];
}
info *getPrincessInfo(cell *c) {
for(int i=0; i<size(infos); i++) if(infos[i]->princess == c) {
for(int i=0; i<isize(infos); i++) if(infos[i]->princess == c) {
while(i) {
infos[i]->id = i-1; assign(infos[i]);
infos[i-1]->id = i; assign(infos[i-1]);
@ -547,7 +547,7 @@ namespace princess {
}
void clear() {
for(int i=0; i<size(infos); i++) delete infos[i];
for(int i=0; i<isize(infos); i++) delete infos[i];
infos.clear();
}
@ -561,7 +561,7 @@ namespace princess {
playSound(c, princessgender() ? "heal-princess" : "heal-prince");
info *inf = NULL;
for(int i=0; i<size(infos); i++) {
for(int i=0; i<isize(infos); i++) {
if(infos[i]->princess && infos[i]->bestdist == OUT_OF_PALACE && isPrincess(infos[i]->princess->monst))
inf = infos[i];
}
@ -572,7 +572,7 @@ namespace princess {
void bringBack() {
if(bringBackAt(cwt.c->mov[cwt.spin])) return;
for(int i=1; i<size(dcal); i++)
for(int i=1; i<isize(dcal); i++)
if(bringBackAt(dcal[i])) return;
}
@ -749,7 +749,7 @@ namespace clearing {
int iter = 0;
while(!current_root || pseudohept(current_root) || current_root->cpdist < 3) {
if(iter++ > 100) return;
current_root = ac[hrand(size(ac))];
current_root = ac[hrand(isize(ac))];
}
current_root->monst = moMutant;
current_root->mondir = NODIR;
@ -944,12 +944,12 @@ namespace whirlpool {
void build(vector<cell*>& whirlline, int d) {
again:
cell *at = whirlline[size(whirlline)-1];
cell *prev = whirlline[size(whirlline)-2];
cell *at = whirlline[isize(whirlline)-1];
cell *prev = whirlline[isize(whirlline)-2];
for(int i=0; i<at->type; i++)
if(at->mov[i] && (euclid || at->mov[i]->master->alt) && celldistAlt(at->mov[i]) == d && at->mov[i] != prev) {
if(at->mov[i] == whirlline[0]) return; // loops in weird geometries?
if(at->mov[i] == whirlline[size(whirlline)/2]) return; // even weirder geometry?
if(at->mov[i] == whirlline[isize(whirlline)/2]) return; // even weirder geometry?
whirlline.push_back(at->mov[i]);
goto again;
}
@ -1024,7 +1024,7 @@ namespace whirlpool {
build(whirlline, d);
reverse(whirlline.begin(), whirlline.end());
build(whirlline, d);
int z = size(whirlline);
int z = isize(whirlline);
for(int i=0; i<z; i++)
whirlline[i]->aitmp = sval;
@ -1039,13 +1039,13 @@ namespace whirlpool {
void move() {
sval++;
for(int i=0; i<size(dcal); i++) {
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
moveAt(c);
}
// Keys and Orbs of Yendor always move
using namespace yendor;
for(int i=0; i<size(yi); i++) {
for(int i=0; i<isize(yi); i++) {
moveAt(yi[i].path[0]);
moveAt(yi[i].path[YDIST-1]);
}
@ -1078,7 +1078,7 @@ namespace mirror {
void destroyKilled() {
int j = 0;
for(int i=0; i<size(mirrors); i++)
for(int i=0; i<isize(mirrors); i++)
if(mirrors[i].second.c->monst == moMimic)
mirrors[j++] = mirrors[i];
mirrors.resize(j);
@ -1177,7 +1177,7 @@ namespace mirror {
int nummirage = 0;
int j = 0;
for(int i=0; i<size(mirrors); i++) {
for(int i=0; i<isize(mirrors); i++) {
auto& m = mirrors[i];
bool survive = true;
if(m.first == multi::cpid) {
@ -1244,13 +1244,13 @@ namespace mirror {
createHere(cwt, 0);
else for(int i=0; i<numplayers(); i++)
createHere(multi::player[i], i);
for(int i=0; i<size(mirrors); i++)
for(int i=0; i<isize(mirrors); i++)
createHere(mirrors[i].second, mirrors[i].first);
if(numplayers() == 1)
breakMirror(cwt, 0);
else for(int i=0; i<numplayers(); i++)
breakMirror(multi::player[i], i);
for(int i=0; i<size(mirrors); i++)
for(int i=0; i<isize(mirrors); i++)
breakMirror(mirrors[i].second, -1);
list();
}
@ -1269,7 +1269,7 @@ namespace mirror {
pair<bool, cellwalker> traceback(vector<int>& v, cellwalker cw) {
bool goout = false;
for(int i=size(v)-1; i>=0; i--) {
for(int i=isize(v)-1; i>=0; i--) {
if(v[i]) cw -= v[i];
else {
cw += wstep;
@ -1467,9 +1467,9 @@ namespace hive {
void bugcell(cell *c) {
short& i(c->aitmp);
if(i >= 0 && i < size(buginfo) && buginfo[i].where == c)
if(i >= 0 && i < isize(buginfo) && buginfo[i].where == c)
return;
i = size(buginfo);
i = isize(buginfo);
buginfo.resize(i+1);
buginfo_t& b(buginfo[i]);
b.where = c;
@ -1488,7 +1488,7 @@ namespace hive {
}
/*// bugs communicate if the distance is at most 2
// also all nearby cells are inserted to the buginfo structure
if(size(buginfo) < 30000) {
if(isize(buginfo) < 30000) {
for(int dir=0; dir<c->type; dir++) {
cell *c2 = c->mov[dir];
if(c2) {
@ -1528,7 +1528,7 @@ namespace hive {
for(int dir=0; dir<c->type; dir++) {
cell *c2 = c->mov[dir];
if(!c2) continue;
if(c2->aitmp < 0 || c2->aitmp >= size(buginfo)) continue;
if(c2->aitmp < 0 || c2->aitmp >= isize(buginfo)) continue;
if(!passable(c, c2, P_MONSTER)) continue;
int j = c2->aitmp;
if(buginfo[j].where != c2) continue;
@ -1555,27 +1555,27 @@ namespace hive {
bugtomove.clear();
deadbug.clear();
int xdcs = size(dcal); for(int i=0; i<xdcs; i++) bugcell(dcal[i]);
for(int i=0; i<size(bugcellq); i++) bugcell(bugcellq[i]);
int xdcs = isize(dcal); for(int i=0; i<xdcs; i++) bugcell(dcal[i]);
for(int i=0; i<isize(bugcellq); i++) bugcell(bugcellq[i]);
bugcellq.clear();
// printf("buginfo = %d\n", size(buginfo));
// printf("buginfo = %d\n", isize(buginfo));
for(int k=0; k<BUGCOLORS; k++) {
int t = 0;
last_d = -1;
int invadist = 4 - (items[itRoyalJelly]+10) / 20;
if(invadist<0) invadist = 0;
for(; t<size(bugqueue[k]) && last_d < invadist-1; t++) handleBugQueue(k, t);
for(int u=0; u<size(bugqueue4[k]); u++)
for(; t<isize(bugqueue[k]) && last_d < invadist-1; t++) handleBugQueue(k, t);
for(int u=0; u<isize(bugqueue4[k]); u++)
bugQueueInsert(k, bugqueue4[k][u], invadist);
bugqueue4[k].clear();
for(; t<size(bugqueue[k]); t++) handleBugQueue(k, t);
for(; t<isize(bugqueue[k]); t++) handleBugQueue(k, t);
}
for(int k=0; k<BUGCOLORS; k++) {
set<int> check;
for(int t=0; t<size(bugqueue[k]); t++) {
for(int t=0; t<isize(bugqueue[k]); t++) {
if(check.count(bugqueue[k][t])) {
printf("REPETITION! [%d]\n", t);
}
@ -1583,11 +1583,11 @@ namespace hive {
}
}
hrandom_shuffle(&bugtomove[0], size(bugtomove));
hrandom_shuffle(&bugtomove[0], isize(bugtomove));
sort(bugtomove.begin(), bugtomove.end());
int battlecount = 0;
for(int t=0; t<size(bugtomove); t++) {
for(int t=0; t<isize(bugtomove); t++) {
bugtomove_t& bm(bugtomove[t]);
int i = bm.index;
@ -1610,7 +1610,7 @@ namespace hive {
qual = c2->monst == moDeadBug ? -60: isBugEnemy(c2,k) ? 2 : -20;
else if(!passable(c2, c, 0))
qual = passable(c2, c, P_DEADLY) ? -30 : -60;
else if(c2->aitmp < 0 || c2->aitmp >= size(buginfo)) qual = -15;
else if(c2->aitmp < 0 || c2->aitmp >= isize(buginfo)) qual = -15;
else if(buginfo[c2->aitmp].where != c2) qual = -15;
else if(buginfo[c2->aitmp].dist[k] < b.dist[k])
qual = 1;
@ -1653,7 +1653,7 @@ namespace hive {
}
// cleanup
for(int i=0; i<size(deadbug); i++) deadbug[i]->monst = moNone;
for(int i=0; i<isize(deadbug); i++) deadbug[i]->monst = moNone;
if(battlecount)
addMessage(XLAT("The Hyperbugs are fighting!"));
@ -1665,9 +1665,9 @@ namespace hive {
void bugcitycell(cell *c, int d) {
short& i = c->aitmp;
if(i >= 0 && i < size(buginfo) && buginfo[i].where == c)
if(i >= 0 && i < isize(buginfo) && buginfo[i].where == c)
return;
i = size(buginfo);
i = isize(buginfo);
buginfo_t b;
b.where = c;
b.dist[0] = d;
@ -1730,7 +1730,7 @@ namespace hive {
// mark the area with BFS
bugcitycell(citycenter, 0);
for(int i=0; i<size(buginfo); i++) {
for(int i=0; i<isize(buginfo); i++) {
buginfo_t& b(buginfo[i]);
cell *c = b.where;
int d = b.dist[0];
@ -1744,7 +1744,7 @@ namespace hive {
}
// place everything
for(int i=0; i<size(buginfo); i++) {
for(int i=0; i<isize(buginfo); i++) {
buginfo_t& b(buginfo[i]);
cell *c = b.where;
int d = b.dist[0];
@ -1826,7 +1826,7 @@ namespace heat {
vector<cell*>& allcells = currentmap->allcells();
int dcs = size(allcells);
int dcs = isize(allcells);
vector<ld> hmods(dcs, 0);
@ -2016,7 +2016,7 @@ namespace heat {
}
}
for(int i=0; i<size(newfires); i++) {
for(int i=0; i<isize(newfires); i++) {
cell* c = newfires[i].first;
int qty = newfires[i].second;
qty /= 2;
@ -2041,7 +2041,7 @@ bool lifebrought = false; // was Life brought to the Dead Caves?
void livecaves() {
vector<cell*>& allcells = currentmap->allcells();
int dcs = size(allcells);
int dcs = isize(allcells);
vector<cell*> bringlife;
int gr = gamerange();
@ -2179,7 +2179,7 @@ void livecaves() {
}
}
for(int i=0; i<size(bringlife); i++) {
for(int i=0; i<isize(bringlife); i++) {
cell *c = bringlife[i];
if(c->land == laDeadCaves && !lifebrought) {
lifebrought = true;
@ -2326,7 +2326,7 @@ namespace dragon {
void validate(const char *where) {
dragbugs = false;
for(int i=0; i<size(dcal); i++)
for(int i=0; i<isize(dcal); i++)
if(dcal[i]->monst == moDragonTail)
findhead(dcal[i]);
if(dragbugs) {
@ -2410,7 +2410,7 @@ namespace dragon {
// SWAPBITFIELD(c->hitpoints, buffer->hitpoints, int);
c->stuntime = 2;
if(c == until) {
for(int i=size(allcells)-2; i>=0; i--) {
for(int i=isize(allcells)-2; i>=0; i--) {
cell *cmt = allcells[i+1];
cell *cft = allcells[i];
cmt->hitpoints = cft->hitpoints;
@ -2575,7 +2575,7 @@ namespace kraken {
void attacks() {
bool offboat[MAXPLAYER];
for(int i=0; i<MAXPLAYER; i++) offboat[i] = false;
for(int i=0; i<size(dcal); i++) {
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
if(c->monst == moKrakenT && !c->stuntime) forCellEx(c2, c) {
bool dboat = false;
@ -2596,7 +2596,7 @@ namespace kraken {
if(dboat) destroyBoats(c2, c, true);
}
}
for(int i=0; i<size(dcal); i++) {
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
if(c->monst == moKrakenH && !c->stuntime && !isWateryOrBoat(c)) {
int qdir = 0;
@ -2647,18 +2647,18 @@ namespace kraken {
}
}
while(size(acells)) {
while(isize(acells)) {
// bool found = false;
for(int i=0; i<size(acells); i++) {
for(int i=0; i<isize(acells); i++) {
/* bool noconflict = true;
for(int j=0; j<size(acells); j++)
for(int j=0; j<isize(acells); j++)
if(acells[i].second == acells[j].first)
noconflict = false; */
/* if(noconflict) */ {
// found = true;
indAnimateMovement(acells[i].first, acells[i].second, LAYER_BIG, NOHINT);
acells[i] = acells[size(acells)-1];
acells.resize(size(acells)-1);
acells[i] = acells[isize(acells)-1];
acells.resize(isize(acells)-1);
i--;
}
}
@ -2849,7 +2849,7 @@ namespace prairie {
reverse(whirlline.begin(), whirlline.end());
c2 = next(c);
while(c2 && !eq(c2->aitmp, sval)) whirlline.push_back(c2), c2->aitmp = sval, c2 = next(c2);
int qty = size(whirlline);
int qty = isize(whirlline);
// for(int i=0; i<qty; i++) whirlline[i]->aitmp = sval;
if(shmup::on) {
for(int i=0; i<qty; i++) if(whirlline[i]->cpdist <= gamerange()) {
@ -2888,11 +2888,11 @@ namespace prairie {
void move() {
sval++;
for(int i=0; i<size(dcal); i++) {
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
if(isriver(c)) moveAt(c);
}
for(int i=0; i<size(beaststogen); i++)
for(int i=0; i<isize(beaststogen); i++)
generateBeast(beaststogen[i]);
beaststogen.clear();
}
@ -2928,7 +2928,7 @@ namespace prairie {
void treasures() {
if(enter && !isriver(cwt.c)) enter = NULL;
else if(!enter && isriver(cwt.c)) enter = cwt.c;
if(size(tchoices)) {
if(isize(tchoices)) {
if(lasttreasure && lasttreasure->item == itGreenGrass) {
if(celldistance(lasttreasure, cwt.c) >= (nonbitrunc ? 7 : 10)) {
lasttreasure->item = itNone;
@ -2936,10 +2936,10 @@ namespace prairie {
}
else { tchoices.clear(); return; }
}
if(size(tchoices) < 3) { tchoices.clear(); return; }
lasttreasure = tchoices[hrand(size(tchoices))];
if(isize(tchoices) < 3) { tchoices.clear(); return; }
lasttreasure = tchoices[hrand(isize(tchoices))];
lasttreasure->item = itGreenGrass;
for(int i=0; i<size(tchoices); i++) if(isNeighbor(tchoices[i], lasttreasure))
for(int i=0; i<isize(tchoices); i++) if(isNeighbor(tchoices[i], lasttreasure))
tchoices[i]->item = itGreenGrass;
tchoices.clear();
}
@ -2987,7 +2987,7 @@ namespace ca {
void simulate() {
if(cwt.c->land != laCA) return;
vector<cell*>& allcells = currentmap->allcells();
int dcs = size(allcells);
int dcs = isize(allcells);
bool willlive[dcs];
for(int i=0; i<dcs; i++) {
cell *c = allcells[i];
@ -3055,7 +3055,7 @@ namespace windmap {
int getId(cell *c) {
auto i = fieldpattern::fieldval_uniq(c);
auto &id = getid[i];
if(id == 0) { samples.push_back(c); id = size(samples); }
if(id == 0) { samples.push_back(c); id = isize(samples); }
return id-1;
}
@ -3066,7 +3066,7 @@ namespace windmap {
neighbors.clear();
getid.clear();
getId(currentmap->gamestart());
for(int k=0; k<size(samples); k++) {
for(int k=0; k<isize(samples); k++) {
cell *c = samples[k];
neighbors.emplace_back();
auto &v = neighbors.back();
@ -3076,7 +3076,7 @@ namespace windmap {
for(int l=0; l<c->type; l++) v.push_back(getId(createMov(c, l)));
}
int N = size(samples);
int N = isize(samples);
int* precomp = NULL;
@ -3085,8 +3085,8 @@ namespace windmap {
if(N == 18920) precomp = windcodes18920;
if(N == 5676) precomp = windcodes5676;
if(precomp && hyperbolic && size(currfp.matrices)) {
int randval = hrand(size(currfp.matrices));
if(precomp && hyperbolic && isize(currfp.matrices)) {
int randval = hrand(isize(currfp.matrices));
for(int i=0; i<N; i++)
windcodes[i] = precomp[getid[fieldpattern::fieldval_uniq_rand(samples[i], randval)]-1];
return;
@ -3101,9 +3101,9 @@ namespace windmap {
bool inqueue[N];
vector<int> tocheck;
for(int i=0; i<N; i++) tocheck.push_back(i), inqueue[i] = true;
hrandom_shuffle(&tocheck[0], size(tocheck));
hrandom_shuffle(&tocheck[0], isize(tocheck));
for(int a=0; a<size(tocheck); a++) {
for(int a=0; a<isize(tocheck); a++) {
if(a >= 200*N) { printf("does not converge\n"); break; }
int bestval = 1000000000, best = 0;
int i = tocheck[a];
@ -3136,7 +3136,7 @@ namespace windmap {
addMessage("Failed to generate an interesting wind/lava pattern.");
}
else if(false) {
printf("tocheck size = %d\n", size(tocheck));
printf("tocheck size = %d\n", isize(tocheck));
printf("if(N == %d) {\n", N);
printf(" windcodes = {");
for(int i=0; i<N; i++) printf("%d,", windcodes[i]);
@ -3162,20 +3162,20 @@ namespace halloween {
int maxdist = 0;
vector<cell*> validcells;
int firstfar1 = 0;
for(int i=1; i<size(dcal); i++) {
for(int i=1; i<isize(dcal); i++) {
bool okay =
dcal[i]->item == itNone && dcal[i]->monst == moNone && dcal[i]->wall == waNone;
if(lastresort)
okay = dcal[i]->wall != waChasm && !isMultitile(dcal[i]->monst);
if(okay) {
if(dcal[i]->cpdist > maxdist)
firstfar1 = size(validcells),
firstfar1 = isize(validcells),
maxdist = dcal[i]->cpdist;
validcells.push_back(dcal[i]);
}
}
int qvc = size(validcells);
int qvc = isize(validcells);
if(qvc == firstfar1) return farempty(true);
return validcells[firstfar1 + hrand(qvc - firstfar1)];

View File

@ -499,7 +499,7 @@ map<string, shared_ptr<supersaver> > allconfigs;
void parseline(const string& str) {
if(str[0] == '#') return;
for(int i=0; i<size(str); i++) if(str[i] == '=') {
for(int i=0; i<isize(str); i++) if(str[i] == '=') {
string cname = str.substr(0, i);
if(!allconfigs.count(cname)) {
printf("Warning: unknown config variable: %s\n", str.c_str());

View File

@ -132,7 +132,7 @@ namespace spiral {
int& bandpixel(int x, int y) {
int i = 0;
while(i < size(band) && x >= band[i]->w)
while(i < isize(band) && x >= band[i]->w)
x -= band[i]->w, i++;
return qpixel(band[i], x, y);
}
@ -140,7 +140,7 @@ namespace spiral {
void precompute() {
CX = 0;
for(int i=0; i<size(band); i++) CX += band[i]->w;
for(int i=0; i<isize(band); i++) CX += band[i]->w;
if(CX == 0) { printf("ERROR: no CX\n"); return; }
CY = band[0]->h;
SX = out->w;
@ -297,7 +297,7 @@ namespace conformal {
void clear() {
on = false;
int N = size(v);
int N = isize(v);
for(int i=0; i<N; i++) delete v[i];
v.resize(0);
}
@ -326,7 +326,7 @@ namespace conformal {
reverse(v.begin(), v.end());
int Q = size(v)-1;
int Q = isize(v)-1;
// virtualRebase(v[0], false);
// virtualRebase(v[Q], false);
@ -369,7 +369,7 @@ namespace conformal {
void movetophase() {
int ph = int(phase);
int siz = size(v);
int siz = isize(v);
if(ph<0) ph = 0;
if(ph >= siz-1) ph = siz-2;
@ -394,7 +394,7 @@ namespace conformal {
phase += (t-llv) * lvspeed / 400.;
llv = t;
int siz = size(v);
int siz = isize(v);
while(phase > siz-1 + extra_line_steps) phase -= (siz + 2 * extra_line_steps-1);
while(phase < - extra_line_steps) phase += (siz + 2 * extra_line_steps-1);
@ -406,7 +406,7 @@ namespace conformal {
ld r = bandhalf * vid.scale;
ld tpixels = 0;
int siz = size(v);
int siz = isize(v);
for(int j=0; j<siz-1; j++) {
hyperpoint next =
@ -468,7 +468,7 @@ namespace conformal {
}
else {
int siz = size(v);
int siz = isize(v);
int bonus = ceil(extra_line_steps);
@ -551,7 +551,7 @@ namespace conformal {
if(dospiral) {
spiral::loop(bands);
for(int i=0; i<size(bands); i++) SDL_FreeSurface(bands[i]);
for(int i=0; i<isize(bands); i++) SDL_FreeSurface(bands[i]);
}
}
#endif
@ -825,17 +825,17 @@ namespace conformal {
void restore() {
sval++;
for(int i=0; i<size(movehistory); i++)
for(int i=0; i<isize(movehistory); i++)
movehistory[i]->aitmp = sval;
sval++;
int sk = size(killhistory);
int sk = isize(killhistory);
for(int i=0; i<sk; i++) {
eMonster m = killhistory[i].second;
killhistory[i].second = killhistory[i].first->monst;
killhistory[i].first->monst = m;
killhistory[i].first->aitmp = sval;
}
int si = size(findhistory);
int si = isize(findhistory);
for(int i=0; i<si; i++) {
eItem m = findhistory[i].second;
findhistory[i].second = findhistory[i].first->item;
@ -845,13 +845,13 @@ namespace conformal {
}
void restoreBack() {
int sk = size(killhistory);
int sk = isize(killhistory);
for(int i=sk-1; i>=0; i--) {
eMonster m = killhistory[i].second;
killhistory[i].second = killhistory[i].first->monst;
killhistory[i].first->monst = m;
}
int si = size(findhistory);
int si = isize(findhistory);
for(int i=si-1; i>=0; i--) {
eItem m = findhistory[i].second;
findhistory[i].second = findhistory[i].first->item;

View File

@ -863,7 +863,7 @@ bool haveMobileCompass() {
#else
if(forcetarget) return false;
#endif
return canmove && !shmup::on && vid.mobilecompasssize > 0 && size(screens) == 1;
return canmove && !shmup::on && vid.mobilecompasssize > 0 && isize(screens) == 1;
}
bool handleCompass() {

View File

@ -141,7 +141,7 @@ namespace dialog {
it.body = body;
it.scale = 100;
if(size(body) >= 500) it.scale = 70;
if(isize(body) >= 500) it.scale = 70;
items.push_back(it);
}
@ -220,7 +220,7 @@ namespace dialog {
else
xs = vid.xres * 618/1000, xo = vid.xres * 186/1000;
for(int i=0; i<=size(str); i++) {
for(int i=0; i<=isize(str); i++) {
int ls = 0;
int prev = last;
if(str[i] == ' ') lastspace = i;
@ -228,7 +228,7 @@ namespace dialog {
if(lastspace == last) ls = i-1, last = i-1;
else ls = lastspace, last = ls+1;
}
if(str[i] == 10 || i == size(str)) ls = i, last = i+1;
if(str[i] == 10 || i == isize(str)) ls = i, last = i+1;
if(ls) {
if(!measure) displayfr(xo, y, 2, siz, str.substr(prev, ls-prev), 0xC0C0C0, 0);
if(ls == prev) y += siz/2;
@ -372,19 +372,19 @@ namespace dialog {
void handleNavigation(int &sym, int &uni) {
#if !ISMOBILE
if(uni == '\n' || uni == '\r' || sym == SDLK_KP5)
for(int i=0; i<size(items); i++)
for(int i=0; i<isize(items); i++)
if(isitem(items[i]))
if(items[i].body == highlight_text) {
uni = sym = items[i].key;
return;
}
if(sym == SDLK_PAGEDOWN || sym == SDLK_KP3) {
for(int i=0; i<size(items); i++)
for(int i=0; i<isize(items); i++)
if(isitem(items[i]))
highlight_text = items[i].body;
}
if(sym == SDLK_PAGEUP || sym == SDLK_KP9) {
for(int i=0; i<size(items); i++)
for(int i=0; i<isize(items); i++)
if(isitem(items[i])) {
highlight_text = items[i].body;
break;
@ -392,11 +392,11 @@ namespace dialog {
}
if(sym == SDLK_UP || sym == SDLK_KP8) {
string last = "";
for(int i=0; i<size(items); i++)
for(int i=0; i<isize(items); i++)
if(isitem(items[i]))
last = items[i].body;
uni = sym = 0;
for(int i=0; i<size(items); i++)
for(int i=0; i<isize(items); i++)
if(isitem(items[i])) {
if(items[i].body == highlight_text) {
highlight_text = last; return;
@ -407,12 +407,12 @@ namespace dialog {
}
if(sym == SDLK_DOWN || sym == SDLK_KP2) {
int state = 0;
for(int i=0; i<size(items); i++)
for(int i=0; i<isize(items); i++)
if(isitem(items[i])) {
if(state) { highlight_text = items[i].body; return; }
else if(items[i].body == highlight_text) state = 1;
}
for(int i=0; i<size(items); i++)
for(int i=0; i<isize(items); i++)
if(isitem(items[i]))
highlight_text = items[i].body;
uni = sym = 0;
@ -690,7 +690,7 @@ namespace dialog {
if(ne.help != "") {
addHelp(ne.help);
// bool scal = !ISMOBILE && !ISPANDORA && size(ne.help) > 160;
// bool scal = !ISMOBILE && !ISPANDORA && isize(ne.help) > 160;
// if(scal) lastItem().scale = 30;
}
@ -728,7 +728,7 @@ namespace dialog {
affect('s');
}
else if(uni == '\b' || uni == '\t') {
ne.s = ne.s. substr(0, size(ne.s)-1);
ne.s = ne.s. substr(0, isize(ne.s)-1);
sscanf(ne.s.c_str(), LDF, ne.editwhat);
affect('s');
}
@ -930,7 +930,7 @@ namespace dialog {
struct dirent *dir;
string where = ".";
for(int i=0; i<size(cfile); i++)
for(int i=0; i<isize(cfile); i++)
if(cfile[i] == '/' || cfile[i] == '\\')
where = cfile.substr(0, i+1);
@ -939,7 +939,7 @@ namespace dialog {
while ((dir = readdir(d)) != NULL) {
string s = dir->d_name;
if(s != ".." && s[0] == '.') ;
else if(size(s) > 4 && s.substr(size(s)-4) == cfileext)
else if(isize(s) > 4 && s.substr(isize(s)-4) == cfileext)
v.push_back(make_pair(s, CFILE));
else if(dir->d_type & DT_DIR)
v.push_back(make_pair(s+"/", CDIR));
@ -964,7 +964,7 @@ namespace dialog {
void handleKeyFile(int uni, int sym) {
string& s(*cfileptr);
int i = size(s) - (editext?0:4);
int i = isize(s) - (editext?0:4);
if(sym == SDLK_ESCAPE) {
popScreen();
@ -983,9 +983,9 @@ namespace dialog {
else if(uni >= 32 && uni < 127) {
s.insert(i, s0 + char(uni));
}
else if(uni >= 1000 && uni <= 1000+size(v)) {
else if(uni >= 1000 && uni <= 1000+isize(v)) {
string where = "", what = s, whereparent = "../";
for(int i=0; i<size(s); i++)
for(int i=0; i<isize(s); i++)
if(s[i] == '/') {
if(i >= 2 && s.substr(i-2,3) == "../")
whereparent = s.substr(0, i+1) + "../";
@ -1020,7 +1020,7 @@ namespace dialog {
bool hasInfix(const string &s) {
if(infix == "") return true;
string t = "";
for(int i=0; i<size(s); i++) {
for(int i=0; i<isize(s); i++) {
char c = s[i];
char tt = 0;
if(c >= 'a' && c <= 'z') tt += c - 32;
@ -1034,7 +1034,7 @@ namespace dialog {
bool editInfix(int uni) {
if(uni >= 'A' && uni <= 'Z') infix += uni;
else if(uni >= 'a' && uni <= 'z') infix += uni-32;
else if(infix != "" && uni == 8) infix = infix.substr(0, size(infix)-1);
else if(infix != "" && uni == 8) infix = infix.substr(0, isize(infix)-1);
else if(infix != "" && uni != 0) infix = "";
else return false;
return true;

View File

@ -77,13 +77,13 @@ bool rawdisplaystr(int x, int y, int shift, int size, const char *str, int color
}
int textwidth(int siz, const string &str) {
if(size(str) == 0) return 0;
if(isize(str) == 0) return 0;
if(!font[siz]) font[siz] = TTF_OpenFont("VeraBd.ttf", siz);
int w, h;
TTF_SizeUTF8(font[siz], str.c_str(), &w, &h);
// printf("width = %d [%d]\n", w, size(str));
// printf("width = %d [%d]\n", w, isize(str));
return w;
}
@ -140,7 +140,7 @@ int main(int argc, char **argv) {
action = 0;
gdpos = 0;
while(gdpos < size(graphdata)) {
while(gdpos < isize(graphdata)) {
switch(gdpop()) {
case 2: {
int x = gdpop(), y = gdpop(), al = gdpop();

View File

@ -125,7 +125,7 @@ struct fpattern {
matrix strtomatrix(string s) {
matrix res = Id;
matrix m = Id;
for(int i=size(s)-1; i>=0; i--)
for(int i=isize(s)-1; i>=0; i--)
if(s[i] == 'R') res = mmul(R, res);
else if (s[i] == 'P') res = mmul(P, res);
else if (s[i] == 'x') { m[0][0] = -1; res = mmul(m, res); m[0][0] = +1; }
@ -137,7 +137,7 @@ struct fpattern {
void addas(const matrix& M, int i) {
if(!matcode.count(M)) {
matcode[M] = i;
for(int j=0; j<size(qcoords); j++)
for(int j=0; j<isize(qcoords); j++)
addas(mmul(M, qcoords[j]), i);
}
}
@ -146,7 +146,7 @@ struct fpattern {
if(!matcode.count(M)) {
int i = matrices.size();
matcode[M] = i, matrices.push_back(M);
for(int j=0; j<size(qcoords); j++)
for(int j=0; j<isize(qcoords); j++)
addas(mmul(M, qcoords[j]), i);
add(mmul(R, M));
}
@ -282,7 +282,7 @@ struct fpattern {
void build() {
for(int i=0; i<size(qpaths); i++) {
for(int i=0; i<isize(qpaths); i++) {
matrix M = strtomatrix(qpaths[i]);
qcoords.push_back(M);
printf("Solved %s as matrix of order %d\n", qpaths[i].c_str(), order(M));
@ -290,7 +290,7 @@ struct fpattern {
matcode.clear(); matrices.clear();
add(Id);
if(size(matrices) != S7) { printf("Error: rotation crash #1 (%d)\n", size(matrices)); exit(1); }
if(isize(matrices) != S7) { printf("Error: rotation crash #1 (%d)\n", isize(matrices)); exit(1); }
connections.clear();
@ -302,7 +302,7 @@ struct fpattern {
add(PM);
if(size(matrices) % S7) { printf("Error: rotation crash (%d)\n", size(matrices)); exit(1); }
if(isize(matrices) % S7) { printf("Error: rotation crash (%d)\n", isize(matrices)); exit(1); }
if(!matcode.count(PM)) { printf("Error: not marked\n"); exit(1); }
@ -310,7 +310,7 @@ struct fpattern {
}
DEBB(DF_FIELD, (debugfile, "Computing inverses...\n"));
int N = size(matrices);
int N = isize(matrices);
DEBB(DF_FIELD, (debugfile, "Number of heptagons: %d\n", N));
@ -334,7 +334,7 @@ struct fpattern {
for(int i=0; i<N; i++) if(gmul(i, inverses[i])) errs++;
if(errs) printf("errs = %d\n", errs);
if(0) for(int i=0; i<size(matrices); i++) {
if(0) for(int i=0; i<isize(matrices); i++) {
printf("%5d/%4d", connections[i], inverses[i]);
if(i%S7 == S7-1) printf("\n");
}
@ -541,7 +541,7 @@ struct fpattern {
int riverdist = dijkstra(nonbitrunc ? distflower : distriver, indist);
DEBB(DF_FIELD, (debugfile, "river dist = %d\n", riverdist));
for(int i=0; i<size(currfp.matrices); i++)
for(int i=0; i<isize(currfp.matrices); i++)
if(currfp.distflower[i] == 0) {
distflower0 = currfp.inverses[i]+1;
break;
@ -629,7 +629,7 @@ struct fpattern {
}
void findsubpath() {
int N = size(matrices);
int N = isize(matrices);
for(int i=1; i<N; i++)
if(gpow(i, Prime) == 0) {
subpathid = i;
@ -641,7 +641,7 @@ struct fpattern {
};
int fpattern::orderstats() {
int N = size(matrices);
int N = isize(matrices);
#define MAXORD 10000
int ordcount[MAXORD];
@ -686,7 +686,7 @@ void info() {
#ifndef EASY
printf("Not easy: %d\n", neasy);
#endif
int N = size(fp.matrices);
int N = isize(fp.matrices);
int left = N / fp.Prime;
printf("Prime decomposition: %d = %d", N, fp.Prime);
for(int p=2; p<=left; p++) while(left%p == 0) printf("*%d", p), left /= p;
@ -745,7 +745,7 @@ int current_extra = 0;
void nextPrime(fgeomextra& ex) {
dynamicval<eGeometry> g(geometry, ex.base);
int nextprime;
if(size(ex.primes))
if(isize(ex.primes))
nextprime = ex.primes.back().p + 1;
else
nextprime = 2;
@ -763,7 +763,7 @@ void nextPrime(fgeomextra& ex) {
}
void nextPrimes(fgeomextra& ex) {
while(size(ex.primes) < 4)
while(isize(ex.primes) < 4)
nextPrime(ex);
}

View File

@ -374,7 +374,7 @@ namespace gp {
i += 4;
}
if(i != size(m.v)) printf("warning: i=%d sm=%d\n", i, size(m.v));
if(i != isize(m.v)) printf("warning: i=%d sm=%d\n", i, isize(m.v));
if(just_matrices) return;
usedml[c0] = m;
@ -545,7 +545,7 @@ void draw_qfi(cell *c, const transmatrix& V, int col, int prio = -1, vector<hpcs
else if(!qfi.fshape) ;
#if CAP_TEXTURE
else if(qfi.tinf) {
queuetable(V * qfi.spin, qfi.tinf->vertices, size(qfi.tinf->vertices), texture::config.mesh_color, texture::config.recolor(col), prio == -1 ? PPR_FLOOR : prio);
queuetable(V * qfi.spin, qfi.tinf->vertices, isize(qfi.tinf->vertices), texture::config.mesh_color, texture::config.recolor(col), prio == -1 ? PPR_FLOOR : prio);
lastptd().u.poly.tinf = qfi.tinf;
if(gp::on)
lastptd().u.poly.flags = POLY_INVERSE;

132
game.cpp
View File

@ -282,7 +282,7 @@ eItem localTreasureType() {
void countLocalTreasure() {
eItem i = localTreasureType();
currentLocalTreasure = i ? items[i] : 0;
if(i != itHyperstone) for(int i=0; i<size(dcal); i++) {
if(i != itHyperstone) for(int i=0; i<isize(dcal); i++) {
cell *c2 = dcal[i];
if(c2->cpdist > 3) break;
eItem i2 = treasureType(c2->land);
@ -1102,7 +1102,7 @@ bool stalemate1::isKilled(cell *w) {
}
bool stalemate::isKilled(cell *w) {
for(int f=0; f<size(moves); f++)
for(int f=0; f<isize(moves); f++)
if(moves[f].isKilled(w)) return true;
return false;
@ -1162,17 +1162,17 @@ namespace stalemate {
bool nextturn;
bool isMoveto(cell *c) {
for(int i=0; i<size(moves); i++) if(moves[i].moveto == c) return true;
for(int i=0; i<isize(moves); i++) if(moves[i].moveto == c) return true;
return false;
}
bool isKilledDirectlyAt(cell *c) {
for(int i=0; i<size(moves); i++) if(moves[i].killed == c) return true;
for(int i=0; i<isize(moves); i++) if(moves[i].killed == c) return true;
return false;
}
bool isPushto(cell *c) {
for(int i=0; i<size(moves); i++) if(moves[i].pushto == c) return true;
for(int i=0; i<isize(moves); i++) if(moves[i].pushto == c) return true;
return false;
}
}
@ -1350,8 +1350,8 @@ bool monstersnear2() {
}
}
for(int i=0; i<size(stalemate::moves); i++)
for(int j=0; j<size(stalemate::moves); j++) if(i != j) {
for(int i=0; i<isize(stalemate::moves); i++)
for(int j=0; j<isize(stalemate::moves); j++) if(i != j) {
if(swordConflict(stalemate::moves[i], stalemate::moves[j])) {
b = true;
which = moEnergySword;
@ -1362,7 +1362,7 @@ bool monstersnear2() {
{ b = true; which = moAirball; }
}
for(int i=0; !b && i<size(stalemate::moves); i++)
for(int i=0; !b && i<isize(stalemate::moves); i++)
b = monstersnear(stalemate::moves[i]);
}
else b = !multimove();
@ -1562,7 +1562,7 @@ void spill(cell* c, eWall t, int rad) {
void degradeDemons() {
addMessage(XLAT("You feel more experienced in demon fighting!"));
int dcs = size(dcal);
int dcs = isize(dcal);
for(int i=0; i<dcs; i++) {
cell *c = dcal[i];
if(c->monst == moGreaterM || c->monst == moGreater)
@ -2237,7 +2237,7 @@ void killMonster(cell *c, eMonster who, flagtype deathflags) {
if(m == moAirElemental) {
airmap.clear();
for(int i=0; i<size(dcal); i++)
for(int i=0; i<isize(dcal); i++)
if(dcal[i]->monst == moAirElemental)
airmap.push_back(make_pair(dcal[i],0));
buildAirmap();
@ -2656,7 +2656,7 @@ void checkTide(cell *c) {
}
void buildAirmap() {
for(int k=0; k<size(airmap); k++) {
for(int k=0; k<isize(airmap); k++) {
int d = airmap[k].second;
if(d == 2) break;
cell *c = airmap[k].first;
@ -2704,7 +2704,7 @@ void buildRosemap() {
if((havewhat&HF_ROSE) && !rosephase) {
rosewave++;
for(int k=0; k<size(dcal); k++) {
for(int k=0; k<isize(dcal); k++) {
cell *c = dcal[k];
if(c->wall == waRose && c->cpdist <= gamerange() - 2)
rosemap[c] = rosewave * 8 + 2;
@ -2759,7 +2759,7 @@ void compute_graphical_distance() {
c1->pathdist = 0;
pathq.push_back(pd_from);
for(int qb=0; qb<size(pathq); qb++) {
for(int qb=0; qb<isize(pathq); qb++) {
cell *c = pathq[qb];
if(c->pathdist == pd_range) break;
if(qb == 0) forCellCM(c1, c) ;
@ -2777,17 +2777,17 @@ void computePathdist(eMonster param) {
pathqm.clear();
reachedfrom.clear();
for(int i=0; i<size(targets); i++) {
for(int i=0; i<isize(targets); i++) {
pathq.push_back(targets[i]);
targets[i]->pathdist = isPlayerOn(targets[i]) ? 0 : 1;
reachedfrom.push_back(hrand(targets[i]->type));
}
int qtarg = size(targets);
int qtarg = isize(targets);
int limit = gamerange();
for(int qb=0; qb < size(pathq); qb++) {
for(int qb=0; qb < isize(pathq); qb++) {
int fd = reachedfrom[qb] + 3;
cell *c = pathq[qb];
if(c->monst && !isBug(c) && !(isFriendly(c) && !c->stuntime)) {
@ -2829,7 +2829,7 @@ void computePathdist(eMonster param) {
vector<pair<cell*, int> > butterflies;
void addButterfly(cell *c) {
for(int i=0; i<size(butterflies); i++)
for(int i=0; i<isize(butterflies); i++)
if(butterflies[i].first == c) {
butterflies[i].second = 0;
return;
@ -2844,7 +2844,7 @@ void bfs() {
yendor::onpath();
int dcs = size(dcal);
int dcs = isize(dcal);
for(int i=0; i<dcs; i++) dcal[i]->cpdist = INFD;
worms.clear(); ivies.clear(); ghosts.clear(); golems.clear();
temps.clear(); tempval.clear(); targets.clear();
@ -2890,7 +2890,7 @@ void bfs() {
int qb = 0;
while(true) {
if(qb == size(dcal)) break;
if(qb == isize(dcal)) break;
int i, fd = reachedfrom[qb] + 3;
cell *c = dcal[qb++];
@ -3066,10 +3066,10 @@ void bfs() {
while(recalcTide) {
recalcTide = false;
for(int i=0; i<size(dcal); i++) checkTide(dcal[i]);
for(int i=0; i<isize(dcal); i++) checkTide(dcal[i]);
}
int qtemp = size(temps);
int qtemp = isize(temps);
for(int i=0; i<qtemp; i++) temps[i]->monst = tempval[i];
buildAirmap();
@ -3613,7 +3613,7 @@ bool wantsToStay(eMonster m) {
bool batsAfraid(cell *c) {
// bats
for(int i=-1; i<size(targets); i++)
for(int i=-1; i<isize(targets); i++)
if(c == targets[i] || isNeighbor(c, targets[i])) {
if(!targets[i]->monst && invismove) continue;
bool enear = false;
@ -4212,7 +4212,7 @@ void moveWorm(cell *c) {
c2 = c2->mov[c2->mondir];
}
allcells.push_back(c2);
for(int i=size(allcells)-2; i>=0; i--) {
for(int i=isize(allcells)-2; i>=0; i--) {
cell *cmt = allcells[i+1];
cell *cft = allcells[i];
if(cft->monst != moTentacleGhost && cmt->monst != moTentacleGhost)
@ -4378,9 +4378,9 @@ void removeIvy(cell *c) {
}
void moveivy() {
if(size(ivies) == 0) return;
if(isize(ivies) == 0) return;
computePathdist(moIvyRoot);
for(int i=0; i<size(ivies); i++) {
for(int i=0; i<isize(ivies); i++) {
cell *c = ivies[i];
cell *co = c;
if(c->monst != moIvyHead) continue;
@ -4549,7 +4549,7 @@ void groupmove2(cell *c, cell *from, int d, eMonster movtype, flagtype mf) {
}
c->aitmp = sval;
// MAXGCELL
if(size(gendfs) < 1000 || c->cpdist <= 6) gendfs.push_back(c);
if(isize(gendfs) < 1000 || c->cpdist <= 6) gendfs.push_back(c);
}
void groupmove(eMonster movtype, flagtype mf) {
@ -4559,7 +4559,7 @@ void groupmove(eMonster movtype, flagtype mf) {
if(mf & MF_MOUNT) {
if(dragon::target) gendfs.push_back(dragon::target);
if(movtype == moDragonHead) {
for(int i=0; i<size(dcal); i++) {
for(int i=0; i<isize(dcal); i++) {
cell *c = (i == 0 && dragon::target) ? dragon::target : dcal[i];
if(!c->monst) continue;
if(isFriendlyOrBug(c)) continue;
@ -4570,7 +4570,7 @@ void groupmove(eMonster movtype, flagtype mf) {
}
}
else {
if(!peace::on) for(int i=0; i<size(targets); i++) gendfs.push_back(targets[i]);
if(!peace::on) for(int i=0; i<isize(targets); i++) gendfs.push_back(targets[i]);
if(invisfish && (movtype == moSlime || movtype == moShark || movtype == moKrakenH)) for(int i=0; i<numplayers(); i++) {
cell *c = playerpos(i);
@ -4579,9 +4579,9 @@ void groupmove(eMonster movtype, flagtype mf) {
}
}
targetcount = size(gendfs);
targetcount = isize(gendfs);
for(int i=0; i<size(gendfs); i++) {
for(int i=0; i<isize(gendfs); i++) {
cell *c = gendfs[i];
int dirtable[10], qdirtable=0;
@ -4599,7 +4599,7 @@ void groupmove(eMonster movtype, flagtype mf) {
}
}
if(movtype != moDragonHead) for(int i=0; i<size(dcal); i++) {
if(movtype != moDragonHead) for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
if((mf & MF_ONLYEAGLE) && c->monst != moEagle && c->monst != moBat) return;
if(movegroup(c->monst) == movtype && !eq(c->aitmp, sval)) {
@ -4693,7 +4693,7 @@ void hexvisit(cell *c, cell *from, int d, bool mounted, int colorpair) {
c->aitmp = sval;
// MAXGCELL
if(size(hexdfs) < 2000 || c->cpdist <= 6)
if(isize(hexdfs) < 2000 || c->cpdist <= 6)
hexdfs.push_back(c);
}
@ -4707,13 +4707,13 @@ void movehex(bool mounted, int colorpair) {
dragon::target->aitmp = sval;
}
}
else for(int i=0; i<size(targets); i++) {
else for(int i=0; i<isize(targets); i++) {
hexdfs.push_back(targets[i]);
targets[i]->aitmp = sval;
}
//hexdfs.push_back(cwt.c);
for(int i=0; i<size(hexdfs); i++) {
for(int i=0; i<isize(hexdfs); i++) {
cell *c = hexdfs[i];
int dirtable[10], qdirtable=0;
for(int t=0; t<c->type; t++) if(c->mov[t] && inpair(c->mov[t], colorpair))
@ -4728,7 +4728,7 @@ void movehex(bool mounted, int colorpair) {
}
void movehex_rest(bool mounted) {
for(int i=0; i<size(hexsnakes); i++) {
for(int i=0; i<isize(hexsnakes); i++) {
cell *c = hexsnakes[i];
int colorpair;
if(c->monst == moHexSnake) {
@ -4766,13 +4766,13 @@ void movemutant() {
if(c->monst == moMutant && c->stuntime == mutantphase)
young.push_back(c);
for(int j=1; j<size(young); j++)
for(int j=1; j<isize(young); j++)
swap(young[j], young[hrand(j+1)]);
mutantphase++;
mutantphase &= 15;
for(int i=0; i<size(young); i++) {
for(int i=0; i<isize(young); i++) {
cell *c = young[i];
if(clearing::buggyplant) { if(c->monst == moMutant) c->monst=moNone; continue; }
for(int j=0; j<c->type; j++) {
@ -4842,7 +4842,7 @@ void moveghosts() {
if(invismove) return;
for(int d=0; d<8; d++) movesofgood[d].clear();
for(int i=0; i<size(ghosts); i++) {
for(int i=0; i<isize(ghosts); i++) {
cell *c = ghosts[i];
if(c->stuntime) return;
@ -4858,7 +4858,7 @@ void moveghosts() {
}
}
for(int d=0; d<8; d++) for(int i=0; i<size(movesofgood[d]); i++) {
for(int d=0; d<8; d++) for(int i=0; i<isize(movesofgood[d]); i++) {
cell *c = movesofgood[d][i];
if(c->stuntime) return;
@ -5200,7 +5200,7 @@ void movegolems(flagtype flags) {
flags |= AF_CRUSH;
computePathdist(moMouse);
int qg = 0;
for(int i=0; i<size(golems); i++) {
for(int i=0; i<isize(golems); i++) {
cell *c = golems[i];
eMonster m = c->monst;
if(c->stuntime) continue;
@ -5310,7 +5310,7 @@ int nearestPathPlayer(cell *c) {
// 2) to make sure that they move offscreen
void moveButterflies() {
int j = 0;
for(int i=0; i<size(butterflies); i++) {
for(int i=0; i<isize(butterflies); i++) {
cell* c = butterflies[i].first;
if(c->monst == moButterfly) {
/* // don't move if under attack of a bull
@ -5332,7 +5332,7 @@ void moveButterflies() {
// assume pathdist
void specialMoves() {
for(int i=0; i<size(dcal); i++) {
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
if(c->stuntime) continue;
@ -5351,7 +5351,7 @@ void specialMoves() {
addMessage(XLAT("%The1 wakes up %the2.", c2->monst, m));
wakeup = true;
}
for(int i=0; i<size(targets); i++) {
for(int i=0; i<isize(targets); i++) {
cell *t = targets[i];
if(celldistance(c, t) <= 2) wakeup = true;
}
@ -5412,7 +5412,7 @@ void specialMoves() {
addMessage(XLAT("Your brain is steaming."));
}
sagephase++;
for(int i=0; i<size(targets); i++) {
for(int i=0; i<isize(targets); i++) {
cell *t = targets[i];
if(celldistance(c, t) > 4) continue;
sageheat(t, .0);
@ -5428,7 +5428,7 @@ void specialMoves() {
bool dont_approach = false;
// smaller range on the sphere
int firerange = sphere ? 2 : 4;
for(int i=0; i<size(targets); i++) {
for(int i=0; i<isize(targets); i++) {
cell *t = targets[i];
if(celldistance(c,t) <= firerange && makeflame(t, 20, true)) {
if(isPlayerOn(t))
@ -5446,7 +5446,7 @@ void specialMoves() {
}
else if(m == moVampire) {
for(int i=0; i<size(targets); i++) {
for(int i=0; i<isize(targets); i++) {
cell *t = targets[i];
if(celldistance(c,t) <= 2) {
bool msg = false;
@ -5464,9 +5464,9 @@ void specialMoves() {
}
void moveworms() {
if(!size(worms)) return;
if(!isize(worms)) return;
computePathdist(moWorm);
int wrm = size(worms);
int wrm = isize(worms);
for(int i=0; i<wrm; i++) {
moveWorm(worms[i]);
}
@ -5482,7 +5482,7 @@ void refreshFriend(cell *c) {
}
void moverefresh(bool turn = true) {
int dcs = size(dcal);
int dcs = isize(dcal);
for(int i=0; i<dcs; i++) {
cell *c = dcal[i];
@ -5532,7 +5532,7 @@ void moverefresh(bool turn = true) {
}
}
else {
for(int i=0; i<size(targets); i++) {
for(int i=0; i<isize(targets); i++) {
cell *t = targets[i];
if(celldistance(c, t) <= breathrange && makeflame(t, 5, true)) {
if(isPlayerOn(t)) addMessage(XLAT("%The1 breathes fire at you!", subject));
@ -5732,16 +5732,16 @@ void moveNormals(eMonster param) {
for(int d=0; d<8; d++) movesofgood[d].clear();
for(int i=0; i<size(pathqm); i++)
for(int i=0; i<isize(pathqm); i++)
consMove(pathqm[i], param);
int dcs = size(dcal);
int dcs = isize(dcal);
for(int i=0; i<dcs; i++) {
cell *c = dcal[i];
if(c->pathdist == PINFD) consMove(c, param);
}
for(int d=0; d<8; d++) for(int i=0; i<size(movesofgood[d]); i++) {
for(int d=0; d<8; d++) for(int i=0; i<isize(movesofgood[d]); i++) {
cell *c = movesofgood[d][i];
if(normalMover(c->monst)) {
moveNormal(c, MF_PATHDIST);
@ -5991,7 +5991,7 @@ bool checkNeedMove(bool checkonly, bool attacking) {
}
int countMyGolems(eMonster m) {
int g=0, dcs = size(dcal);
int g=0, dcs = isize(dcal);
for(int i=0; i<dcs; i++) {
cell *c = dcal[i];
if(c->monst == m) g++;
@ -6000,7 +6000,7 @@ int countMyGolems(eMonster m) {
}
int savePrincesses() {
int g=0, dcs = size(dcal);
int g=0, dcs = isize(dcal);
for(int i=0; i<dcs; i++) {
cell *c = dcal[i];
if(isPrincess(c->monst)) princess::save(c);
@ -6009,7 +6009,7 @@ int savePrincesses() {
}
int countMyGolemsHP(eMonster m) {
int g=0, dcs = size(dcal);
int g=0, dcs = isize(dcal);
for(int i=0; i<dcs; i++) {
cell *c = dcal[i];
if(c->monst == m) g += c->hitpoints;
@ -6018,7 +6018,7 @@ int countMyGolemsHP(eMonster m) {
}
void restoreGolems(int qty, eMonster m, int hp = 0) {
int dcs = size(dcal);
int dcs = isize(dcal);
for(int i=1; qty && i<dcs; i++) {
cell *c = dcal[i];
if(m == moTameBomberbird ?
@ -6033,7 +6033,7 @@ void restoreGolems(int qty, eMonster m, int hp = 0) {
}
void placeItems(int qty, eItem it) {
int dcs = size(dcal);
int dcs = isize(dcal);
for(int i=1; qty && i<dcs; i++) {
cell *c = dcal[i];
if(!c->monst && !c->item && passable(c, NULL, 0))
@ -6228,7 +6228,7 @@ bool multiRevival(cell *on, cell *moveto) {
if(items[itOrbWinter]) fl |= P_WINTER;
if(passable(on, moveto, fl)) {
int id = multi::revive_queue[0];
for(int i=1; i<size(multi::revive_queue); i++)
for(int i=1; i<isize(multi::revive_queue); i++)
multi::revive_queue[i-1] = multi::revive_queue[i];
multi::revive_queue.pop_back();
multi::player[id].c = on;
@ -6537,7 +6537,7 @@ int ambush(cell *c, eItem what) {
clast = ccur; ccur = c2;
if(c2 == c0) break;
}
int N = size(around);
int N = isize(around);
int dogs = ambushSize(c, what);
int gaps = dogs;
@ -6708,7 +6708,7 @@ bool collectItem(cell *c2, bool telekinesis) {
}
else if(c2->item == itKey) {
playSound(c2, "pickup-key");
for(int i=0; i<size(yendor::yi); i++) if(yendor::yi[i].path[YDIST-1] == c2)
for(int i=0; i<isize(yendor::yi); i++) if(yendor::yi[i].path[YDIST-1] == c2)
yendor::yi[i].found = true;
items[itKey]++;
}
@ -7163,7 +7163,7 @@ void monstersTurn() {
if(phase2 && markOrb(itOrbEmpathy)) {
bfs();
movegolems(AF_FAST);
for(int i=0; i<size(dcal); i++) {
for(int i=0; i<isize(dcal); i++) {
if(dcal[i]->monst == moFriendlyGhost && dcal[i]->stuntime)
dcal[i]->stuntime--;
refreshFriend(dcal[i]);
@ -7287,7 +7287,7 @@ bool havePushConflict(cell *pushto, bool checkonly) {
addMessage(XLAT("Cannot push into another player!"));
return true;
}
for(int i=0; i<size(stalemate::moves); i++) {
for(int i=0; i<isize(stalemate::moves); i++) {
if(pushto == stalemate::moves[i].pushto) {
if(!checkonly)
addMessage(XLAT("Cannot push into the same location!"));
@ -7926,16 +7926,16 @@ bool movepcto(int d, int subdir, bool checkonly) {
void moveItem1(cell *from, cell *to, bool activateYendor) {
if(from->item == itOrbYendor) {
bool xnew = true;
for(int i=0; i<size(yendor::yi); i++)
for(int i=0; i<isize(yendor::yi); i++)
if(yendor::yi[i].path[0] == from) xnew = false;
if(xnew && activateYendor) yendor::check(from);
for(int i=0; i<size(yendor::yi); i++)
for(int i=0; i<isize(yendor::yi); i++)
if(yendor::yi[i].path[0] == from)
yendor::yi[i].path[0] = to;
}
if(from->item == itKey) {
for(int i=0; i<size(yendor::yi); i++) if(yendor::yi[i].path[YDIST-1] == from)
for(int i=0; i<isize(yendor::yi); i++) if(yendor::yi[i].path[YDIST-1] == from)
yendor::yi[i].path[YDIST-1] = to;
}

View File

@ -39,17 +39,17 @@ void showQuotientConfig() {
gamescreen(2);
dialog::init(XLAT("advanced configuration"));
fgeomextra& gxcur = fgeomextras[current_extra];
for(int i=0; i<size(fgeomextras); i++) {
for(int i=0; i<isize(fgeomextras); i++) {
auto& g = fgeomextras[i];
dialog::addBoolItem(XLAT(ginf[g.base].name), g.base == gxcur.base, 'a'+i);
}
nextPrimes(gxcur);
for(int i=0; i<size(gxcur.primes); i++) {
for(int i=0; i<isize(gxcur.primes); i++) {
auto& p = gxcur.primes[i];
dialog::addBoolItem(XLAT("order %1%2 (non-bitruncated cells: %3)", its(p.p), p.squared ? "²" : "", its(p.cells)), i == gxcur.current_prime_id, 'A'+i);
}
if(size(gxcur.primes) < 6) {
if(isize(gxcur.primes) < 6) {
dialog::addBreak(100);
dialog::addHelp(
"This geometry is obtained by applying the same 'generators' which "
@ -66,9 +66,9 @@ void showQuotientConfig() {
dialog::addItem("default", 'c');
keyhandler = [&gxcur] (int sym, int uni) {
if(uni >= 'a' && uni < 'a' + size(fgeomextras))
if(uni >= 'a' && uni < 'a' + isize(fgeomextras))
current_extra = uni - 'a';
else if(uni >= 'A' && uni < 'A' + size(gxcur.primes))
else if(uni >= 'A' && uni < 'A' + isize(gxcur.primes))
gxcur.current_prime_id = uni - 'A';
else if(uni == 'p')
nextPrime(gxcur);
@ -174,7 +174,7 @@ void showTorusConfig() {
keyhandler = [=] (int sym, int uni) {
if(uni == 'm') {
int i = torusconfig::newmode + 1;
if(i >= size(torusconfig::tmodes)) i = 0;
if(i >= isize(torusconfig::tmodes)) i = 0;
torusconfig::newmode = torusconfig::eTorusMode(i);
}
else if(uni == 'n' && single)
@ -315,7 +315,7 @@ void showEuclideanMenu() {
break;
case gFieldQuotient:
worldsize = size(currfp.matrices) / ts;
worldsize = isize(currfp.matrices) / ts;
worldsize = worldsize * (2*tv + ts * gar) / tv / 2;
break;
@ -439,7 +439,7 @@ void showEuclideanMenu() {
stable_sort(landlist.begin(), landlist.end(), [] (eLand l1, eLand l2) { return land_validity(l1).quality_level > land_validity(l2).quality_level; });
for(int i=0; i<euperpage; i++) {
if(euperpage * eupage + i >= size(landlist)) { dialog::addBreak(100); break; }
if(euperpage * eupage + i >= isize(landlist)) { dialog::addBreak(100); break; }
eLand l = landlist[euperpage * eupage + i];
char ch;
if(i < 26) ch = 'a' + i;
@ -482,7 +482,7 @@ void showEuclideanMenu() {
ewhichscreen ^= 3;
else if(uni == '-' || uni == PSEUDOKEY_WHEELUP || uni == PSEUDOKEY_WHEELDOWN) {
eupage++;
if(eupage * euperpage >= size(landlist)) eupage = 0;
if(eupage * euperpage >= isize(landlist)) eupage = 0;
}
else if(uni == '1') {
if(chaosUnlocked) {
@ -490,7 +490,7 @@ void showEuclideanMenu() {
start_game();
}
}
else if(lid >= 0 && lid < size(landlist)) {
else if(lid >= 0 && lid < isize(landlist)) {
eLand nland = landlist[lid];
if(landvisited[nland]) {
firstland = specialland = nland;

View File

@ -634,8 +634,8 @@ bool drawItemType(eItem it, cell *c, const transmatrix& V, int icol, int ticks,
}
else if(it == itPalace) {
if(ct6 >= size(shMFloor3.b)) ct6 = 0;
if(ct6 >= size(shMFloor3.b)) return false;
if(ct6 >= isize(shMFloor3.b)) ct6 = 0;
if(ct6 >= isize(shMFloor3.b)) return false;
transmatrix V2 = V * spin(ticks / 1500.);
queuepoly(V2, shMFloor3.b[ct6], 0xFFD500FF);
queuepoly(V2, shMFloor4.b[ct6], darkena(icol, 0, 0xFF));
@ -1790,7 +1790,7 @@ int last_wormsegment = -1;
vector<vector< std::function<void()> > > wormsegments;
void add_segment(int d, const std::function<void()>& s) {
if(size(wormsegments) <= d) wormsegments.resize(d+1);
if(isize(wormsegments) <= d) wormsegments.resize(d+1);
last_wormsegment = max(last_wormsegment, d);
wormsegments[d].push_back(s);
}
@ -2324,7 +2324,7 @@ void drawaura() {
glhr::id_modelview();
glhr::prepare(auravertices);
glhr::set_depthtest(false);
glDrawArrays(GL_TRIANGLES, 0, size(auravertices));
glDrawArrays(GL_TRIANGLES, 0, isize(auravertices));
setcameraangle(false);
@ -2524,13 +2524,13 @@ void set_emeraldfloor(cell *c) {
double fanframe;
void viewBuggyCells(cell *c, transmatrix V) {
for(int i=0; i<size(buggycells); i++)
for(int i=0; i<isize(buggycells); i++)
if(c == buggycells[i]) {
queuepoly(V, shPirateX, 0xC000C080);
return;
}
for(int i=0; i<size(buggycells); i++) {
for(int i=0; i<isize(buggycells); i++) {
cell *c1 = buggycells[i];
cell *cf = cwt.c;
@ -3203,7 +3203,7 @@ void pushdown(cell *c, int& q, const transmatrix &V, double down, bool rezoom, b
// since we might be changing priorities, we have to make sure that we are sorting correctly
if(down > 0 && repriority) {
int qq = q+1;
while(qq < size(ptds))
while(qq < isize(ptds))
if(qq > q && ptds[qq].prio < ptds[qq-1].prio) {
swap(ptds[qq], ptds[qq-1]);
qq--;
@ -3211,7 +3211,7 @@ void pushdown(cell *c, int& q, const transmatrix &V, double down, bool rezoom, b
else qq++;
}
while(q < size(ptds)) {
while(q < isize(ptds)) {
polytodraw& ptd = ptds[q++];
if(ptd.kind == pkPoly) {
@ -4535,7 +4535,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
}
if(chasmg) {
int q = size(ptds);
int q = isize(ptds);
int maxtime = euclid || sphere ? 20000 : 1500;
if(fallanims.count(c)) {
fallanim& fa = fallanims[c];
@ -4608,7 +4608,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
if(true) {
int q = ptds.size();
error |= drawMonster(V, ctype, c, moncol);
if(Vboat != &V && Vboat != &Vboat0 && q != size(ptds))
if(Vboat != &V && Vboat != &Vboat0 && q != isize(ptds))
pushdown(c, q, V, -geom3::factor_to_lev(zlevel(tC0((*Vboat)))),
!isMultitile(c->monst), false);
}
@ -4912,7 +4912,7 @@ void drawMarkers() {
{
using namespace yendor;
if(yii < size(yi) && !yi[yii].found) {
if(yii < isize(yi) && !yi[yii].found) {
cell *keycell = NULL;
int i;
for(i=0; i<YDIST; i++)
@ -5011,12 +5011,12 @@ void drawMarkers() {
}
void drawFlashes() {
for(int k=0; k<size(flashes); k++) {
for(int k=0; k<isize(flashes); k++) {
flashdata& f = flashes[k];
transmatrix V;
if(f.spd) try { V = gmatrix.at(f.where); } catch(out_of_range&) {
f = flashes[size(flashes)-1];
f = flashes[isize(flashes)-1];
flashes.pop_back(); k--;
continue;
}
@ -5064,7 +5064,7 @@ void drawFlashes() {
}
if(kill) {
f = flashes[size(flashes)-1];
f = flashes[isize(flashes)-1];
flashes.pop_back(); k--;
}
}
@ -5468,7 +5468,7 @@ void drawfullmap() {
polygonal::drawBoundary(darkena(0xFF, 0, 0xFF));
/* if(vid.wallmode < 2 && !euclid && !patterns::whichShape) {
int ls = size(lines);
int ls = isize(lines);
if(ISMOBILE) ls /= 10;
for(int t=0; t<ls; t++) queueline(View * lines[t].P1, View * lines[t].P2, lines[t].col >> (darken+1));
} */
@ -5632,7 +5632,7 @@ void drawscreen() {
cmode = 0;
keyhandler = [] (int sym, int uni) { return false; };
if(!size(screens)) pushScreen(normalscreen);
if(!isize(screens)) pushScreen(normalscreen);
screens.back()();
#if !ISMOBILE
@ -5814,7 +5814,7 @@ void indAnimateMovement(cell *src, cell *tgt, int layer, int direction_hint) {
}
void commitAnimations(int layer) {
for(int i=0; i<size(animstack); i++)
for(int i=0; i<isize(animstack); i++)
animations[layer][animstack[i].first] = animstack[i].second;
animstack.clear();
}

View File

@ -444,7 +444,7 @@ string generateHelpForWall(eWall w) {
}
void buteol(string& s, int current, int req) {
int siz = size(s);
int siz = isize(s);
if(s[siz-1] == '\n') s.resize(siz-1);
char buf[100]; sprintf(buf, " (%d/%d)", current, req);
s += buf; s += "\n";

View File

@ -85,7 +85,7 @@ void updatesort() {
void preparesort() {
for(int i=0; i<glyphs; i++) glyphorder[i] = i;
for(int i=0; i<size(land_over); i++) {
for(int i=0; i<isize(land_over); i++) {
eLand l = land_over[i];
ikland[treasureType(l)] = i+1;
for(int mi=0; mi<motypes; mi++)
@ -346,7 +346,7 @@ void drawStats() {
int qty[64];
vector<cell*>& ac = currentmap->allcells();
for(int i=0; i<64; i++) qty[i] = 0;
for(int i=0; i<size(ac); i++) {
for(int i=0; i<isize(ac); i++) {
int d = celldistance(ac[i], cwt.c);
if(d >= 0 && d < 64) qty[d]++;
}
@ -429,7 +429,7 @@ void drawStats() {
for(int u=vid.fsize; u<vid.xres/2-s; u += s)
for(int v=vid.fsize; v<vid.yres/2-s; v += s)
if(hypot(vid.xres/2-u-s, vid.yres/2-v-s) > rad) {
if(next >= size(glyphstoshow)) break;
if(next >= isize(glyphstoshow)) break;
int cx = u;
int cy = v + s/2;

23
hyper.h
View File

@ -422,7 +422,8 @@ string cts(char c);
string its(int i);
int hrand(int i);
template<class T> int size(const T& x) {return x.size(); }
// size casted to int, to prevent warnings and actual errors caused by the unsignedness of x.size()
template<class T> int isize(const T& x) {return x.size(); }
// initialize the achievement system.
void achievement_init();
@ -862,7 +863,7 @@ extern vector< function<void()> > screens;
template<class T> void pushScreen(const T& x) { screens.push_back(x); }
inline void popScreen() { screens.pop_back(); }
inline void popScreenAll() { while(size(screens)>1) popScreen(); }
inline void popScreenAll() { while(isize(screens)>1) popScreen(); }
extern transmatrix View; // current rotation, relative to viewctr
extern transmatrix cwtV; // player-relative view
@ -2558,8 +2559,8 @@ struct celllister {
dists.push_back(d);
}
~celllister() {
for(int i=0; i<size(lst); i++) lst[i]->aitmp = tmps[i];
~celllister() {
for(int i=0; i<isize(lst); i++) lst[i]->aitmp = tmps[i];
}
celllister(cell *orig, int maxdist, int maxcount, cell *breakon) {
@ -2569,27 +2570,27 @@ struct celllister {
sval++;
add(orig, 0);
cell *last = orig;
for(int i=0; i<size(lst); i++) {
for(int i=0; i<isize(lst); i++) {
cell *c = lst[i];
if(maxdist) forCellCM(c2, c) {
add(c2, dists[i]+1);
if(c2 == breakon) return;
}
if(c == last) {
if(size(lst) >= maxcount || dists[i]+1 == maxdist) break;
last = lst[size(lst)-1];
if(isize(lst) >= maxcount || dists[i]+1 == maxdist) break;
last = lst[isize(lst)-1];
}
}
}
void prepare() {
for(int i=0; i<size(lst); i++) lst[i]->aitmp = i;
for(int i=0; i<isize(lst); i++) lst[i]->aitmp = i;
}
int getdist(cell *c) { return dists[c->aitmp]; }
bool listed(cell *c) {
return c->aitmp >= 0 && c->aitmp < size(lst) && lst[c->aitmp] == c;
return c->aitmp >= 0 && c->aitmp < isize(lst) && lst[c->aitmp] == c;
}
};
@ -2906,7 +2907,7 @@ void destroycellcontents(cell *c);
extern heptagon *last_cleared;
template<class T, class U> void eliminate_if(vector<T>& data, U pred) {
for(int i=0; i<size(data); i++)
for(int i=0; i<isize(data); i++)
if(pred(data[i]))
data[i] = data.back(), data.pop_back(), i--;
}
@ -3233,7 +3234,7 @@ template<> struct saver<char> : dsaver<char> {
template<> struct saver<bool> : dsaver<bool> {
saver<bool>(bool& val) : dsaver<bool>(val) { }
string save() { return val ? "yes" : "no"; }
void load(const string& s) { val = size(s) && s[0] == 'y'; }
void load(const string& s) { val = isize(s) && s[0] == 'y'; }
};
template<> struct saver<unsigned> : dsaver<unsigned> {

View File

@ -88,10 +88,10 @@ Java_com_roguetemple_hyperroid_HyperRogue_loadMap
LOCK(NULL, "loadMap")
jintArray result;
result = env->NewIntArray(size(graphdata));
result = env->NewIntArray(isize(graphdata));
if(result == NULL) return NULL;
env->SetIntArrayRegion(result, 0, size(graphdata), &*graphdata.begin());
env->SetIntArrayRegion(result, 0, isize(graphdata), &*graphdata.begin());
// delref;
// env->DeleteLocalRef(result);
// if(debfile) fprintf(debfile, "loadmap finished.\n"), fflush(debfile);
@ -379,7 +379,7 @@ void uploadAll(JNIEnv *env, jobject thiz) {
orientation_requested = false;
}
for(int i=0; i<size(soundsToPlay); i++) {
for(int i=0; i<isize(soundsToPlay); i++) {
jmethodID mid = env->GetMethodID(cls, "playSound", "(Ljava/lang/String;I)V");
jobject str = env->NewStringUTF(soundsToPlay[i].first.c_str());
env->CallVoidMethod(thiz, mid, str, soundsToPlay[i].second);

View File

@ -170,13 +170,13 @@ void emscripten_get_commandline() {
string s = str;
#endif
s += "+xxxxxx";
for(int i=0; i<size(s); i++) if(s[i] == '?') {
for(int i=0; i<isize(s); i++) if(s[i] == '?') {
#ifndef EMSCRIPTEN_FIXED_ARG
printf("HREF: %s\n", str);
#endif
arg::argument.push_back("hyperweb"); arg::lshift();
string next = ""; i += 3;
for(; i<size(s); i++) {
for(; i<isize(s); i++) {
if(s[i] == '+') {
arg::argument.push_back(next);
next = "";

View File

@ -131,7 +131,7 @@ void handleclick(MOBPAR_FORMAL) {
if(buttonclicked || mouseout()) {
bool statkeys = andmode == 0 && !shmup::on && size(screens) == 1;
bool statkeys = andmode == 0 && !shmup::on && isize(screens) == 1;
if(statkeys && getcstat == 'g') {
movepcto(MD_DROP);
@ -156,7 +156,7 @@ void handleclick(MOBPAR_FORMAL) {
int px = mousex < vid.xcenter ? 0 : 1;
int py = mousey < vid.ycenter ? 0 : 1;
if(size(screens) == 1) {
if(isize(screens) == 1) {
if(px == 0 && py == 1) {
if(andmode == 0 && shmup::on) ;
else andmode = 10;
@ -188,7 +188,7 @@ void handleclick(MOBPAR_FORMAL) {
}
}
if(andmode == 0 && size(screens) == 1 && !mouseout()) {
if(andmode == 0 && isize(screens) == 1 && !mouseout()) {
bool forcetarget = longclick;
@ -237,7 +237,7 @@ void mobile_draw(MOBPAR_FORMAL) {
if(playermoved && vid.sspeed > -4.99)
centerpc(tdiff / 1000.0 * exp(vid.sspeed));
if(shmup::on && (andmode == 0 || andmode == 10) && size(screens) == 1)
if(shmup::on && (andmode == 0 || andmode == 10) && isize(screens) == 1)
shmup::turn(tdiff);
safety = false;
@ -302,7 +302,7 @@ void mobile_draw(MOBPAR_FORMAL) {
shiftmul = getcshift;
calcMousedest();
inmenu = size(screens) > 1;
inmenu = isize(screens) > 1;
if(lclicked && !clicked && !inmenu) handleclick(MOBPAR_ACTUAL);
@ -346,7 +346,7 @@ void mobile_draw(MOBPAR_FORMAL) {
}
}
if(andmode == 2 && size(screens) != 1) andmode = 12;
if(andmode == 2 && isize(screens) != 1) andmode = 12;
if((cmode & sm::NORMAL) && getcstat == '-')
getcstat = 0;

View File

@ -198,7 +198,7 @@ namespace hr { namespace inv {
}
void gainRandomOrbs(vector<eItem> orblist, eItem which, int each, int reduce) {
const int qoff = size(orblist);
const int qoff = isize(orblist);
for(int i=1; i<qoff; i++) swap(orblist[i], orblist[irand(1+i)]);
for(int i=0; i<20; i++) {
int nextat = (i+1)*each + reduce;

View File

@ -63,9 +63,9 @@ bool reptilecheat = false;
vector<cell*> noescape_list;
bool blizzard_no_escape1(cell *c) {
if(c->aitmp >= 0 && c->aitmp < size(noescape_list) && noescape_list[c->aitmp] == c)
if(c->aitmp >= 0 && c->aitmp < isize(noescape_list) && noescape_list[c->aitmp] == c)
return true;
c->aitmp = size(noescape_list); noescape_list.push_back(c);
c->aitmp = isize(noescape_list); noescape_list.push_back(c);
if(c->item == itOrbSafety)
return false;
forCellEx(c2, c) {
@ -784,8 +784,8 @@ void giantLandSwitch(cell *c, int d, cell *from) {
// printf("dragon generated with dchance = %d\n", dchance);
vector<int> possi;
for(int t=0; t<c->type; t++) if(c->mov[t]->mpdist > c->mpdist) possi.push_back(t);
if(size(possi)) {
int i = possi[hrand(size(possi))];
if(isize(possi)) {
int i = possi[hrand(isize(possi))];
int dragonlength = 6 + items[itDragon] / 2;
c->monst = moDragonHead; c->hitpoints = 1;
preventbarriers(c);
@ -806,8 +806,8 @@ void giantLandSwitch(cell *c, int d, cell *from) {
i = j + 2 + hrand(c2->type-3);
i %= c2->type;
}
if(size(dragon) < 5 || size(dragon) < dragonlength / 2) {
for(int i=0; i<size(dragon); i++)
if(isize(dragon) < 5 || isize(dragon) < dragonlength / 2) {
for(int i=0; i<isize(dragon); i++)
dragon[i]->monst = moNone;
}
else c2->mondir = NODIR;
@ -1640,8 +1640,8 @@ void giantLandSwitch(cell *c, int d, cell *from) {
vector<int> gooddir;
for(int t=0; t<c->type; t++) if(c->mov[t]->mpdist > c->mpdist)
gooddir.push_back(t);
if(size(gooddir))
generateSnake(c, gooddir[hrand(size(gooddir))], 2);
if(isize(gooddir))
generateSnake(c, gooddir[hrand(isize(gooddir))], 2);
}
else if(hrand(10000) < items[itSnake] - 10 + yendor::hardness() && !c->monst && !c->wall && !peace::on) {
c->monst = pick(moRedTroll, moMiner, moSkeleton, moBomberbird);
@ -1790,9 +1790,9 @@ void giantLandSwitch(cell *c, int d, cell *from) {
if(cw1.c->mpdist > 7)
next.emplace_back(cw0.c, cw1.c);
}
if(size(next)) {
if(isize(next)) {
c->item = itHunting;
auto& p = next[hrand(size(next))];
auto& p = next[hrand(isize(next))];
p.first->monst = moHunterGuard;
p.second->monst = moHunterGuard;
}
@ -1800,17 +1800,17 @@ void giantLandSwitch(cell *c, int d, cell *from) {
else if(items[itHunting] < 10) {
vector<cell*> next;
forCellEx(c2, c) if(c2->mpdist > 7 && (nonbitrunc || !ctof(c2))) next.push_back(c2);
if(size(next)) {
if(isize(next)) {
c->item = itHunting;
cell *c3 = next[hrand(size(next))];
cell *c3 = next[hrand(isize(next))];
vector<cell*> dogcells;
forCellEx(c4, c3) if(c4->mpdist > 7 && !isNeighbor(c4, c))
dogcells.push_back(c4);
if(items[itHunting] < 10 && size(dogcells) >= 2) {
if(items[itHunting] < 10 && isize(dogcells) >= 2) {
for(int t=0;; t++) {
if(t == 50) { c->item = itNone; break; }
cell *dog1 = dogcells[hrand(size(dogcells))];
cell *dog2 = dogcells[hrand(size(dogcells))];
cell *dog1 = dogcells[hrand(isize(dogcells))];
cell *dog2 = dogcells[hrand(isize(dogcells))];
if(isNeighbor(dog1, dog2)) {
dog1->monst = moHunterGuard;
dog1->landparam = 0;
@ -1820,9 +1820,9 @@ void giantLandSwitch(cell *c, int d, cell *from) {
}
}
}
else if(size(dogcells)) {
else if(isize(dogcells)) {
c->item = itHunting;
dogcells[hrand(size(dogcells))]->monst = moHunterGuard;
dogcells[hrand(isize(dogcells))]->monst = moHunterGuard;
}
}
}

View File

@ -671,7 +671,7 @@ bool lchance(eLand l) {
eLand pickLandRPM(eLand old) {
while(true) {
eLand n = randlands[hrand(size(randlands))];
eLand n = randlands[hrand(isize(randlands))];
if(incompatible(n, old)) continue;
if(landUnlockedRPM(n)) return n;
}

View File

@ -19,7 +19,7 @@ using std::map;
using std::vector;
using std::set;
template<class T> int size(const T& x) { return x.size(); }
template<class T> int isize(const T& x) { return x.size(); }
#define NUMLAN 7
@ -58,7 +58,7 @@ int utfsize(char c) {
void addutftoset(set<string>& s, string& w) {
int i = 0;
//printf("%s\n", w.c_str());
while(i < size(w)) {
while(i < isize(w)) {
int siz = utfsize(w[i]);
s.insert(w.substr(i, siz));
i += siz;
@ -105,7 +105,7 @@ hashcode langhash(const string& s) {
return langhash(s.substr(0, s.size() - 9)) + 1;
}
hashcode r = 0;
for(int i=0; i<size(s); i++) r = hashval * r + s[i];
for(int i=0; i<isize(s); i++) r = hashval * r + s[i];
return r;
}
@ -123,7 +123,7 @@ const char *escape(string s, string dft) {
}
static string t;
t = "\"";
for(int i=0; i<size(s); i++)
for(int i=0; i<isize(s); i++)
if(s[i] == '\\') t += "\\\\";
else if(s[i] == '\n') t += "\\n";
else if(s[i] == '\"') t += "\\\"";
@ -301,7 +301,7 @@ int main() {
//printf("ALL:");
for(set<string>::iterator it = allchars.begin(); it != allchars.end(); it++) {
// printf(" \"%s\",", it->c_str());
if(size(*it) >= 2) { javastring += (*it); vchars.push_back(*it); c++; }
if(isize(*it) >= 2) { javastring += (*it); vchars.push_back(*it); c++; }
}
printf("\n");
printf("#define NUMEXTRA %d\n", c);
@ -328,20 +328,20 @@ int main() {
nouns[0][it->first] = n;
}
printf("// total: %5d nouns, %5d sentences\n", int(nouns[1].m.size()), int(d[1].m.size()));
printf("// total: %5d nouns, %5d sentences\n", isize(nouns[1].m), isize(d[1].m));
for(int i=0; i<NUMLAN; i++) {
int bnouns = 0;
int dict = 0;
for(map<string, string>::iterator it = d[i].m.begin(); it != d[i].m.end(); it++)
dict += it->second.size();
dict += isize(it->second);
for(map<string, noun>::iterator it = nouns[i].m.begin(); it != nouns[i].m.end(); it++) {
noun& n = it->second;
bnouns += n.nom.size();
bnouns += n.nomp.size();
bnouns += n.acc.size();
bnouns += n.abl.size();
bnouns += isize(n.nom);
bnouns += isize(n.nomp);
bnouns += isize(n.acc);
bnouns += isize(n.abl);
}
printf("// %s: %5dB nouns, %5dB sentences\n",
@ -364,7 +364,7 @@ int main() {
ms = buildHashTable(allsent);
mn = buildHashTable(allnouns);
}
while(size(ms) != size(allsent) || size(mn) != size(allnouns));
while(isize(ms) != isize(allsent) || isize(mn) != isize(allnouns));
printf("hashcode hashval = 0x%x;\n\n", hashval);

View File

@ -76,7 +76,7 @@ const char* natchars[NUMEXTRA] = {"°","é","á", "ᵈ", "δ", "½", "∞"};
hashcode langhash(const string& s) {
hashcode r = 0;
for(int i=0; i<size(s); i++) r = hashval * r + s[i];
for(int i=0; i<isize(s); i++) r = hashval * r + s[i];
return r;
}

View File

@ -84,7 +84,7 @@ namespace mapstream {
void addToQueue(cell* c) {
if(cellids.count(c)) return;
int numcells = size(cellbyid);
int numcells = isize(cellbyid);
cellbyid.push_back(c);
cellids[c] = numcells;
}
@ -133,7 +133,7 @@ namespace mapstream {
}
}
addToQueue((bounded || euclid) ? currentmap->gamestart() : cwt.c->master->c7);
for(int i=0; i<size(cellbyid); i++) {
for(int i=0; i<isize(cellbyid); i++) {
cell *c = cellbyid[i];
if(i) {
for(int j=0; j<c->type; j++) if(c->mov[j] && cellids.count(c->mov[j]) &&
@ -161,7 +161,7 @@ namespace mapstream {
if(c2 && c2->land != laNone) addToQueue(c2);
}
}
printf("cells saved = %d\n", size(cellbyid));
printf("cells saved = %d\n", isize(cellbyid));
int32_t n = -1; save(n);
int32_t id = cellids.count(cwt.c) ? cellids[cwt.c] : -1;
save(id);
@ -170,13 +170,13 @@ namespace mapstream {
usershape *us = usershapes[i][j];
if(!us) continue;
for(int l=0; l<USERLAYERS; l++) if(size(us->d[l].list)) {
for(int l=0; l<USERLAYERS; l++) if(isize(us->d[l].list)) {
usershapelayer& ds(us->d[l]);
save(i); save(j); save(l); save(ds.sym); save(ds.rots); save(ds.color);
n = size(ds.list); save(n);
n = isize(ds.list); save(n);
savePoint(ds.shift);
savePoint(ds.spin);
for(int i=0; i<size(ds.list); i++) savePoint(ds.list[i]);
for(int i=0; i<isize(ds.list); i++) savePoint(ds.list[i]);
}
}
n = -1; save(n);
@ -236,14 +236,14 @@ namespace mapstream {
cell *c;
int rspin;
if(size(cellbyid) == 0) {
if(isize(cellbyid) == 0) {
c = currentmap->gamestart();
rspin = 0;
}
else {
int32_t parent = loadInt();
if(parent<0 || parent >= size(cellbyid)) break;
if(parent<0 || parent >= isize(cellbyid)) break;
int dir = loadChar();
cell *c2 = cellbyid[parent];
dir = fixspin(dir, relspin[parent], c2->type);
@ -282,18 +282,18 @@ namespace mapstream {
}
int32_t whereami = loadInt();
if(whereami >= 0 && whereami < size(cellbyid))
if(whereami >= 0 && whereami < isize(cellbyid))
cwt.c = cellbyid[whereami];
else cwt.c = currentmap->gamestart();
for(int i=0; i<size(cellbyid); i++) {
for(int i=0; i<isize(cellbyid); i++) {
cell *c = cellbyid[i];
if(c->bardir != NODIR && c->bardir != NOBARRIERS)
extendBarrier(c);
}
for(int d=BARLEV-1; d>=0; d--)
for(int i=0; i<size(cellbyid); i++) {
for(int i=0; i<isize(cellbyid); i++) {
cell *c = cellbyid[i];
if(c->mpdist <= d)
for(int j=0; j<c->type; j++) {
@ -426,17 +426,17 @@ namespace mapeditor {
undo.push_back(u);
}
undo_info& lastUndo() { return undo[size(undo)-1]; }
undo_info& lastUndo() { return undo[isize(undo)-1]; }
void undoLock() {
if(!size(undo) || lastUndo().c) {
if(!isize(undo) || lastUndo().c) {
undo_info i; i.c = NULL; undo.push_back(i);
}
}
void applyUndo() {
while(size(undo) && !lastUndo().c) undo.pop_back();
while(size(undo)) {
while(isize(undo) && !lastUndo().c) undo.pop_back();
while(isize(undo)) {
undo_info& i(lastUndo());
if(!i.c) break;
i.c->wall = i.w;
@ -451,7 +451,7 @@ namespace mapeditor {
}
void checkUndo() {
if(checkEq(undo[size(undo)-1])) undo.pop_back();
if(checkEq(undo[isize(undo)-1])) undo.pop_back();
}
int itc(int k) {
@ -624,9 +624,9 @@ namespace mapeditor {
spill_list.clear(); sval++;
spill_list.emplace_back(tgt, src);
int crad = 0, nextstepat = 0;
for(int i=0; i<size(spill_list); i++) {
for(int i=0; i<isize(spill_list); i++) {
if(i == nextstepat) {
crad++; nextstepat = size(spill_list);
crad++; nextstepat = isize(spill_list);
if(crad > radius) break;
}
auto sd = spill_list[i];
@ -696,7 +696,7 @@ namespace mapeditor {
where.c->aitmp = sval;
int at = 0;
while(at < size(v)) {
while(at < isize(v)) {
cell *c2 = v[at];
at++;
@ -773,7 +773,7 @@ namespace mapeditor {
keyhandler = [] (int sym, int uni) {
if(uni >= '1' && uni <= '9') uni = 1000 + uni - '1';
if(sym == SDLK_RETURN || sym == SDLK_KP_ENTER || sym == '-' || sym == SDLK_KP_MINUS) uni = 1000;
for(int z=0; z<size(dialog::v); z++) if(1000 + z == uni) {
for(int z=0; z<isize(dialog::v); z++) if(1000 + z == uni) {
paintwhat = dialog::v[z].second;
paintwhat_str = dialog::v[z].first;
mousepressed = false;
@ -1022,12 +1022,12 @@ namespace mapeditor {
displayButton(8, 8+fs*3, XLAT("l = layers: %1", its(dslayer)), 'l', 0);
}
if(us && size(us->d[dslayer].list)) {
if(us && isize(us->d[dslayer].list)) {
usershapelayer& ds(us->d[dslayer]);
displayButton(8, 8+fs*4, XLAT("1-9 = rotations: %1", its(ds.rots)), '1' + (ds.rots % 9), 0);
displayButton(8, 8+fs*5, XLAT(ds.sym ? "0 = symmetry" : "0 = asymmetry"), '0', 0);
displayfr(8, 8+fs*7, 2, vid.fsize, XLAT("%1 vertices", its(size(ds.list))), 0xC0C0C0, 0);
displayfr(8, 8+fs*7, 2, vid.fsize, XLAT("%1 vertices", its(isize(ds.list))), 0xC0C0C0, 0);
displaymm('a', 8, 8+fs*8, 2, vid.fsize, XLAT("a = add v"), 0);
if(autochoose) {
displaymm('m', 8, 8+fs*9, 2, vid.fsize, XLAT("m = move v"), 0);
@ -1060,7 +1060,7 @@ namespace mapeditor {
displaymm('d', 8, 8+fs*7, 2, vid.fsize, XLAT("d = draw"), 0);
displaymm('l', 8, 8+fs*8, 2, vid.fsize, XLAT("l = line"), 0);
displaymm('c', 8, 8+fs*9, 2, vid.fsize, XLAT("c = circle"), 0);
int s = size(texture::config.data.pixels_to_draw);
int s = isize(texture::config.data.pixels_to_draw);
if(s) displaymm(0, 8, 8+fs*11, 2, vid.fsize, its(s), 0);
}
#endif
@ -1129,7 +1129,7 @@ namespace mapeditor {
initShape(sg, id);
for(int i=0; i<size(ptds); i++) {
for(int i=0; i<isize(ptds); i++) {
auto& ptd = ptds[i];
if(ptd.kind != pkPoly) continue;
@ -1192,8 +1192,8 @@ namespace mapeditor {
mh = spin(2*M_PI*-ew.rotid/dsCur->rots) * mh;
if(ew.symid) mh = Mirror * mh;
if(ew.pointid < 0 || ew.pointid >= size(dsCur->list))
ew.pointid = size(dsCur->list)-1, ew.side = 1;
if(ew.pointid < 0 || ew.pointid >= isize(dsCur->list))
ew.pointid = isize(dsCur->list)-1, ew.side = 1;
dsCur->list.insert(dsCur->list.begin()+ew.pointid+(ew.side?1:0), mh);
if(ew.side) ew.pointid++;
@ -1209,7 +1209,7 @@ namespace mapeditor {
int i = ew.pointid;
if(i < 0 || i >= size(dsCur->list)) return;
if(i < 0 || i >= isize(dsCur->list)) return;
mh = spin(2*M_PI*-ew.rotid/dsCur->rots) * mh;
if(ew.symid) mh = Mirror * mh;
@ -1374,14 +1374,14 @@ namespace mapeditor {
usershape *us = usershapes[i][j];
if(!us) continue;
for(int l=0; l<USERLAYERS; l++) if(size(us->d[l].list)) {
for(int l=0; l<USERLAYERS; l++) if(isize(us->d[l].list)) {
usershapelayer& ds(us->d[l]);
fprintf(f, "\n%d %d %d %d %d %6x %d\n",
i, j, l, ds.sym, ds.rots, ds.color, int(size(ds.list)));
i, j, l, ds.sym, ds.rots, ds.color, int(isize(ds.list)));
writeHyperpoint(f, ds.shift);
writeHyperpoint(f, ds.spin);
fprintf(f,"\n");
for(int i=0; i<size(ds.list); i++)
for(int i=0; i<isize(ds.list); i++)
writeHyperpoint(f, ds.list[i]);
}
}
@ -1554,11 +1554,11 @@ namespace mapeditor {
usershape *us = usershapes[i][j];
if(!us) continue;
for(int l=0; l<USERLAYERS; l++) if(size(us->d[l].list)) {
for(int l=0; l<USERLAYERS; l++) if(isize(us->d[l].list)) {
usershapelayer& ds(us->d[l]);
printf("// %d %d %d [%06X]\n", i, j, l, ds.color);
printf(" ID, %d, %d, ", us->d[l].rots, us->d[l].sym?2:1);
for(int i=0; i<size(us->d[l].list); i++)
for(int i=0; i<isize(us->d[l].list); i++)
printf("%lf,%lf, ", double(us->d[l].list[i][0]), double(us->d[l].list[i][1]));
printf("\n");
}
@ -1692,14 +1692,14 @@ namespace mapeditor {
if(mapeditor::editingShape(group, id)) {
/* for(int a=0; a<size(ds.list); a++) {
/* for(int a=0; a<isize(ds.list); a++) {
hyperpoint P2 = V * ds.list[a];
int xc, yc, sc;
getcoord(P2, xc, yc, sc);
queuechr(xc, yc, sc, 10, 'x',
a == 0 ? 0x00FF00 :
a == size(ds.list)-1 ? 0xFF0000 :
a == isize(ds.list)-1 ? 0xFF0000 :
0xFFFF00);
} */
@ -1721,9 +1721,9 @@ namespace mapeditor {
queuechr(P2, 10, 'x', 0xFF00FF);
}
if(size(ds.list) == 0) return us;
if(isize(ds.list) == 0) return us;
hyperpoint Plast = V * spin(-2*M_PI/ds.rots) * (ds.sym?Mirror*ds.list[0]:ds.list[size(ds.list)-1]);
hyperpoint Plast = V * spin(-2*M_PI/ds.rots) * (ds.sym?Mirror*ds.list[0]:ds.list[isize(ds.list)-1]);
int state = 0;
int gstate = 0;
double dist2 = 0;
@ -1736,8 +1736,8 @@ namespace mapeditor {
if(ew.symid) mh2 = Mirror * mh2;
hyperpoint pseudomouse = V * spin(2*M_PI*a/ds.rots) * mirrorif(mh2, b);
for(int t=0; t<size(ds.list); t++) {
int ti = b ? size(ds.list)-1-t : t;
for(int t=0; t<isize(ds.list); t++) {
int ti = b ? isize(ds.list)-1-t : t;
hyperpoint P2 = V * spin(2*M_PI*a/ds.rots) * mirrorif(ds.list[ti], b);

View File

@ -53,7 +53,7 @@ void showOverview() {
landlist = filtered;
}
int nl = size(landlist), nlm;
int nl = isize(landlist), nlm;
int lstart = 0;
@ -878,11 +878,11 @@ void showMessageLog() {
DEBB(DF_GRAPH, (debugfile,"show message log\n"));
int lines = vid.yres / vid.fsize - 2;
int maxpos = size(gamelog) - lines;
int maxpos = isize(gamelog) - lines;
messagelogpos = min(messagelogpos, maxpos);
messagelogpos = max(messagelogpos, 0);
for(int y=0; y<lines && messagelogpos+y < size(gamelog); y++) {
for(int y=0; y<lines && messagelogpos+y < isize(gamelog); y++) {
msginfo& m = gamelog[messagelogpos+y];
displaystr(vid.fsize*8, vid.fsize*(y+1), 0, vid.fsize, fullmsg(m), 0xC0C0C0, 0);
displaystr(vid.fsize*7, vid.fsize*(y+1), 0, vid.fsize, gettimestamp(m), 0xC0C0C0, 16);

View File

@ -245,7 +245,7 @@ bool canReachPlayer(cell *cf, eMonster m) {
vector<cell*> v;
sval++;
v.push_back(cf); cf->aitmp = sval;
for(int i=0; i<size(v); i++) {
for(int i=0; i<isize(v); i++) {
cell *c = v[i];
for(int j=0; j<c->type; j++) {
cell *c2 = c->mov[j];
@ -261,7 +261,7 @@ bool canReachPlayer(cell *cf, eMonster m) {
bool haveOrbPower() {
for(int i=0; i<ittypes; i++) if(itemclass(eItem(i)) == IC_ORB && items[i]) return true;
if(quotient) for(int i=0; i<size(dcal); i++) {
if(quotient) for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
if(itemclass(c->item) == IC_ORB) return true;
}
@ -319,8 +319,8 @@ void wandering() {
if(smallbounded_generation) {
int maxdist = 0;
for(int i=0; i<size(dcal); i++) if(dcal[i]->cpdist > maxdist) maxdist = dcal[i]->cpdist;
for(int i=0; i<size(dcal); i++) if(dcal[i]->cpdist >= maxdist-1) { first7 = i; break; }
for(int i=0; i<isize(dcal); i++) if(dcal[i]->cpdist > maxdist) maxdist = dcal[i]->cpdist;
for(int i=0; i<isize(dcal); i++) if(dcal[i]->cpdist >= maxdist-1) { first7 = i; break; }
if(hrand(5) == 0) {
// spawn treasure
@ -328,7 +328,7 @@ void wandering() {
if(smallbounded && hrand(100) < 2) {
auto& ac = currentmap->allcells();
cell *c1 = ac[hrand(size(ac))];
cell *c1 = ac[hrand(isize(ac))];
if(c1->wall == waVinePlant && !c1->monst) {
c1->monst = moVineSpirit;
c1->stuntime = 3;
@ -336,15 +336,15 @@ void wandering() {
}
}
while(first7 < size(dcal)) {
int i = first7 + hrand(size(dcal) - first7);
while(first7 < isize(dcal)) {
int i = first7 + hrand(isize(dcal) - first7);
cell *c = dcal[i];
if(inmirror(c)) continue;
if(specialland == laStorms) {
// place the sandstone wall completely randomly (but not on the player)
vector<cell*>& ac = currentmap->allcells();
c = ac[hrand(size(ac))];
c = ac[hrand(isize(ac))];
if(isPlayerOn(c)) continue;
}
@ -510,7 +510,7 @@ void wandering() {
else if(c->land == laBull && wchance(items[itBull], 40))
c->monst = moGadfly;
else if(items[itBull] >= 50 && size(butterflies) && wchance(items[itBull]-49, 25))
else if(items[itBull] >= 50 && isize(butterflies) && wchance(items[itBull]-49, 25))
c->monst = moGadfly;
else if(c->land == laPrairie && cwt.c->LHU.fi.flowerdist > 3 && wchance(items[itGreenGrass], prairie::isriver(cwt.c) ? 150 : 40))
@ -698,12 +698,12 @@ void generateSnake(cell *c, int i, int color) {
{for(int i=0; i<c2->type; i++)
if(inpair(c2->mov[i], cpair))
goodsteps.push_back(i);}
if(!size(goodsteps)) break;
i = goodsteps[hrand(size(goodsteps))];
if(!isize(goodsteps)) break;
i = goodsteps[hrand(isize(goodsteps))];
}
}
if(size(rocksnake) < ROCKSNAKELENGTH/2 && !nonbitrunc) {
for(int i=0; i<size(rocksnake); i++)
if(isize(rocksnake) < ROCKSNAKELENGTH/2 && !nonbitrunc) {
for(int i=0; i<isize(rocksnake); i++)
rocksnake[i]->monst = moNone;
}
else c2->mondir = NODIR;

View File

@ -225,7 +225,7 @@ void flashCell(cell *c, eMonster killer, flagtype flags) {
void activateFlashFrom(cell *cf, eMonster who, flagtype flags) {
drawFlash(cf);
playSound(cf, "storm");
for(int i=0; i<size(dcal); i++) {
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
if(c == cf) continue;
for(int t=0; t<c->type; t++)
@ -252,7 +252,7 @@ void checkFreedom(cell *cf) {
avcells.clear();
avcells.push_back(cf);
cf->aitmp = sval;
for(int i=0; i<size(avcells); i++) {
for(int i=0; i<isize(avcells); i++) {
cell *c = avcells[i];
if(c->cpdist >= 5) return;
for(int i=0; i<c->type; i++) {
@ -276,7 +276,7 @@ void checkFreedom(cell *cf) {
drainOrb(itOrbFreedom);
for(int i=0; i<numplayers(); i++)
drawBigFlash(playerpos(i));
for(int i=0; i<size(dcal); i++) {
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
if(c == cf && !shmup::on) continue;
if(c->cpdist > 5) break;
@ -293,7 +293,7 @@ void activateFlash() {
addMessage(XLAT("You activate the Flash spell!"));
playSound(cwt.c, "storm");
drainOrb(itOrbFlash);
for(int i=0; i<size(dcal); i++) {
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
if(c->cpdist > 2) break;
flashCell(c, moPlayer, AF_MAGIC);
@ -481,7 +481,7 @@ void activateLightning() {
drawLightning();
addMessage(XLAT("You activate the Lightning spell!"));
for(int i=0; i<size(dcal); i++) if(dcal[i]) dcal[i]->ligon = 0;
for(int i=0; i<isize(dcal); i++) if(dcal[i]) dcal[i]->ligon = 0;
drainOrb(itOrbLightning);
@ -503,7 +503,7 @@ void activateLightning() {
bool haveRangedTarget() {
if(!haveRangedOrb())
return false;
for(int i=0; i<size(dcal); i++) {
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
if(targetRangedOrb(c, roCheck)) {
return true;
@ -900,7 +900,7 @@ void poly_attack(cell *dest) {
moNarciss, moJiangshi
};
int ssf = 0;
eMonster target = *(polymonsters.begin() + hrand(size(polymonsters)));
eMonster target = *(polymonsters.begin() + hrand(isize(polymonsters)));
for(eMonster m: polymonsters)
if(kills[m] && m != dest->monst) {
ssf += kills[m];

View File

@ -407,11 +407,11 @@ int getHemisphere(cell *c, int which) {
ct = -ct;
}
while(cw.c != currentmap->gamestart());
for(int i=0; i<size(q); i++)
for(int i=0; i<isize(q); i++)
forCellCM(c2, q[i])
if(pseudohept(q[i]) || pseudohept(c2))
visit(c2, type[i]);
for(int i=0; i<size(q); i++) if(q[i] == c) return type[i];
for(int i=0; i<isize(q); i++) if(q[i] == c) return type[i];
return 0;
}
if(ctof(c)) {
@ -1627,7 +1627,7 @@ namespace patterns {
gamescreen(0);
}
dialog::init();
for(int i=0; i<size(cpatterns); i++) {
for(int i=0; i<isize(cpatterns); i++) {
dialog::addBoolItem(XLAT(cpatterns[i].name), cgroup == i, '0'+i);
#if CAP_TEXTURE
if(texture::config.tstate == texture::tsActive && !compatible(texture::cgroup, (cpatterntype) i))
@ -1635,8 +1635,8 @@ namespace patterns {
#endif
}
dialog::addBreak(100);
if(cgroup != cpUnknown && cgroup < size(cpatterns))
for(int j=0; j<size(cpatterns[cgroup].geometries); j++) {
if(cgroup != cpUnknown && cgroup < isize(cpatterns))
for(int j=0; j<isize(cpatterns[cgroup].geometries); j++) {
auto &g = cpatterns[cgroup].geometries[j];
string s = XLAT(ginf[g.geo].name);
s += bitruncnames[g.nonbitru];
@ -1663,9 +1663,9 @@ namespace patterns {
keyhandler = [have_goldberg] (int sym, int uni) {
if(uni == 'r')
pushScreen(showPattern);
else if(uni >= '0' && uni < '0' + size(cpatterns))
else if(uni >= '0' && uni < '0' + isize(cpatterns))
cgroup = cpatterntype(uni - '0');
else if(cgroup != cpUnknown && uni >= 'a' && uni < 'a' + size(cpatterns[cgroup].geometries)) {
else if(cgroup != cpUnknown && uni >= 'a' && uni < 'a' + isize(cpatterns[cgroup].geometries)) {
#if CAP_TEXTURE
auto old_tstate = texture::config.tstate;
auto old_tstate_max = texture::config.tstate_max;
@ -1690,8 +1690,8 @@ namespace patterns {
void computeCgroup() {
cgroup = cpUnknown;
for(int i=0; i<size(cpatterns); i++)
for(int j=0; j<size(cpatterns[i].geometries); j++) {
for(int i=0; i<isize(cpatterns); i++)
for(int j=0; j<isize(cpatterns[i].geometries); j++) {
auto &g = cpatterns[i].geometries[j];
bool xnonbitrunc = gp::on ? gp_threecolor() : nonbitrunc;
if(geometry == g.geo && xnonbitrunc == g.nonbitru && whichPattern == g.whichPattern && subpattern_flags == g.subpattern_flags)

View File

@ -61,9 +61,9 @@ hpcshape *last = NULL;
vector<polytodraw> ptds;
polytodraw& lastptd() { return ptds[size(ptds)-1]; }
polytodraw& lastptd() { return ptds[isize(ptds)-1]; }
polytodraw& nextptd() { ptds.resize(size(ptds)+1); return lastptd(); }
polytodraw& nextptd() { ptds.resize(isize(ptds)+1); return lastptd(); }
bool ptdsort(const polytodraw& p1, const polytodraw& p2) {
return p1.prio < p2.prio;
@ -84,7 +84,7 @@ void hpcpush(hyperpoint h) {
bool validsidepar[SIDEPARS];
void chasmifyPoly(double fac, double fac2, int k) {
for(int i=size(hpc)-1; i >= last->s; i--) {
for(int i=isize(hpc)-1; i >= last->s; i--) {
hyperpoint H;
for(int j=0; j<3; j++) {
H[j] = hpc[i][j] * fac;
@ -124,11 +124,11 @@ void initPolyForGL() {
}
void extra_vertices() {
while(size(ourshape) < size(hpc))
ourshape.push_back(glhr::pointtogl(hpc[size(ourshape)]));
while(isize(ourshape) < isize(hpc))
ourshape.push_back(glhr::pointtogl(hpc[isize(ourshape)]));
glhr::store_in_buffer(ourshape);
glhr::current_vertices = NULL;
prehpc = size(hpc);
prehpc = isize(hpc);
}
#endif
@ -173,7 +173,7 @@ void addpoint(const hyperpoint& H) {
}
void coords_to_poly() {
polyi = size(glcoords);
polyi = isize(glcoords);
for(int i=0; i<polyi; i++) {
// printf("%lf %lf\n", double(glcoords[i][0]), double(glcoords[i][1]));
if(!stereo::active()) glcoords[i][2] = 0;
@ -401,7 +401,7 @@ void fixMercator(bool tinf) {
mercator_period = 2 * vid.radius;
if(pmodel == mdSinusoidal)
for(int i = 0; i<size(glcoords); i++)
for(int i = 0; i<isize(glcoords); i++)
glcoords[i][mercator_coord] /= cos(glcoords[i][1] / vid.radius * M_PI);
ld hperiod = mercator_period / 2;
@ -415,7 +415,7 @@ void fixMercator(bool tinf) {
if(pmodel == mdBandEquiarea)
dmin = -vid.radius / M_PI, dmax = vid.radius / M_PI;
for(int i = 0; i<size(glcoords); i++) {
for(int i = 0; i<isize(glcoords); i++) {
while(glcoords[0][mercator_coord] < hperiod) glcoords[0][mercator_coord] += mercator_period;
while(glcoords[0][mercator_coord] > hperiod) glcoords[0][mercator_coord] -= mercator_period;
}
@ -425,7 +425,7 @@ void fixMercator(bool tinf) {
ld mincoord = first, maxcoord = first;
for(int i = 0; i<size(glcoords); i++) {
for(int i = 0; i<isize(glcoords); i++) {
while(glcoords[i][mercator_coord] < next - hperiod)
glcoords[i][mercator_coord] += mercator_period;
while(glcoords[i][mercator_coord] > next + hperiod)
@ -450,7 +450,7 @@ void fixMercator(bool tinf) {
while(maxcoord < cmax)
mercator_loop_max++, maxcoord += mercator_period;
if(pmodel == mdSinusoidal)
for(int i = 0; i<size(glcoords); i++)
for(int i = 0; i<isize(glcoords); i++)
glcoords[i][mercator_coord] *= cos(glcoords[i][1] / vid.radius * M_PI);
}
else {
@ -463,26 +463,26 @@ void fixMercator(bool tinf) {
swap(first, last);
}
while(maxcoord > cmin) {
for(int i=0; i<size(glcoords); i++) glcoords[i][mercator_coord] -= mercator_period;
for(int i=0; i<isize(glcoords); i++) glcoords[i][mercator_coord] -= mercator_period;
first -= mercator_period; last -= mercator_period;
mincoord -= mercator_period; maxcoord -= mercator_period;
}
int base = size(glcoords);
int base = isize(glcoords);
int minto = mincoord;
while(minto < cmax) {
for(int i=0; i<base; i++) {
glcoords.push_back(glcoords[size(glcoords)-base]);
glcoords.push_back(glcoords[isize(glcoords)-base]);
glcoords.back()[mercator_coord] += mercator_period;
}
minto += mercator_period;
}
if(pmodel == mdSinusoidal)
for(int i = 0; i<size(glcoords); i++)
for(int i = 0; i<isize(glcoords); i++)
glcoords[i][mercator_coord] *= cos(glcoords[i][1] / vid.radius * M_PI);
glcoords.push_back(glcoords.back());
glcoords.push_back(glcoords[0]);
for(int u=1; u<=2; u++) {
auto& v = glcoords[size(glcoords)-u][1-mercator_coord];
auto& v = glcoords[isize(glcoords)-u][1-mercator_coord];
v = v < 0 ? dmin : dmax;
}
/* printf("cycling %d -> %d\n", base, qglcoords);
@ -547,7 +547,7 @@ void drawpolyline(polytodraw& p) {
int best = -1;
ld bhypot = 1e60;
for(int j0=0; j0<MAX_PHASE; j0++)
if(size(phases[j0]) == i) {
if(isize(phases[j0]) == i) {
ld chypot = glhypot2(phases[j0].back(), h);
if(chypot < bhypot || best == -1) bhypot = chypot, best = j0;
}
@ -597,7 +597,7 @@ void drawpolyline(polytodraw& p) {
dynamicval<int> d3(pp.offset, 0);
dynamicval<decltype(pp.tab)> d4(pp.tab, pp.tab);
for(int j=0; j<pha; j++) {
dynamicval<int> d5(pp.cnt, size(phases[j]));
dynamicval<int> d5(pp.cnt, isize(phases[j]));
pp.tab = &phases[j];
drawpolyline(p);
}
@ -651,7 +651,7 @@ void drawpolyline(polytodraw& p) {
if((spherespecial > 0 || (sphere && equi)) && !(poly_flags & POLY_ISSIDE)) {
double rarea = 0;
for(int i=0; i<size(glcoords)-1; i++)
for(int i=0; i<isize(glcoords)-1; i++)
rarea += glcoords[i][0] * glcoords[i+1][1] - glcoords[i][1] * glcoords[i+1][0];
rarea += glcoords.back()[0] * glcoords[0][1] - glcoords.back()[1] * glcoords[0][0];
@ -675,7 +675,7 @@ void drawpolyline(polytodraw& p) {
for(int l=mercator_loop_min; l <= mercator_loop_max; l++) {
if(l || lastl) {
for(int i=0; i<size(glcoords); i++) {
for(int i=0; i<isize(glcoords); i++) {
if(pmodel == mdSinusoidal)
mercator_period = 2 * vid.radius * cos(glcoords[i][1] / vid.radius * M_PI);
glcoords[i][mercator_coord] += mercator_period * (l - lastl);
@ -714,11 +714,11 @@ void drawpolyline(polytodraw& p) {
for(int i=0; i<pp.cnt; i++)
tv.push_back(pp.tinf->tvertices[pp.offset+i]);
swap(pp.tinf->tvertices, tv);
gldraw(3, Id, glcoords, 0, size(glcoords), p.col, pp.outline, poly_flags, pp.tinf);
gldraw(3, Id, glcoords, 0, isize(glcoords), p.col, pp.outline, poly_flags, pp.tinf);
swap(pp.tinf->tvertices, tv);
}
else
gldraw(3, Id, glcoords, 0, size(glcoords), nofill ? 0 : p.col, pp.outline, poly_flags, nofill ? NULL : pp.tinf);
gldraw(3, Id, glcoords, 0, isize(glcoords), nofill ? 0 : p.col, pp.outline, poly_flags, nofill ? NULL : pp.tinf);
continue;
}
#endif
@ -806,7 +806,7 @@ void prettyline(hyperpoint h1, hyperpoint h2, int col, int lev) {
pp.V = Id;
pp.tab = &prettylinepoints;
pp.offset = 0;
pp.cnt = size(prettylinepoints);
pp.cnt = isize(prettylinepoints);
pp.minwidth = vid.linewidth;
p.col = 0;
pp.outline = col;
@ -818,14 +818,14 @@ void prettyline(hyperpoint h1, hyperpoint h2, int col, int lev) {
void prettypoly(const vector<hyperpoint>& t, int fillcol, int linecol, int lev) {
prettylinepoints.clear();
prettypoint(t[0]);
for(int i=0; i<size(t); i++)
for(int i=0; i<isize(t); i++)
prettylinesub(t[i], t[(i+1)%3], lev);
polytodraw p;
auto& pp = p.u.poly;
pp.V = Id;
pp.tab = &prettylinepoints;
pp.offset = 0;
pp.cnt = size(prettylinepoints);
pp.cnt = isize(prettylinepoints);
pp.minwidth = minwidth_global;
p.col = fillcol;
pp.outline = linecol;
@ -901,7 +901,7 @@ void initquickqueue() {
}
void sortquickqueue() {
for(int i=1; i<size(ptds);)
for(int i=1; i<isize(ptds);)
if(i && ptds[i].prio < ptds[i-1].prio) {
swap(ptds[i], ptds[i-1]);
i--;
@ -911,7 +911,7 @@ void sortquickqueue() {
void quickqueue() {
spherespecial = 0;
int siz = size(ptds);
int siz = isize(ptds);
setcameraangle(false);
for(int i=0; i<siz; i++) drawqueueitem(ptds[i]);
}
@ -928,7 +928,7 @@ purehookset hook_drawqueue;
void drawqueue() {
callhooks(hook_drawqueue);
int siz = size(ptds);
int siz = isize(ptds);
setcameraangle(true);
@ -1220,7 +1220,7 @@ hyperpoint turtlevertex(int u, double x, double y, double z) {
vector<hpcshape*> allshapes;
void finishshape() {
last->e = size(hpc);
last->e = isize(hpc);
double area = 0;
for(int i=last->s; i<last->e-1; i++)
area += hpc[i][0] * hpc[i+1][1] - hpc[i+1][0] * hpc[i][1];
@ -1257,7 +1257,7 @@ void bshape(hpcshape& sh, int p) {
if(last) finishshape();
hpc.push_back(hpxy(0,0));
last = &sh;
last->s = size(hpc), last->prio = p;
last->s = isize(hpc), last->prio = p;
last->flags = 0;
first = true;
}
@ -1275,7 +1275,7 @@ void bshape(hpcshape& sh, int p, double shzoom, int shapeid, double bonus = 0, f
while(polydata[whereis] != NEWSHAPE || polydata[whereis+1] != shapeid) whereis++;
int rots = polydata[whereis+2]; int sym = polydata[whereis+3];
array<int,3> arr;
arr[0] = size(hpc); arr[1] = rots; arr[2] = sym;
arr[0] = isize(hpc); arr[1] = rots; arr[2] = sym;
symmetriesAt.emplace_back(arr);
whereis += 4;
int qty = 0;
@ -1333,7 +1333,7 @@ void bshape(hpcshape& sh, int p, double shzoom, int shapeid, double bonus = 0, f
}
void copyshape(hpcshape& sh, hpcshape& orig, int p) {
if(last) last->e = size(hpc);
if(last) last->e = isize(hpc);
sh = orig; sh.prio = p;
}
@ -1362,13 +1362,13 @@ void pushShape(const usershapelayer& ds) {
transmatrix T = rgpushxto0(ds.shift) * rspintox(ds.spin);
for(int r=0; r<ds.rots; r++) {
for(int i=0; i<size(ds.list); i++)
for(int i=0; i<isize(ds.list); i++)
hpcpush(T * spin(2*M_PI*r/ds.rots) * ds.list[i]);
if(ds.sym) {
transmatrix mirrortrans = Id; mirrortrans[1][1] = -1;
for(int i=size(ds.list)-1; i>=0; i--)
for(int i=isize(ds.list)-1; i>=0; i--)
hpcpush(T * spin(2*M_PI*r/ds.rots) * mirrortrans * ds.list[i]);
}
}
@ -2207,7 +2207,7 @@ void buildpolys() {
bshapeend();
prehpc = size(hpc);
prehpc = isize(hpc);
DEBB(DF_INIT, (debugfile,"hpc = %d\n", prehpc));
for(int i=0; i<USERSHAPEGROUPS; i++) for(int j=0; j<USERSHAPEIDS; j++) {
@ -2221,10 +2221,10 @@ void buildpolys() {
}
static int qhpc0;
int qhpc = size(hpc);
int qhpc = isize(hpc);
if(qhpc != qhpc0 && debug_geometry) {
printf("qhpc = %d (%d+%d)\n", qhpc0 = qhpc, prehpc, qhpc-prehpc);
printf("shapes = %d\n", size(allshapes));
printf("shapes = %d\n", isize(allshapes));
int inve=0, issi=0, vcon=0, ccon=0;
for(auto sh: allshapes) {
if(sh->flags & POLY_INVERSE) inve++;
@ -2329,9 +2329,9 @@ void curvepoint(const hyperpoint& H1) {
}
void queuecurve(int linecol, int fillcol, int prio) {
queuetable(Id, curvedata, size(curvedata)-curvestart, linecol, fillcol, prio);
queuetable(Id, curvedata, isize(curvedata)-curvestart, linecol, fillcol, prio);
lastptd().u.poly.offset = curvestart;
curvestart = size(curvedata);
curvestart = isize(curvedata);
}
void queueline(const hyperpoint& H1, const hyperpoint& H2, int col, int prf, int prio) {

View File

@ -352,7 +352,7 @@ void showMission() {
dialog::addInfo(XLAT("Collect at least %1 treasures in each of 9 types to access Hell", its(R10)));
else if(items[itHell] < R10)
dialog::addInfo(XLAT("Collect at least %1 Demon Daisies to find the Orbs of Yendor", its(R10)));
else if(size(yendor::yi) == 0)
else if(isize(yendor::yi) == 0)
dialog::addInfo(XLAT("Look for the Orbs of Yendor in Hell or in the Crossroads!"));
else
dialog::addInfo(XLAT("Unlock the Orb of Yendor!"));
@ -482,7 +482,7 @@ void handleKeyQuit(int sym, int uni) {
msgs.clear();
}
else if(uni == 'v') popScreenAll(), pushScreen(showMainMenu);
else if(uni == 'l') popScreenAll(), pushScreen(showMessageLog), messagelogpos = size(gamelog);
else if(uni == 'l') popScreenAll(), pushScreen(showMessageLog), messagelogpos = isize(gamelog);
else if(uni == 'z') hints[hinttoshow].action();
else if(sym == SDLK_F3 || (sym == ' ' || sym == SDLK_HOME))
fullcenter();

View File

@ -12,8 +12,8 @@ typedef vector<int> cwpath;
cwpath invertpath(cwpath p) {
cwpath res;
for(int i=0; i<size(p); i++)
res.push_back(-p[size(p)-1-i]);
for(int i=0; i<isize(p); i++)
res.push_back(-p[isize(p)-1-i]);
return res;
}
@ -159,7 +159,7 @@ void recursive_paint(cwpath& pinv, vector<int>& way, int noway) {
infos[c].way = way;
infos[c].pinv = pinv;
// c->landparam ^= ((size(way)&1) * 0x3F3F3F);
// c->landparam ^= ((isize(way)&1) * 0x3F3F3F);
// c->landparam = hsh; // d * 5 + 256 * (hsh&0xFFFF) + 0x400000;
if(cidd>112899) c->landparam = 0x101010;
// c->landparam = cidd * 0x1241C3;

View File

@ -90,12 +90,12 @@ void loadsamples(const string& fname) {
if(c == '!' && s.name == "") shown = true;
else if(c != 32 && c != 9) s.name += c;
}
if(shown) samples_shown.push_back(size(data));
if(shown) samples_shown.push_back(isize(data));
data.push_back(move(s));
}
bigbreak:
fclose(f);
samples = size(data);
samples = isize(data);
normalize();
colnames.resize(cols);
for(int i=0; i<cols; i++) colnames[i] = "Column " + its(i);
@ -167,7 +167,7 @@ void coloring() {
besttofind = false;
for(neuron& n: net) {
double bdiff = 1e20;
for(int i=0; i<size(samples_shown); i++) {
for(int i=0; i<isize(samples_shown); i++) {
double diff = vnorm(n.net, data[samples_shown[i]].val);
if(diff < bdiff) bdiff = diff, n.bestsample = i;
}
@ -239,14 +239,14 @@ void analyze() {
for(neuron& n: net) n.samples = 0;
for(int id=0; id<size(samples_shown); id++) {
for(int id=0; id<isize(samples_shown); id++) {
int s = samples_shown[id];
auto& w = winner(s);
whowon[s] = &w;
w.samples++;
}
for(int id=0; id<size(samples_shown); id++) {
for(int id=0; id<isize(samples_shown); id++) {
int s = samples_shown[id];
auto& w = *whowon[s];
vdata[id].m->base = w.where;
@ -297,7 +297,7 @@ struct cellcrawler {
sval++;
data.clear();
store(start, 0, 0);
for(int i=0; i<size(data); i++) {
for(int i=0; i<isize(data); i++) {
cellwalker cw0 = data[i].orig;
for(int j=0; j<cw0.c->type; j++) {
cellwalker cw = cw0 + j + wstep;
@ -312,7 +312,7 @@ struct cellcrawler {
void sprawl(const cellwalker& start) {
data[0].target = start;
for(int i=1; i<size(data); i++) {
for(int i=1; i<isize(data); i++) {
cellcrawlerdata& s = data[i];
s.target = data[s.from].target;
if(!s.target.c) continue;
@ -340,7 +340,7 @@ void buildcellcrawler(cell *c, cellcrawler& cr, int dir) {
vector<ld> newtemp;
vector<int> qty;
vector<pair<ld*, ld*> > pairs;
int N = size(net);
int N = isize(net);
curtemp.resize(N, 0);
newtemp.resize(N, 0);
@ -371,7 +371,7 @@ void buildcellcrawler(cell *c, cellcrawler& cr, int dir) {
d.emplace_back(N);
auto& dispvec = d.back();
for(int i=0; i<N; i++) dispvec[i] = curtemp[neuronId(*getNeuron(cr.data[i].orig.c))] / vmax;
if(size(d) == dispersion_count) break;
if(isize(d) == dispersion_count) break;
}
double df = dispersion_precision * (iter+1);
double df0 = df / ceil(df);
@ -389,7 +389,7 @@ void buildcellcrawler(cell *c, cellcrawler& cr, int dir) {
else if(curtemp[i] > vmax) vmax = curtemp[i];
}
dispersion_count = size(d);
dispersion_count = isize(d);
printf("Dispersion count = %d\n", dispersion_count);
}
}
@ -440,7 +440,7 @@ void verify_crawlers() {
setindex(false);
gaussian = 1;
auto& allcells = currentmap->allcells();
cells = size(allcells);
cells = isize(allcells);
net.resize(cells);
for(int i=0; i<cells; i++) net[i].where = allcells[i];
setindex(true);
@ -472,7 +472,7 @@ void verify_crawlers() {
uniq++;
}
}
printf("Crawlers constructed: %d (%d unique, %d failures)\n", size(allcrawlers), uniq, failures);
printf("Crawlers constructed: %d (%d unique, %d failures)\n", isize(allcrawlers), uniq, failures);
setindex(false);
if(failures) exit(1);
}
@ -615,7 +615,7 @@ void sominit(int initto) {
}
else allcells = currentmap->allcells();
cells = size(allcells);
cells = isize(allcells);
net.resize(cells);
for(int i=0; i<cells; i++) net[i].where = allcells[i], allcells[i]->landparam = i;
for(int i=0; i<cells; i++) {
@ -629,11 +629,11 @@ void sominit(int initto) {
for(neuron& n: net) for(int d=BARLEV; d>=7; d--) setdist(n.where, d, NULL);
printf("samples = %d (%d) cells = %d\n", samples, size(samples_shown), cells);
printf("samples = %d (%d) cells = %d\n", samples, isize(samples_shown), cells);
if(!noshow) {
vdata.resize(size(samples_shown));
for(int i=0; i<size(samples_shown); i++) {
vdata.resize(isize(samples_shown));
for(int i=0; i<isize(samples_shown); i++) {
vdata[i].name = data[samples_shown[i]].name;
vdata[i].cp = dftcolor;
createViz(i, cwt.c, Id);
@ -656,7 +656,7 @@ void sominit(int initto) {
vector<double> mapdist;
for(neuron &n2: net) mapdist.push_back(mydistance(c1,n2.where));
sort(mapdist.begin(), mapdist.end());
maxdist = mapdist[size(mapdist)*5/6] * distmul;
maxdist = mapdist[isize(mapdist)*5/6] * distmul;
printf("maxdist = %lf\n", maxdist);
}
@ -688,7 +688,7 @@ void describe(cell *c) {
random_shuffle(v.begin(), v.end());
sort(v.begin(), v.end(), [] (pair<double,int> a, pair<double,int> b) { return a.first < b.first; });
for(int i=0; i<size(v) && i<20; i++) {
for(int i=0; i<isize(v) && i<20; i++) {
int s = v[i].second;
help += "sample "+its(s)+":";
for(int k=0; k<cols; k++) help += " " + fts(data[s].val[k]);
@ -804,7 +804,7 @@ namespace levelline {
dialog::display();
keyhandler = [] (int sym, int uni) {
dialog::handleNavigation(sym, uni);
if(uni >= 'a' && uni - 'a' + size(levellines)) {
if(uni >= 'a' && uni - 'a' + isize(levellines)) {
auto& l = levellines[uni - 'a'];
dialog::editNumber(l.qty, 0, 10, 1, 0, colnames[l.column],
XLAT("Controls the number of level lines."));
@ -813,7 +813,7 @@ namespace levelline {
build();
};
}
else if(uni >= 'A' && uni - 'A' + size(levellines)) {
else if(uni >= 'A' && uni - 'A' + isize(levellines)) {
auto& l = levellines[uni - 'A'];
dialog::openColorDialog(l.color, NULL);
}
@ -988,7 +988,7 @@ void klistsamples(const string& fname_samples, bool best, bool colorformat) {
klistsample(net[n].bestsample, n);
}
else
for(int i=0; i<size(samples_shown); i++)
for(int i=0; i<isize(samples_shown); i++)
klistsample(samples_shown[i], neuronId(*(whowon[i])));
fclose(f);
}
@ -1001,7 +1001,7 @@ void neurondisttable(const string &name) {
printf("Could not open file: %s\n", name.c_str());
return;
}
int neurons = size(net);
int neurons = isize(net);
fprintf(f, "%d\n", neurons);
for(int i=0; i<neurons; i++) {
for(int j=0; j<neurons; j++) fprintf(f, "%3d", celldistance(net[i].where, net[j].where));

View File

@ -171,7 +171,7 @@ void make_staircase() {
rug::push_all_points(1, strafey * acurvature);
for(auto p: rug::points) p->valid = true;
rug::good_shape = true;
printf("done (%d points)\n", size(rug::points));
printf("done (%d points)\n", isize(rug::points));
rug::lowrug = 1e-2 * acurvature;
rug::hirug = 1e3 * acurvature;
}

View File

@ -46,12 +46,12 @@ void rvvideo(const string &fname) {
fixmatrix(View);
bfs(); setdist(cwt.c, 7 - getDistLimit() - genrange_bonus, NULL);
vertexdata& vd = vdata[id];
for(int e=0; e<size(vd.edges); e++) {
for(int e=0; e<isize(vd.edges); e++) {
int id2 = vd.edges[e].first;
if(vdata[id2].name == seq[next]) {
id = id2; next++;
cwt.c = shmup::pc[0]->base = vdata[id2].m->base;
if(next == size(seq)) goto found;
if(next == isize(seq)) goto found;
}
}
}
@ -137,7 +137,7 @@ struct storydata { int s; int e; const char *text; } story[] = {
vid.grid = drawnet;
conformal::phase = 1 + (size(conformal::v)-3) * i * .95 / FRAMECOUNT;
conformal::phase = 1 + (isize(conformal::v)-3) * i * .95 / FRAMECOUNT;
conformal::movetophase();
char buf[500];

View File

@ -159,7 +159,7 @@ void addedge(int i, int j, edgeinfo *ei) {
if(d >= 4) {
// printf("splitting %lf\n", d);
hyperpoint h = mid(hi, hj);
int id = size(vdata);
int id = isize(vdata);
vdata.resize(id+1);
vertexdata& vd(vdata[id]);
vd.cp = colorpair(0x400000FF);
@ -187,7 +187,7 @@ void addedge(int i, int j, double wei, bool subdiv) {
}
void storeall() {
for(int i=0; i<size(vdata); i++)
for(int i=0; i<isize(vdata); i++)
if(vdata[i].m)
vdata[i].m->store();
}
@ -225,7 +225,7 @@ namespace spiral {
}
void edge(ld shift, ld mul) {
int N = size(vdata);
int N = isize(vdata);
for(int i=0; i<N; i++) {
int i0 = i+1;
int j0 = int(i0 * mul + shift) - 1;
@ -234,7 +234,7 @@ namespace spiral {
}
void color(ld start, ld period, colorpair c) {
int N = size(vdata);
int N = isize(vdata);
int maxw = N;
while(start >= 0 && start < N) {
int i = int(start);
@ -283,8 +283,8 @@ namespace anygraph {
int N;
void fixedges() {
for(int i=N; i<size(vdata); i++) if(vdata[i].m) vdata[i].m->dead = true;
for(int i=0; i<size(vdata); i++) vdata[i].edges.clear();
for(int i=N; i<isize(vdata); i++) if(vdata[i].m) vdata[i].m->dead = true;
for(int i=0; i<isize(vdata); i++) vdata[i].edges.clear();
vdata.resize(N);
for(auto e: edgeinfos) {
e->orig = NULL;
@ -343,8 +343,8 @@ namespace anygraph {
if(doRebase) {
printf("Rebasing...\n");
for(int i=0; i<size(vdata); i++) {
if(i % 10000 == 0) printf("%d/%d\n", i, size(vdata));
for(int i=0; i<isize(vdata); i++) {
if(i % 10000 == 0) printf("%d/%d\n", i, isize(vdata));
if(vdata[i].m) virtualRebase(vdata[i].m, true);
}
printf("Done.\n");
@ -368,7 +368,7 @@ namespace tree {
vector<treevertex> tol;
void child(int pid, int id) {
if(size(tol) <= id) tol.resize(id+1);
if(isize(tol) <= id) tol.resize(id+1);
treevertex& v = tol[id];
v.parent = pid;
@ -401,7 +401,7 @@ namespace tree {
void spos(int at, int d) {
tol[at].spos = xpos++;
tol[at].depth = d;
for(int i=0; i<size(tol[at].children); i++)
for(int i=0; i<isize(tol[at].children); i++)
spos(tol[at].children[i], d+1);
tol[at].epos = ++xpos;
}
@ -418,7 +418,7 @@ namespace tree {
}
readnode(f, -1);
fclose(f);
int N = size(vdata);
int N = isize(vdata);
printf("N = %d\n", N);
printf("Assigning spos/epos...\n");
spos(0, 0);
@ -441,7 +441,7 @@ namespace tree {
addedge(i, tol[i].parent, 0, true);
}
for(int i=0; i<size(vdata); i++) {
for(int i=0; i<isize(vdata); i++) {
vertexdata& vd = vdata[i];
virtualRebase(vd.m, true);
}
@ -563,7 +563,7 @@ namespace sag {
if(vid < 0) return 0;
double cost = 0;
vertexdata& vd = vdata[vid];
for(int j=0; j<size(vd.edges); j++) {
for(int j=0; j<isize(vd.edges); j++) {
edgeinfo *ei = vd.edges[j].second;
int t2 = vd.edges[j].first;
if(snakeid[t2] != -1) cost += snakedist(sid, snakeid[t2]) * ei->weight2;
@ -587,7 +587,7 @@ namespace sag {
vector<double> chgs;
void forgetedges(int id) {
for(int i=0; i<size(vdata[id].edges); i++)
for(int i=0; i<isize(vdata[id].edges); i++)
vdata[id].edges[i].second->orig = NULL;
}
@ -610,7 +610,7 @@ namespace sag {
else {
cell *c;
if(s>=2 && size(vdata[t1].edges)) c = snakecells[snakeid[hrand(size(vdata[t1].edges))]];
if(s>=2 && isize(vdata[t1].edges)) c = snakecells[snakeid[hrand(isize(vdata[t1].edges))]];
else c = snakecells[sid1];
int it = s<2 ? (s+1) : s-2;
@ -788,7 +788,7 @@ namespace sag {
for(int j=0; j<i; j++)
indist[snakedist(snakeid[i], snakeid[j])]++;
for(int i=0; i<size(sagedges); i++) {
for(int i=0; i<isize(sagedges); i++) {
edgeinfo& ei = sagedges[i];
if(snakedist(snakeid[ei.i], snakeid[ei.j]) == 0) {
printf("zero between %d (%s) and %d (%s)\n",
@ -855,19 +855,19 @@ namespace sag {
temperature = 0; sagmode = sagOff;
readsag(fname.c_str());
N = size(vdata);
N = isize(vdata);
// totwei.resize(N);
// for(int i=0; i<N; i++) totwei[i] = 0;
for(int i=0; i<N; i++) vdata[i].data = 0;
/* for(int i=0; i<size(sagedges); i++) {
/* for(int i=0; i<isize(sagedges); i++) {
edgeinfo& ei = sagedges[i];
// maxwei[ei.i] = max(maxwei[ei.i], ei.weight);
// maxwei[ei.j] = max(maxwei[ei.j], ei.weight);
// totwei[ei.i] += ei.weight;
// totwei[ei.j] += ei.weight;
} */
for(int i=0; i<size(sagedges); i++) {
for(int i=0; i<isize(sagedges); i++) {
edgeinfo& ei = sagedges[i];
ei.visible = ei.weight >= 0.1;
// (ei.weight >= maxwei[ei.i] / 5 || ei.weight >= maxwei[ei.j] / 5);
@ -922,15 +922,15 @@ string describe(shmup::monster *m) {
int i = m->pid;
vertexdata& vd = vdata[i];
string o = vd.name+", "+its(size(vd.edges))+" edges";
/* if(size(vd.edges) < 10) {
for(int i=0; i<size(vd.edges); i++)
string o = vd.name+", "+its(isize(vd.edges))+" edges";
/* if(isize(vd.edges) < 10) {
for(int i=0; i<isize(vd.edges); i++)
o += " " + its(snakedist(vd.snakeid, vd.edges[i]->snakeid));
} */
vector<edgeinfo*> alledges;
for(int j=0; j<size(vd.edges); j++)
for(int j=0; j<isize(vd.edges); j++)
alledges.push_back(vd.edges[j].second);
sort(alledges.begin(), alledges.end(), edgecmp);
@ -939,7 +939,7 @@ string describe(shmup::monster *m) {
if(vd.info) hr::help = (*vd.info) + "\n" + help;
for(int j=0; j<size(alledges); j++) {
for(int j=0; j<isize(alledges); j++) {
edgeinfo *ei = alledges[j];
if(!ei->visible) continue;
int k = ei->i ^ ei->j ^ i;
@ -956,7 +956,7 @@ void activate(shmup::monster *m) {
vd.cp = colorpair(rand() & 0xFFFFFFFF);
for(int i=0; i<size(vd.edges); i++)
for(int i=0; i<isize(vd.edges); i++)
vd.edges[i].second->orig = NULL;
/* if(ealpha == 1) ealpha = 8;
@ -1020,7 +1020,7 @@ void drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
int lid = shmup::lmousetarget ? shmup::lmousetarget->pid : -2;
if(!leftclick) for(int j=0; j<size(vd.edges); j++) {
if(!leftclick) for(int j=0; j<isize(vd.edges); j++) {
edgeinfo *ei = vd.edges[j].second;
if(!ei->visible) continue;
vertexdata& vd1 = vdata[ei->i];
@ -1145,7 +1145,7 @@ void drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
string s = vd.name;
colorpair cp = vd.cp;
vd.data = 20;
int i0 = size(vdata);
int i0 = isize(vdata);
vdata.resize(i0+1);
vertexdata& vdn = vdata[i0];
createViz(i0, m->base, m->at * spin(collatz::s2) * xpush(collatz::p2));
@ -1157,7 +1157,7 @@ void drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
vdn.m->store();
int carry = 0;
string s2 = s;
for(int i=size(s2)-1; i>=0; i--) {
for(int i=isize(s2)-1; i>=0; i--) {
int x = 2*(s2[i] - '0') + carry;
carry = x>=10;
if(carry) x-=10;
@ -1167,7 +1167,7 @@ void drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
vdn.name = s2;
int m3 = 0;
for(int i=0; i<size(s); i++) m3 += s[i] - '0';
for(int i=0; i<isize(s); i++) m3 += s[i] - '0';
if(m3 % 3 == 2 && s != "2" && s != "1") {
vdata.resize(i0+2);
@ -1180,7 +1180,7 @@ void drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
vdn.m->store();
int carry = -1;
string s2 = s;
for(int i=size(s2)-1; i>=0; i--) {
for(int i=isize(s2)-1; i>=0; i--) {
carry += 2 * (s2[i] - '0');
int ncarry = 0;
while(carry % 3) carry += 10, ncarry--;
@ -1222,12 +1222,12 @@ void drawExtra() {
for(map<cell*, transmatrix>::iterator it = gmatrix.begin(); it != gmatrix.end(); it++) {
cell *c = it->first;
bool draw = true;
for(int i=0; i<size(named); i++) if(named[i] == c) draw = false;
for(int i=0; i<isize(named); i++) if(named[i] == c) draw = false;
if(draw && gmatrix.count(c))
queuepolyat(it->second, shDisk, dftcolor, PPR_LINE);
}
for(int i=0; i<size(named); i++) if(gmatrix.count(named[i])) {
for(int i=0; i<isize(named); i++) if(gmatrix.count(named[i])) {
string s = ""; s += 'A'+i;
queuestr(gmatrix[named[i]], 1, s, forecolor, 1);
}
@ -1238,14 +1238,14 @@ void drawExtra() {
#if CAP_RUG
if(!rug::rugged)
#endif
for(int i=0; i<size(legend); i++) {
for(int i=0; i<isize(legend); i++) {
int k = legend[i];
vertexdata& vd = vdata[k];
int rad = vid.radius/10;
ld x = vid.xres - rad;
ld y = (vid.radius * (i+.5)) / size(legend) * 2 - vid.radius + vid.yres/2;
ld y = (vid.radius * (i+.5)) / isize(legend) * 2 - vid.radius + vid.yres/2;
transmatrix V = atscreenpos(x, y, vid.radius/4);
@ -1307,15 +1307,15 @@ void readcolor(const string& cfname) {
if(err > 0) x = parse(buf);
}
if(size(lab) && lab[0] == '*') {
if(isize(lab) && lab[0] == '*') {
lab = lab.substr(1);
for(int i=0; i<size(vdata); i++)
for(int i=0; i<isize(vdata); i++)
if(vdata[i].name.find(lab) != string::npos) {
vdata[i].cp = x;
}
}
else if(kohonen::samples) {
for(int i=0; i<size(vdata); i++)
for(int i=0; i<isize(vdata); i++)
if(vdata[i].name == lab) {
vdata[i].cp = x;
}
@ -1356,12 +1356,12 @@ void init() {
}
void close() {
for(int i=0; i<size(vdata); i++)
for(int i=0; i<isize(vdata); i++)
if(vdata[i].m) vdata[i].m->dead = true;
vdata.clear();
labeler.clear();
legend.clear();
for(int i=0; i<size(edgeinfos); i++) delete edgeinfos[i];
for(int i=0; i<isize(edgeinfos); i++) delete edgeinfos[i];
edgeinfos.clear();
anygraph::coords.clear();
sag::sagedges.clear();
@ -1376,8 +1376,8 @@ void turn(int delta) {
}
void fixparam() {
if((svg::in || inHighQual) && size(legend) && pngformat == 0) vid.xres = vid.xres * 22/16;
if(size(legend)) vid.xcenter = vid.ycenter;
if((svg::in || inHighQual) && isize(legend) && pngformat == 0) vid.xres = vid.xres * 22/16;
if(isize(legend)) vid.xcenter = vid.ycenter;
}
#if CAP_COMMANDLINE
@ -1577,10 +1577,10 @@ void showMenu() {
dialog::dialogflags = sm::SIDE;
}
else if(uni == 'z') {
for(int i=0; i<size(named)-1; i++) if(named[i] == cwt.c)
for(int i=0; i<isize(named)-1; i++) if(named[i] == cwt.c)
swap(named[i], named[i+1]);
if(!size(named) || named[size(named)-1] != cwt.c) named.push_back(cwt.c);
printf("named = %d\n", size(named));
if(!isize(named) || named[isize(named)-1] != cwt.c) named.push_back(cwt.c);
printf("named = %d\n", isize(named));
popScreen();
}
else if(kind == kKohonen && kohonen::handleMenu(sym, uni)) ;

50
rug.cpp
View File

@ -168,7 +168,7 @@ void push_point(hyperpoint& h, int coord, ld val) {
void push_all_points(int coord, ld val) {
if(!val) return;
else for(int i=0; i<size(points); i++)
else for(int i=0; i<isize(points); i++)
push_point(points[i]->flat, coord, val);
}
@ -263,7 +263,7 @@ rugpoint *addRugpoint(hyperpoint h, double dist) {
}
rugpoint *findRugpoint(hyperpoint h) {
for(int i=0; i<size(points); i++)
for(int i=0; i<isize(points); i++)
if(intvalxyz(points[i]->h, h) < 1e-5) return points[i];
return NULL;
}
@ -557,7 +557,7 @@ void verify() {
Xprintf("%s", "Length verification:\n");
sort(ratios.begin(), ratios.end());
for(int i=0; i<size(ratios); i += size(ratios) / 10)
for(int i=0; i<isize(ratios); i += isize(ratios) / 10)
Xprintf("%lf\n", ratios[i]);
Xprintf("%s", "\n");
}
@ -582,7 +582,7 @@ void buildRug() {
map<cell*, rugpoint *> vptr;
for(int i=0; i<size(cl.lst); i++)
for(int i=0; i<isize(cl.lst); i++)
vptr[cl.lst[i]] = addRugpoint(shmup::ggmatrix(cl.lst[i])*C0, cl.dists[i]);
for(auto& p: vptr) {
@ -608,7 +608,7 @@ void buildRug() {
catch(out_of_range&) {}
}
Xprintf("vertices = %d triangles= %d\n", size(points), size(triangles));
Xprintf("vertices = %d triangles= %d\n", isize(points), isize(triangles));
if(subdivide_first)
for(int i=0; i<20 && subdivide_further(); i++)
@ -703,18 +703,18 @@ void preset(rugpoint *m) {
preset_points.clear();
for(int j=0; j<size(m->edges); j++)
for(int j=0; j<isize(m->edges); j++)
for(int k=0; k<j; k++) {
rugpoint *a = m->edges[j].target;
rugpoint *b = m->edges[k].target;
if(!a->valid) continue;
if(!b->valid) continue;
double blen = -1;
for(int j2=0; j2<size(a->edges); j2++)
for(int j2=0; j2<isize(a->edges); j2++)
if(a->edges[j2].target == b) blen = a->edges[j2].len;
if(blen <= 0) continue;
for(int j2=0; j2<size(a->edges); j2++)
for(int k2=0; k2<size(b->edges); k2++)
for(int j2=0; j2<isize(a->edges); j2++)
for(int k2=0; k2<isize(b->edges); k2++)
if(a->edges[j2].target == b->edges[k2].target && a->edges[j2].target != m) {
rugpoint *c = a->edges[j2].target;
if(!c->valid) continue;
@ -769,7 +769,7 @@ void optimize(rugpoint *m, bool do_preset) {
if(do_preset) {
preset(m);
// int ed0 = size(preset_points);
// int ed0 = isize(preset_points);
for(auto& e: m->edges) if(e.target->valid)
preset_points.emplace_back(e.len, e.target);
if(gwhere >= gSphere) {
@ -790,11 +790,11 @@ void optimize(rugpoint *m, bool do_preset) {
if(now < cur) { cur = now; ex *= 1.2; goto again; }
else m->flat = last;
}
// printf("edges = [%d] %d sse = %lf\n",ed0, size(preset_points), cur);
// printf("edges = [%d] %d sse = %lf\n",ed0, isize(preset_points), cur);
}
}
for(int it=0; it<50; it++)
for(int j=0; j<size(m->edges); j++)
for(int j=0; j<isize(m->edges); j++)
force(*m, *m->edges[j].target, m->edges[j].len, false, 1, 0);
}
@ -803,11 +803,11 @@ bool stop = false;
bool subdivide_further() {
if(torus) return false;
return size(points) * 4 < vertex_limit;
return isize(points) * 4 < vertex_limit;
}
void subdivide() {
int N = size(points);
int N = isize(points);
// if(euclid && gwhere == gEuclid) return;
if(!subdivide_further()) {
if(euclid && !bounded && gwhere == gEuclid) {
@ -821,7 +821,7 @@ void subdivide() {
}
return;
}
Xprintf("subdivide (%d,%d)\n", N, size(triangles));
Xprintf("subdivide (%d,%d)\n", N, isize(triangles));
need_mouseh = true;
divides++;
vector<triangle> otriangles = triangles;
@ -832,7 +832,7 @@ void subdivide() {
// subdivide edges
for(int i=0; i<N; i++) {
rugpoint *m = points[i];
for(int j=0; j<size(m->edges); j++) {
for(int j=0; j<isize(m->edges); j++) {
rugpoint *m2 = m->edges[j].target;
if(m2 < m) continue;
rugpoint *mm = addRugpoint(mid(m->h, m2->h), (m->dist+m2->dist)/2);
@ -851,12 +851,12 @@ void subdivide() {
m->edges.clear();
}
for(int i=0; i<size(otriangles); i++)
for(int i=0; i<isize(otriangles); i++)
addTriangle1(otriangles[i].m[0], otriangles[i].m[1], otriangles[i].m[2]);
calcLengths();
Xprintf("result (%d,%d)\n", size(points), size(triangles));
Xprintf("result (%d,%d)\n", isize(points), isize(triangles));
}
@ -982,7 +982,7 @@ void addNewPoints() {
if(anticusp_factor && detect_cusps())
return;
if(torus || qvalid == size(points)) {
if(torus || qvalid == isize(points)) {
subdivide();
return;
}
@ -991,7 +991,7 @@ void addNewPoints() {
int oqvalid = qvalid;
for(int i=0; i<size(points); i++) {
for(int i=0; i<isize(points); i++) {
rugpoint& m = *points[i];
bool wasvalid = m.valid;
m.valid = wasvalid || sphere || hdist0(m.h) <= dist;
@ -1004,7 +1004,7 @@ void addNewPoints() {
enqueue(&m);
}
}
if(qvalid != oqvalid) { Xprintf("adding new points %4d %4d %4d %.9lf %9d %9d\n", oqvalid, qvalid, size(points), dist, dt, queueiter); }
if(qvalid != oqvalid) { Xprintf("adding new points %4d %4d %4d %.9lf %9d %9d\n", oqvalid, qvalid, isize(points), dist, dt, queueiter); }
}
void physics() {
@ -1327,12 +1327,12 @@ void drawRugScene() {
100
);
for(int t=0; t<size(triangles); t++)
for(int t=0; t<isize(triangles); t++)
drawTriangle(triangles[t]);
glhr::id_modelview();
glhr::prepare(ct_array);
glDrawArrays(GL_TRIANGLES, 0, size(ct_array));
glDrawArrays(GL_TRIANGLES, 0, isize(ct_array));
stereo::set_mask(0);
}
@ -1413,7 +1413,7 @@ void init() {
void clear_model() {
triangles.clear();
for(int i=0; i<size(points); i++) delete points[i];
for(int i=0; i<isize(points); i++) delete points[i];
points.clear();
pqueue = queue<rugpoint*> ();
}
@ -1632,7 +1632,7 @@ hyperpoint gethyper(ld x, ld y) {
bool found = false;
for(int i=0; i<size(triangles); i++) {
for(int i=0; i<isize(triangles); i++) {
auto r0 = triangles[i].m[0];
auto r1 = triangles[i].m[1];
auto r2 = triangles[i].m[2];

View File

@ -65,7 +65,7 @@ void recursive_delete(heptagon *h, int i) {
delete hm;
hm = allmaps.back();
allmaps.pop_back();
DEBSM(printf("map found (%d altmaps total)\n", size(allmaps));)
DEBSM(printf("map found (%d altmaps total)\n", isize(allmaps));)
break;
}
}

View File

@ -13,7 +13,7 @@ bool scorerev = false;
string csub(const string& str, int q) {
int i = 0;
for(int j=0; j<q && i<size(str); j++) getnext(str.c_str(), i);
for(int j=0; j<q && i<isize(str); j++) getnext(str.c_str(), i);
return str.substr(0, i);
}
@ -147,7 +147,7 @@ void showPickScores() {
keyhandler = [] (int sym, int uni) {
if(uni == '/' && dialog::infix == "") monsterpage = !monsterpage; else
if(uni >= '1' && uni <= '9') uni = uni + 1000 - '1';
else if(uni >= 1000 && uni < 1000 + size(pickscore_options)) {
else if(uni >= 1000 && uni < 1000 + isize(pickscore_options)) {
int scoredisplay = pickscore_options[uni - 1000].second;
for(int i=0; i<=POSSCORE; i++)
if(columns[i] == scoredisplay) swap(columns[i], columns[curcol]);
@ -185,7 +185,7 @@ void show() {
int omit = scorefrom;
int rank = 0;
while(y < (ISMOBILE ? vid.yres - 5*vid.fsize : vid.yres - 2 * vid.fsize)) {
if(id >= size(scores)) break;
if(id >= isize(scores)) break;
score& S(scores[id]);
@ -328,7 +328,7 @@ void load() {
fclose(f);
clearMessages();
// addMessage(its(size(scores))+" games have been recorded in "+scorefile);
// addMessage(its(isize(scores))+" games have been recorded in "+scorefile);
pushScreen(show);
boxid = 0; applyBoxes();
reverse(scores.begin(), scores.end());

View File

@ -516,7 +516,7 @@ template<class T> void bindbuffer(T& v) {
glBindBuffer(GL_ARRAY_BUFFER, buf_current);
}
current_vertices = &v[0];
glBufferData(GL_ARRAY_BUFFER, size(v) * sizeof(v[0]), &v[0], GL_DYNAMIC_DRAW);
glBufferData(GL_ARRAY_BUFFER, isize(v) * sizeof(v[0]), &v[0], GL_DYNAMIC_DRAW);
}
#define PTR(attrib, q, field) \
@ -623,11 +623,11 @@ void store_in_buffer(vector<glvertex>& v) {
printf("no buffer yet\n");
return;
}
printf("storing %d in buffer: %p\n", size(v), &v[0]);
printf("storing %d in buffer: %p\n", isize(v), &v[0]);
current_vertices = buffered_vertices = &v[0];
glBindBuffer(GL_ARRAY_BUFFER, buf_buffered);
glVertexAttribPointer(glhr::aPosition, 3, GL_FLOAT, GL_FALSE, sizeof(glvertex), 0);
glBufferData(GL_ARRAY_BUFFER, size(v) * sizeof(glvertex), &v[0], GL_STATIC_DRAW);
glBufferData(GL_ARRAY_BUFFER, isize(v) * sizeof(glvertex), &v[0], GL_STATIC_DRAW);
printf("Stored.\n");
#endif
}

View File

@ -1104,7 +1104,7 @@ void pushmonsters() {
}
void popmonsters() {
for(int i=size(nonvirtual)-1; i>=0; i--) {
for(int i=isize(nonvirtual)-1; i>=0; i--) {
monster *m = nonvirtual[i];
if(!m->notpushed) {
if(m->type == m->base->monst)
@ -2940,19 +2940,19 @@ void turn(int delta) {
pd_from = NULL;
// build the path data
int pqs = size(pathq);
int pqs = isize(pathq);
for(int i=0; i<pqs; i++) {
pathq[i]->pathdist = PINFD;
}
pathq.clear();
for(int i=0; i<size(targets); i++) {
for(int i=0; i<isize(targets); i++) {
targets[i]->pathdist = isPlayerOn(targets[i]) ? 0 : 1;
pathq.push_back(targets[i]);
}
int qb = 0;
for(qb=0; qb < size(pathq); qb++) {
for(qb=0; qb < isize(pathq); qb++) {
cell *c = pathq[qb];
int d = c->pathdist;
if(d == PINFD-1) continue;
@ -3199,7 +3199,7 @@ bool drawMonster(const transmatrix& V, cell *c, const transmatrix*& Vboat, trans
(isFriendly(m->type) || m->type == moPlayer) ? 0x00FF00FF : 0xFF0000FF;
int q = ptds.size();
if(q != size(ptds) && !m->inBoat) pushdown(c, q, view, zlev, true, false);
if(q != isize(ptds) && !m->inBoat) pushdown(c, q, view, zlev, true, false);
switch(m->type) {
case moPlayer:
@ -3350,7 +3350,7 @@ transmatrix calc_relative_matrix(cell *c2, cell *c1, int direction_hint) {
if(sphere) {
if(!gmatrix0.count(c2) || !gmatrix0.count(c1)) {
printf("building gmatrix0 (size=%d)\n", size(gmatrix0));
printf("building gmatrix0 (size=%d)\n", isize(gmatrix0));
auto bak = gp::draw_li;
swap(gmatrix, gmatrix0);
just_gmatrix = true;

View File

@ -124,7 +124,7 @@ bool loadMusicInfo(string dir) {
FILE *f = fopen(dir.c_str(), "rt");
if(f) {
string dir2;
for(int i=0; i<size(dir); i++) if(dir[i] == '/' || dir[i] == '\\')
for(int i=0; i<isize(dir); i++) if(dir[i] == '/' || dir[i] == '\\')
dir2 = dir.substr(0, i+1);
char buf[1000];
while(fgets(buf, 800, f) != NULL) {

View File

@ -479,18 +479,18 @@ void run_kuen() {
int part = 0;
vector<int> coverages(size(mesh), 0);
vector<int> coverages(isize(mesh), 0);
for(auto& m: { frontal_map, back0, back1, back2 } ) {
part++;
int pid[5] = {0, 8, 1, 2, 4};
string captions[5] = {"", "the upper component", "the lower center", "the lower left", "the lower right"};
vector<rug::rugpoint*> newmesh(size(mesh), nullptr);
vector<rug::rugpoint*> newmesh(isize(mesh), nullptr);
for(auto p: mesh) {
auto px = map_to_surface(p->h, m);
p->surface_point = px;
conformal::progress(XLAT("solving the geodesics on: %1, %2/%3", XLAT(captions[part]), its(p->dexp_id), its(size(mesh))));
conformal::progress(XLAT("solving the geodesics on: %1, %2/%3", XLAT(captions[part]), its(p->dexp_id), its(isize(mesh))));
}
for(auto p: mesh) {
// make it a bit nicer by including the edges where only one endpoint is valid
@ -562,7 +562,7 @@ void run_other() {
p->surface_point = map_to_surface(h, dp);
p->flat = coord(p->surface_point.params);
conformal::progress(XLAT("solving the geodesics on: %1, %2/%3", XLAT(shape_name[sh]), its(it), its(size(rug::points))));
conformal::progress(XLAT("solving the geodesics on: %1, %2/%3", XLAT(shape_name[sh]), its(it), its(isize(rug::points))));
if(p->surface_point.remaining_distance == 0)
coverage.emplace_back(h, rchar(it) + 256 * 7);
}

View File

@ -214,7 +214,7 @@ void initgame() {
}
if(quotient && generateAll(firstland)) {
for(int i=0; i<size(currentmap->allcells()); i++)
for(int i=0; i<isize(currentmap->allcells()); i++)
setdist(currentmap->allcells()[i], 8, NULL);
}
@ -1025,7 +1025,7 @@ namespace gamestack {
vector<gamedata> gd;
bool pushed() { return size(gd); }
bool pushed() { return isize(gd); }
void push() {
if(geometry) {
@ -1045,7 +1045,7 @@ namespace gamestack {
}
void pop() {
gamedata& gdn = gd[size(gd)-1];
gamedata& gdn = gd[isize(gd)-1];
currentmap = gdn.hmap;
cwt = gdn.cwt;
viewctr = gdn.viewctr;

View File

@ -241,7 +241,7 @@ void texture_config::mapTextureTriangle(textureinfo &mi, const array<hyperpoint,
// when reading a spherical band in a cylindrical projection,
// take care that texture vertices are mapped not around the sphere
if(sphere && mdBandAny()) {
int s = size(mi.tvertices)-3;
int s = isize(mi.tvertices)-3;
ld xmin = min(mi.tvertices[s][0], min(mi.tvertices[s+1][0], mi.tvertices[s+2][0]));
ld xmax = max(mi.tvertices[s][0], max(mi.tvertices[s+1][0], mi.tvertices[s+2][0]));
if(xmax - xmin > .5) {
@ -357,7 +357,7 @@ bool texture_config::apply(cell *c, const transmatrix &V, int col) {
if(texture::saving) {
// create a nicer aura for saved texture
for(int i=0; i<size(mi.tvertices); i += 3) {
for(int i=0; i<isize(mi.tvertices); i += 3) {
ld p[3];
while(true) {
p[0] = hrandf();
@ -462,7 +462,7 @@ void texture_config::finish_mapping() {
texture::cgroup = patterns::cgroup;
texture_map_orig = texture_map;
orig_texture_parameters = current_texture_parameters;
// printf("texture_map has %d elements (S%d)\n", size(texture_map), config.tstate);
// printf("texture_map has %d elements (S%d)\n", isize(texture_map), config.tstate);
}
void texture_config::saveFullTexture(string tn) {
@ -717,7 +717,7 @@ void mousemovement() {
newmove = false;
}
}
if(edited_tinfo && size(edited_tinfo->triangles) == c->type) {
if(edited_tinfo && isize(edited_tinfo->triangles) == c->type) {
for(int i=0; i<c->type; i++)
edited_tinfo->triangles[i].tv = findTextureTriangle(c, si, i);
config.texture_tuned = true;
@ -917,7 +917,7 @@ bool texture_config::load() {
coords.push_back(&v[i]);
int semicounter = 0;
for(char c: texture_tuner) if(c == ';') semicounter++;
if(semicounter != size(coords))
if(semicounter != isize(coords))
addMessage("Tuning error: wrong number");
else {
string cur = "";
@ -928,7 +928,7 @@ bool texture_config::load() {
cur = "";
}
else cur += c;
printf("index = %d semi = %d sc = %d\n", index, semicounter, size(coords));
printf("index = %d semi = %d sc = %d\n", index, semicounter, isize(coords));
}
}
@ -948,7 +948,7 @@ void showMagicMenu() {
for(int i=0; i<mpMAX; i++)
dialog::addBoolItem(XLAT(mpnames[i]), have_mp(eMagicParameter(i)), 'a'+i);
dialog::addSelItem(XLAT("delete markers"), its(size(amp)), 'D');
dialog::addSelItem(XLAT("delete markers"), its(isize(amp)), 'D');
dialog::addItem(XLAT("perform auto-adjustment"), 'R');
dialog::addBack();
@ -1282,17 +1282,17 @@ void texture_data::undo() {
}
void texture_data::undoLock() {
printf("undos size = %d\n", size(undos));
if(size(undos) > 2000000) {
printf("undos size = %d\n", isize(undos));
if(isize(undos) > 2000000) {
// limit undo memory
int moveto = 0;
for(int i=0; i < size(undos) - 1000000; i++)
for(int i=0; i < isize(undos) - 1000000; i++)
if(!undos[i].first) moveto = i;
if(moveto) {
for(int i=0; i+moveto < size(undos); i++)
for(int i=0; i+moveto < isize(undos); i++)
undos[i] = undos[i+moveto];
undos.resize(size(undos) - moveto);
printf("undos sized to = %d\n", size(undos));
undos.resize(isize(undos) - moveto);
printf("undos sized to = %d\n", isize(undos));
}
}
@ -1434,7 +1434,7 @@ void texture_config::remap(eTextureState old_tstate, eTextureState old_tstate_ma
try {
auto& mi = texture_map_orig.at(oldid);
int ncurr = size(mi.tvertices);
int ncurr = isize(mi.tvertices);
int ntarget = ncurr * c->type / mi.current_type;
vector<glvertex> new_tvertices = mi.tvertices;
new_tvertices.resize(ntarget);
@ -1447,7 +1447,7 @@ void texture_config::remap(eTextureState old_tstate, eTextureState old_tstate_ma
mapTexture(c, mi2, si, shmup::ggmatrix(c), pshift);
mapTexture2(mi2);
mi2.tvertices = move(new_tvertices);
// printf("%08x remapping %d vertices to %d vertices\n", si.id, size(mi.tvertices), size(mi2.tvertices));
// printf("%08x remapping %d vertices to %d vertices\n", si.id, isize(mi.tvertices), isize(mi2.tvertices));
}
catch(out_of_range&) {
printf("Unexpected missing cell #%d/%d", si.id, oldid);
@ -1463,7 +1463,7 @@ void texture_config::remap(eTextureState old_tstate, eTextureState old_tstate_ma
drawthemap();
perform_mapping();
finish_mapping();
printf("texture_map size = %d\n", size(texture_map));
printf("texture_map size = %d\n", isize(texture_map));
}
}

View File

@ -276,7 +276,7 @@ namespace ss {
if(wts[i].flags & FINALSLIDE) break;
}
dialog::addBreak(50);
if(size(slideshows) > 1) dialog::addItem(XLAT("change slideshow"), '1');
if(isize(slideshows) > 1) dialog::addItem(XLAT("change slideshow"), '1');
dialog::addBack();
dialog::display();
keyhandler = [] (int sym, int uni) {
@ -298,7 +298,7 @@ namespace ss {
}
else if(uni == '1') {
list(wts);
for(int i=0; i<size(slideshows)-1; i++) if(slideshows[i] == wts) {
for(int i=0; i<isize(slideshows)-1; i++) if(slideshows[i] == wts) {
wts = slideshows[i+1]; return;
}
wts = slideshows[0];

View File

@ -27,7 +27,7 @@ void displayScore(subscoreboard& s, int x) {
}
else {
sort(s.begin(), s.end());
for(int i=0; i<size(s); i++) {
for(int i=0; i<isize(s); i++) {
int i0 = 56 + i * vf;
displayfr(x, i0, 1, vf, its(-s[i].first), 0xC0C0C0, 16);
displayfr(x+8, i0, 1, vf, s[i].second, 0xC0C0C0, 0);
@ -137,7 +137,7 @@ namespace yendor {
if(peace::on) return 15; // just to generate monsters
if(!yendor::generating && !yendor::path && !yendor::on) return 0;
int thf = 0;
for(int i=0; i<size(yi); i++) {
for(int i=0; i<isize(yi); i++) {
yendorinfo& ye ( yi[i] );
if(!ye.foundOrb && ye.howfar > 25)
thf += (ye.howfar - 25);
@ -150,16 +150,16 @@ namespace yendor {
enum eState { ysUntouched, ysLocked, ysUnlocked };
eState state(cell *yendor) {
for(int i=0; i<size(yi); i++) if(yi[i].path[0] == yendor)
for(int i=0; i<isize(yi); i++) if(yi[i].path[0] == yendor)
return yi[i].found ? ysUnlocked : ysLocked;
return ysUntouched;
}
bool check(cell *yendor) {
int byi = size(yi);
for(int i=0; i<size(yi); i++) if(yi[i].path[0] == yendor) byi = i;
if(byi < size(yi) && yi[byi].found) return false;
if(byi == size(yi)) {
int byi = isize(yi);
for(int i=0; i<isize(yi); i++) if(yi[i].path[0] == yendor) byi = i;
if(byi < isize(yi) && yi[byi].found) return false;
if(byi == isize(yi)) {
yendorinfo nyi;
nyi.path[0] = yendor;
nyi.howfar = 0;
@ -290,7 +290,7 @@ namespace yendor {
void onpath() {
path = false;
if(yii < size(yi)) {
if(yii < isize(yi)) {
for(int i=0; i<YDIST; i++) if(yi[yii].path[i]->cpdist <= 7) {
if(i > yi[yii].howfar) yi[yii].howfar = i;
path = true;
@ -491,7 +491,7 @@ namespace yendor {
if(yc > 0 && yc < YENDORLEVELS) {
subscoreboard scorehere;
for(int i=0; i<size(scoreboard); i++) {
for(int i=0; i<isize(scoreboard); i++) {
int sc = scoreboard[i].scores[yc];
if(sc > 0)
scorehere.push_back(
@ -528,7 +528,7 @@ namespace yendor {
int pg = gold();
playSound(c2, "tada");
items[itOrbShield] += 31;
for(int i=0; i<size(yendor::yi); i++)
for(int i=0; i<isize(yendor::yi); i++)
if(yendor::yi[i].path[0] == c2)
yendor::yi[i].foundOrb = true;
// Shielding always, so that we know that it protects!
@ -684,7 +684,7 @@ namespace tactic {
generateLandList([] (eLand l) { return land_validity(l).flags & lv::appears_in_ptm; });
}
int nl = size(landlist);
int nl = isize(landlist);
int nlm;
int ofs = dialog::handlePage(nl, nlm, (nl+1)/2);
@ -738,10 +738,10 @@ namespace tactic {
uploadScore();
if(on) unrecord(specialland);
if(getcstat >= 1000 && getcstat < 1000 + size(landlist)) {
if(getcstat >= 1000 && getcstat < 1000 + isize(landlist)) {
int ld = landlist[getcstat-1000];
subscoreboard scorehere;
for(int i=0; i<size(scoreboard[xc]); i++) {
for(int i=0; i<isize(scoreboard[xc]); i++) {
int sc = scoreboard[xc][i].scores[ld];
if(sc > 0)
scorehere.push_back(
@ -751,7 +751,7 @@ namespace tactic {
}
keyhandler = [] (int sym, int uni) {
if(uni >= 1000 && uni < 1000 + size(landlist)) {
if(uni >= 1000 && uni < 1000 + isize(landlist)) {
specialland = landlist[uni - 1000];
restart_game(tactic::on ? rg::nothing : rg::tactic);
}
@ -1004,15 +1004,15 @@ namespace peace {
void build() {
if(otherpuzzles || !on) return;
while(size(path) < tobuild) {
cell *cp = path[size(path)-1];
cell *cp2 = path[size(path)-2];
while(isize(path) < tobuild) {
cell *cp = path[isize(path)-1];
cell *cp2 = path[isize(path)-2];
vector<pair<cell*, cell*>> clister;
clister.emplace_back(cp, cp);
int id = 0;
sval++;
while(id < size(clister)) {
while(id < isize(clister)) {
cell *c = clister[id].first;
cell *fr = clister[id].second;
setdist(c, 5, NULL);
@ -1044,7 +1044,7 @@ namespace peace {
void extend() {
int i = 0;
while(i<size(path) && path[i]->item != itDodeca) i++;
while(i<isize(path) && path[i]->item != itDodeca) i++;
if(tobuild == i+9)
addMessage("You must collect all the dodecahedra on the path!");
tobuild = i + 9;
@ -1066,7 +1066,7 @@ namespace peace {
}
void restore() {
for(int i=1; i<size(path); i++)
for(int i=1; i<isize(path); i++)
if(path[i]->item == itNone && items[itDodeca])
path[i]->item = itDodeca, items[itDodeca]--;
}