forked from github/server
The power of 2, faster.
This commit is contained in:
parent
8077027b42
commit
88b041880c
|
@ -70,7 +70,7 @@ createmonsters(void)
|
||||||
set_string(&f->email, "monsters@eressea.de");
|
set_string(&f->email, "monsters@eressea.de");
|
||||||
set_string(&f->name, "Monster");
|
set_string(&f->name, "Monster");
|
||||||
f->alive = 1;
|
f->alive = 1;
|
||||||
f->options = (char) pow(2, O_REPORT);
|
f->options = (char)(1<<O_REPORT);
|
||||||
addlist(&factions, f);
|
addlist(&factions, f);
|
||||||
fhash(f);
|
fhash(f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2094,12 +2094,12 @@ send_cmd(unit * u, struct order * ord)
|
||||||
if (option == O_COMPRESS || option == O_BZIP2) {
|
if (option == O_COMPRESS || option == O_BZIP2) {
|
||||||
cmistake(u, ord, 305, MSG_EVENT);
|
cmistake(u, ord, 305, MSG_EVENT);
|
||||||
} else {
|
} else {
|
||||||
u->faction->options = u->faction->options & ~((int)pow(2, option));
|
u->faction->options = u->faction->options & ~(1<<option);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
u->faction->options = u->faction->options | ((int)pow(2, option));
|
u->faction->options = u->faction->options | (1<<option);
|
||||||
if(option == O_COMPRESS) u->faction->options &= ~((int)pow(2, O_BZIP2));
|
if(option == O_COMPRESS) u->faction->options &= ~(1<<O_BZIP2);
|
||||||
if(option == O_BZIP2) u->faction->options &= ~((int)pow(2, O_COMPRESS));
|
if(option == O_BZIP2) u->faction->options &= ~(1<<O_COMPRESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1056,16 +1056,16 @@ farcasting(unit *magician, region *r)
|
||||||
int mult;
|
int mult;
|
||||||
|
|
||||||
if (!r) {
|
if (!r) {
|
||||||
return 1025;
|
return INT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
dist = koor_distance(r->x, r->y, magician->region->x, magician->region->y);
|
dist = koor_distance(r->x, r->y, magician->region->x, magician->region->y);
|
||||||
|
|
||||||
if (dist > 24) return 1025;
|
if (dist > 24) return INT_MAX;
|
||||||
|
|
||||||
mult = (int)pow(2.0,(double)dist);
|
mult = 1 << dist;
|
||||||
if (dist > 1) {
|
if (dist > 1) {
|
||||||
if (!path_exists(magician->region, r, dist*2, allowed_fly)) mult = 1025;
|
if (!path_exists(magician->region, r, dist*2, allowed_fly)) mult = INT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mult;
|
return mult;
|
||||||
|
|
Loading…
Reference in New Issue