forked from github/server
making init_battle a bit faster by being a bit smarter.
This commit is contained in:
parent
2df1fbf0e9
commit
0af00c10ec
1 changed files with 15 additions and 11 deletions
|
@ -3153,13 +3153,15 @@ join_battle(battle * b, unit * u, boolean attack, fighter ** cp)
|
||||||
|
|
||||||
for (s=b->sides;s!=b->sides+b->nsides;++s) {
|
for (s=b->sides;s!=b->sides+b->nsides;++s) {
|
||||||
fighter *fig;
|
fighter *fig;
|
||||||
for (fig=s->fighters;fig;fig=fig->next) {
|
if (s->faction==u->faction) {
|
||||||
if (fig->unit == u) {
|
for (fig=s->fighters;fig;fig=fig->next) {
|
||||||
c = fig;
|
if (fig->unit == u) {
|
||||||
if (attack) {
|
c = fig;
|
||||||
set_attacker(fig);
|
if (attack) {
|
||||||
|
set_attacker(fig);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3330,13 +3332,15 @@ battle_report(battle * b)
|
||||||
bfaction *bf;
|
bfaction *bf;
|
||||||
|
|
||||||
for (s=b->sides;s!=b->sides+b->nsides;++s) {
|
for (s=b->sides;s!=b->sides+b->nsides;++s) {
|
||||||
for (s2=b->sides;s2!=b->sides+b->nsides;++s2) {
|
if (s->alive-s->removed > 0) {
|
||||||
if (s->alive-s->removed > 0 && s2->alive-s2->removed > 0 && enemy(s, s2)) {
|
for (s2=b->sides;s2!=b->sides+b->nsides;++s2) {
|
||||||
cont = true;
|
if (s2->alive-s2->removed > 0 && enemy(s, s2)) {
|
||||||
break;
|
cont = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (cont) break;
|
||||||
}
|
}
|
||||||
if (cont) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(" %d", b->turn);
|
printf(" %d", b->turn);
|
||||||
|
|
Loading…
Reference in a new issue