- for (n=0; n < scene[game].vessels; n++){
- if ((d1 = pos[n].dir) && !isolated(n)){
- r1 = pos[n].row;
- c1 = pos[n].col;
- pos[n].dir = dir[n];
- pos[n].row = row[n];
- pos[n].col = col[n];
- for (l=0; l < scene[game].vessels; l++){
- if (d2 = pos[l].dir && l != n){
- r2 = pos[l].row;
- c2 = pos[l].col;
- pos[l].dir = dir[l];
- pos[l].row = row[l];
- pos[l].col = col[l];
- if ((foul(n,l) || grapple(n,l)) && push(n,l) && range(n,l) > 1){
- Write(l,0,6,pos[n].row-1);
- if (pos[n].dir == 1 || pos[n].dir == 5)
- Write(l,0,8,pos[n].col-1);
- else
- Write(l,0,8,pos[n].col);
- Write(l,0,10,pos[n].dir);
- }
- if (!range(n,l) && !foul(n,l) && push(n,l)){
- makesignal("collision with %s (%c%c)", l, n);
- if (die() < 4){
- makesignal("fouled with %s (%c%c)", l, n);
- for (m=0;scene[game].ship[n].file -> fouls[m].turnfoul && m < 10; m++);
- if (m < 10){
- Write(FILES + n, 0, 84 + m*4, turn);
- Write(FILES + n, 0, 84 + m*4 + 2, l);
- }
- for (m=0;scene[game].ship[l].file -> fouls[m].turnfoul && m < 10; m++);
- if (m < 10){
- Write(FILES + l, 0, 84 + m*4, turn);
- Write(FILES + l, 0, 84 + m*4 + 2, n);
- }
- }
- clast[n][k+1] = '\0';
- pos[n].row = r2;
- pos[n].col = c2;
- pos[n].dir = d2;
- score(clast[n],n,n,1,0);
- Write(l,0,6,pos[n].row-1);
- if (pos[n].dir == 1 || pos[n].dir == 5)
- Write(l,0,8,pos[n].col-1);
- else
- Write(l,0,8,pos[n].col);
- Write(l,0,10,pos[n].dir);
- Write(FILES + l, 0, 82, 0);
- Write(FILES + n, 0, 82, 0);
- }
- else {
- pos[l].row = r2;
- pos[l].col = c2;
- pos[l].dir = d2;
- }
+ /*
+ * The real stuff.
+ */
+ n = 0;
+ foreachship(sp) {
+ if (sp->file->dir == 0 || isolated(sp))
+ goto cont1;
+ l = 0;
+ foreachship(sq) {
+ char snap = 0;
+
+ if (sp == sq)
+ goto cont2;
+ if (sq->file->dir == 0)
+ goto cont2;
+ if (!push(sp, sq))
+ goto cont2;
+ if (snagged2(sp, sq) && range(sp, sq) > 1)
+ snap++;
+ if (!range(sp, sq) && !fouled2(sp, sq)) {
+ makesignal(sp,
+ "collision with %s (%c%c)", sq);
+ if (die() < 4) {
+ makesignal(sp,
+ "fouled with %s (%c%c)",
+ sq);
+ Write(W_FOUL, sp, 0, l, 0, 0, 0);
+ Write(W_FOUL, sq, 0, n, 0, 0, 0);