if (irun == 0) {
/* avoid intruding on another commander's territory */
if (ienm == IHC) {
- for (l = 1; l <= game.state.remcom; l++)
+ for_commanders(l)
if (game.state.cx[l]==iqx && game.state.cy[l]==iqy) return 0;
/* refuse to leave if currently attacking starbase */
if (batx==quadx && baty==quady) return 0;
game.state.isy=iqy;
}
else {
- for (l=1; l<=game.state.remcom; l++) {
+ for_commanders(l) {
if (game.state.cx[l]==quadx && game.state.cy[l]==quady) {
game.state.cx[l]=iqx;
game.state.cy[l]=iqy;
continue;
/* if there is a commander, an no other base is appropriate,
we will take the one with the commander */
- for (j = 1; j <= game.state.remcom; j++) {
+ for_commanders (j) {
if (ibqx==game.state.cx[j] && ibqy==game.state.cy[j] && ifindit!= 2) {
ifindit = 2;
iwhichb = i;
switch (type) {
case IHC:
comhere = 0;
- for (i=1; i<=game.state.remcom; i++)
+ for_commanders (i)
if (game.state.cx[i]==quadx && game.state.cy[i]==quady) break;
game.state.cx[i] = game.state.cx[game.state.remcom];
game.state.cy[i] = game.state.cy[game.state.remcom];