Another step in consolidating the saved-state globals.
[super-star-trek.git] / ai.c
diff --git a/ai.c b/ai.c
index 4572d4f9a851d23f8ac543f9c9613dbce5d60200..9dcb1a01261941591e7a99c64721a2b7d7314e7a 100644 (file)
--- a/ai.c
+++ b/ai.c
@@ -6,23 +6,23 @@ static int tryexit(int lookx, int looky, int ienm, int loccom, int irun) {
        iqx = quadx+(lookx+9)/10 - 1;\r
        iqy = quady+(looky+9)/10 - 1;\r
        if (iqx < 1 || iqx > 8 || iqy < 1 || iqy > 8 ||\r
-               state.galaxy[iqx][iqy] > 899)\r
+               game.state.galaxy[iqx][iqy] > 899)\r
                return 0; /* no can do -- neg energy, supernovae, or >8 Klingons */\r
        if (ienm == IHR) return 0; /* Romulans cannot escape! */\r
        if (irun == 0) {\r
                /* avoid intruding on another commander's territory */\r
                if (ienm == IHC) {\r
-                       for (l = 1; l <= state.remcom; l++)\r
-                               if (state.cx[l]==iqx && state.cy[l]==iqy) return 0;\r
+                       for (l = 1; l <= game.state.remcom; l++)\r
+                               if (game.state.cx[l]==iqx && game.state.cy[l]==iqy) return 0;\r
                        /* refuse to leave if currently attacking starbase */\r
                        if (batx==quadx && baty==quady) return 0;\r
                }\r
                /* don't leave if over 1000 units of energy */\r
-               if (frozen.kpower[loccom] > 1000.) return 0;\r
+               if (game.kpower[loccom] > 1000.) return 0;\r
        }\r
        /* print escape message and move out of quadrant.\r
           We know this if either short or long range sensors are working */\r
-       if (frozen.damage[DSRSENS] == 0.0 || frozen.damage[DLRSENS] == 0.0 ||\r
+       if (game.damage[DSRSENS] == 0.0 || game.damage[DLRSENS] == 0.0 ||\r
                condit == IHDOCKED) {\r
                proutn("***");\r
                cramen(ienm);\r
@@ -31,32 +31,32 @@ static int tryexit(int lookx, int looky, int ienm, int loccom, int irun) {
                prout(" (and regains strength).");\r
        }\r
        /* handle local matters related to escape */\r
-       frozen.kx[loccom] = frozen.kx[nenhere];\r
-       frozen.ky[loccom] = frozen.ky[nenhere];\r
-       frozen.kavgd[loccom] = frozen.kavgd[nenhere];\r
-       frozen.kpower[loccom] = frozen.kpower[nenhere];\r
-       frozen.kdist[loccom] = frozen.kdist[nenhere];\r
+       game.kx[loccom] = game.kx[nenhere];\r
+       game.ky[loccom] = game.ky[nenhere];\r
+       game.kavgd[loccom] = game.kavgd[nenhere];\r
+       game.kpower[loccom] = game.kpower[nenhere];\r
+       game.kdist[loccom] = game.kdist[nenhere];\r
        klhere--;\r
        nenhere--;\r
        if (condit != IHDOCKED) newcnd();\r
        /* Handle global matters related to escape */\r
-       state.galaxy[quadx][quady] -= 100;\r
-       state.galaxy[iqx][iqy] += 100;\r
+       game.state.galaxy[quadx][quady] -= 100;\r
+       game.state.galaxy[iqx][iqy] += 100;\r
        if (ienm==IHS) {\r
                ishere=0;\r
                iscate=0;\r
                ientesc=0;\r
                isatb=0;\r
-               frozen.future[FSCMOVE]=0.2777+state.date;\r
-               frozen.future[FSCDBAS]=1e30;\r
-               state.isx=iqx;\r
-               state.isy=iqy;\r
+               game.future[FSCMOVE]=0.2777+game.state.date;\r
+               game.future[FSCDBAS]=1e30;\r
+               game.state.isx=iqx;\r
+               game.state.isy=iqy;\r
        }\r
        else {\r
-               for (l=1; l<=state.remcom; l++) {\r
-                       if (state.cx[l]==quadx && state.cy[l]==quady) {\r
-                               state.cx[l]=iqx;\r
-                               state.cy[l]=iqy;\r
+               for (l=1; l<=game.state.remcom; l++) {\r
+                       if (game.state.cx[l]==quadx && game.state.cy[l]==quady) {\r
+                               game.state.cx[l]=iqx;\r
+                               game.state.cy[l]=iqy;\r
                                break;\r
                        }\r
                }\r
@@ -78,12 +78,12 @@ static void movebaddy(int comx, int comy, int loccom, int ienm) {
                                  (comhere + ishere);\r
        double dist1, forces;\r
 \r
-       dist1 = frozen.kdist[loccom];\r
+       dist1 = game.kdist[loccom];\r
        mdist = dist1 + 0.5; /* Nearest integer distance */\r
 \r
        /* If SC, check with spy to see if should hi-tail it */\r
        if (ienm==IHS &&\r
-               (frozen.kpower[loccom] <= 500.0 || (condit==IHDOCKED && frozen.damage[DPHOTON]==0))) {\r
+               (game.kpower[loccom] <= 500.0 || (condit==IHDOCKED && game.damage[DPHOTON]==0))) {\r
                irun = 1;\r
                motion = -10;\r
        }\r
@@ -127,14 +127,14 @@ static void movebaddy(int comx, int comy, int loccom, int ienm) {
   *  Motion is limited to skill level, except for SC hi-tailing it out.\r
   */\r
 \r
-               forces = frozen.kpower[loccom]+100.0*nenhere+400*(nbaddys-1);\r
+               forces = game.kpower[loccom]+100.0*nenhere+400*(nbaddys-1);\r
                if (shldup==0) forces += 1000; /* Good for enemy if shield is down! */\r
-               if (frozen.damage[DPHASER] == 0.0 || frozen.damage[DPHOTON] == 0.0) {\r
-                       if (frozen.damage[DPHASER] != 0) /* phasers damaged */\r
+               if (game.damage[DPHASER] == 0.0 || game.damage[DPHOTON] == 0.0) {\r
+                       if (game.damage[DPHASER] != 0) /* phasers damaged */\r
                                forces += 300.0;\r
                        else\r
                                forces -= 0.2*(energy - 2500.0);\r
-                       if (frozen.damage[DPHOTON] != 0) /* photon torpedoes damaged */\r
+                       if (game.damage[DPHOTON] != 0) /* photon torpedoes damaged */\r
                                forces += 300.0;\r
                        else\r
                                forces -= 50.0*torps;\r
@@ -187,7 +187,7 @@ static void movebaddy(int comx, int comy, int loccom, int ienm) {
        if (my != 0) my = my*motion < 0 ? -1 : 1;\r
        nextx = comx;\r
        nexty = comy;\r
-       frozen.quad[comx][comy] = IHDOT;\r
+       game.quad[comx][comy] = IHDOT;\r
        /* main move loop */\r
        for (ll = 1; ll <= nsteps; ll++) {\r
 #ifdef DEBUG\r
@@ -218,9 +218,9 @@ static void movebaddy(int comx, int comy, int loccom, int ienm) {
                                looky = nexty + krawly;\r
                                krawly = -krawly;\r
                        }\r
-                       else if (frozen.quad[lookx][looky] != IHDOT) {\r
+                       else if (game.quad[lookx][looky] != IHDOT) {\r
                                /* See if we should ram ship */\r
-                               if (frozen.quad[lookx][looky] == ship &&\r
+                               if (game.quad[lookx][looky] == ship &&\r
                                        (ienm == IHC || ienm == IHS)) {\r
                                        ram(1, ienm, comx, comy);\r
                                        return;\r
@@ -250,17 +250,17 @@ static void movebaddy(int comx, int comy, int loccom, int ienm) {
                else break; /* done early */\r
        }\r
        /* Put commander in place within same quadrant */\r
-       frozen.quad[nextx][nexty] = ienm;\r
+       game.quad[nextx][nexty] = ienm;\r
        if (nextx != comx || nexty != comy) {\r
                /* it moved */\r
-               frozen.kx[loccom] = nextx;\r
-               frozen.ky[loccom] = nexty;\r
-               frozen.kdist[loccom] = frozen.kavgd[loccom] =\r
+               game.kx[loccom] = nextx;\r
+               game.ky[loccom] = nexty;\r
+               game.kdist[loccom] = game.kavgd[loccom] =\r
                                        sqrt(square(sectx-nextx)+square(secty-nexty));\r
-               if (frozen.damage[DSRSENS] == 0 || condit == IHDOCKED) {\r
+               if (game.damage[DSRSENS] == 0 || condit == IHDOCKED) {\r
                        proutn("***");\r
                        cramen(ienm);\r
-                       if (frozen.kdist[loccom] < dist1) proutn(" advances to");\r
+                       if (game.kdist[loccom] < dist1) proutn(" advances to");\r
                        else proutn(" retreats to");\r
                        cramlc(2, nextx, nexty);\r
                        skip(1);\r
@@ -278,17 +278,17 @@ void movcom(void) {
        /* Figure out which Klingon is the commander (or Supercommander)\r
           and do move */\r
        if (comhere) for (i = 1; i <= nenhere; i++) {\r
-               ix = frozen.kx[i];\r
-               iy = frozen.ky[i];\r
-               if (frozen.quad[ix][iy] == IHC) {\r
+               ix = game.kx[i];\r
+               iy = game.ky[i];\r
+               if (game.quad[ix][iy] == IHC) {\r
                        movebaddy(ix, iy, i, IHC);\r
                        break;\r
                }\r
        }\r
        if (ishere) for (i = 1; i <= nenhere; i++) {\r
-               ix = frozen.kx[i];\r
-               iy = frozen.ky[i];\r
-               if (frozen.quad[ix][iy] == IHS) {\r
+               ix = game.kx[i];\r
+               iy = game.ky[i];\r
+               if (game.quad[ix][iy] == IHS) {\r
                        movebaddy(ix, iy, i, IHS);\r
                        break;\r
                }\r
@@ -297,10 +297,10 @@ void movcom(void) {
           Move these last so they can base their actions on what the\r
        commander(s) do. */\r
        if (skill > 3) for (i = 1; i <= nenhere; i++) {\r
-               ix = frozen.kx[i];\r
-               iy = frozen.ky[i];\r
-               if (frozen.quad[ix][iy] == IHK || frozen.quad[ix][iy] == IHR)\r
-                       movebaddy(ix, iy, i, frozen.quad[ix][iy]);\r
+               ix = game.kx[i];\r
+               iy = game.ky[i];\r
+               if (game.quad[ix][iy] == IHK || game.quad[ix][iy] == IHR)\r
+                       movebaddy(ix, iy, i, game.quad[ix][iy]);\r
        }\r
 \r
        sortkl();\r
@@ -311,33 +311,33 @@ static int checkdest(int iqx, int iqy, int flag, int *ipage) {
 \r
        if ((iqx==quadx && iqy==quady) ||\r
                iqx < 1 || iqx > 8 || iqy < 1 || iqy > 8 ||\r
-               state.galaxy[iqx][iqy] > 899) return 1;\r
+               game.state.galaxy[iqx][iqy] > 899) return 1;\r
        if (flag) {\r
                /* Avoid quadrants with bases if we want to avoid Enterprise */\r
-               for (i = 1; i <= state.rembase; i++)\r
-                       if (state.baseqx[i]==iqx && state.baseqy[i]==iqy) return 1;\r
+               for (i = 1; i <= game.state.rembase; i++)\r
+                       if (game.state.baseqx[i]==iqx && game.state.baseqy[i]==iqy) return 1;\r
        }\r
 \r
        /* do the move */\r
-       state.galaxy[state.isx][state.isy] -= 100;\r
-       state.isx = iqx;\r
-       state.isy = iqy;\r
-       state.galaxy[state.isx][state.isy] += 100;\r
+       game.state.galaxy[game.state.isx][game.state.isy] -= 100;\r
+       game.state.isx = iqx;\r
+       game.state.isy = iqy;\r
+       game.state.galaxy[game.state.isx][game.state.isy] += 100;\r
        if (iscate) {\r
                /* SC has scooted, Remove him from current quadrant */\r
                iscate=0;\r
                isatb=0;\r
                ishere=0;\r
                ientesc=0;\r
-               frozen.future[FSCDBAS]=1e30;\r
+               game.future[FSCDBAS]=1e30;\r
                for (i = 1; i <= nenhere; i++) \r
-                       if (frozen.quad[frozen.kx[i]][frozen.ky[i]] == IHS) break;\r
-               frozen.quad[frozen.kx[i]][frozen.ky[i]] = IHDOT;\r
-               frozen.kx[i] = frozen.kx[nenhere];\r
-               frozen.ky[i] = frozen.ky[nenhere];\r
-               frozen.kdist[i] = frozen.kdist[nenhere];\r
-               frozen.kavgd[i] = frozen.kavgd[nenhere];\r
-               frozen.kpower[i] = frozen.kpower[nenhere];\r
+                       if (game.quad[game.kx[i]][game.ky[i]] == IHS) break;\r
+               game.quad[game.kx[i]][game.ky[i]] = IHDOT;\r
+               game.kx[i] = game.kx[nenhere];\r
+               game.ky[i] = game.ky[nenhere];\r
+               game.kdist[i] = game.kdist[nenhere];\r
+               game.kavgd[i] = game.kavgd[nenhere];\r
+               game.kpower[i] = game.kpower[nenhere];\r
                klhere--;\r
                nenhere--;\r
                if (condit!=IHDOCKED) newcnd();\r
@@ -345,17 +345,17 @@ static int checkdest(int iqx, int iqy, int flag, int *ipage) {
        }\r
        /* check for a helpful planet */\r
        for (i = 1; i <= inplan; i++) {\r
-               if (state.plnets[i].x==state.isx && state.plnets[i].y==state.isy &&\r
-                       state.plnets[i].crystals == 1) {\r
+               if (game.state.plnets[i].x==game.state.isx && game.state.plnets[i].y==game.state.isy &&\r
+                       game.state.plnets[i].crystals == 1) {\r
                        /* destroy the planet */\r
-                       state.plnets[i] = nulplanet;\r
-                       state.newstuf[state.isx][state.isy] -= 1;\r
-                       if (frozen.damage[DRADIO] == 0.0 || condit == IHDOCKED) {\r
+                       game.state.plnets[i] = nulplanet;\r
+                       game.state.newstuf[game.state.isx][game.state.isy] -= 1;\r
+                       if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED) {\r
                                if (*ipage==0) pause(1);\r
                                *ipage = 1;\r
                                prout("Lt. Uhura-  \"Captain, Starfleet Intelligence reports");\r
                                proutn("   a planet in");\r
-                               cramlc(1, state.isx, state.isy);\r
+                               cramlc(1, game.state.isx, game.state.isy);\r
                                prout(" has been destroyed");\r
                                prout("   by the Super-commander.\"");\r
                        }\r
@@ -380,39 +380,39 @@ void scom(int *ipage) {
 #endif\r
 \r
        /* Decide on being active or passive */\r
-       flag = ((state.killc+state.killk)/(state.date+0.01-indate) < 0.1*skill*(skill+1.0) ||\r
-                       (state.date-indate) < 3.0);\r
+       flag = ((game.state.killc+game.state.killk)/(game.state.date+0.01-indate) < 0.1*skill*(skill+1.0) ||\r
+                       (game.state.date-indate) < 3.0);\r
        if (iscate==0 && flag) {\r
                /* compute move away from Enterprise */\r
-               ideltax = state.isx-quadx;\r
-               ideltay = state.isy-quady;\r
+               ideltax = game.state.isx-quadx;\r
+               ideltay = game.state.isy-quady;\r
                if (sqrt(ideltax*(double)ideltax+ideltay*(double)ideltay) > 2.0) {\r
                        /* circulate in space */\r
-                       ideltax = state.isy-quady;\r
-                       ideltay = quadx-state.isx;\r
+                       ideltax = game.state.isy-quady;\r
+                       ideltay = quadx-game.state.isx;\r
                }\r
        }\r
        else {\r
                /* compute distances to starbases */\r
-               if (state.rembase <= 0) {\r
+               if (game.state.rembase <= 0) {\r
                        /* nothing left to do */\r
-                       frozen.future[FSCMOVE] = 1e30;\r
+                       game.future[FSCMOVE] = 1e30;\r
                        return;\r
                }\r
-               sx = state.isx;\r
-               sy = state.isy;\r
-               for (i = 1; i <= state.rembase; i++) {\r
+               sx = game.state.isx;\r
+               sy = game.state.isy;\r
+               for (i = 1; i <= game.state.rembase; i++) {\r
                        basetbl[i] = i;\r
-                       ibqx = state.baseqx[i];\r
-                       ibqy = state.baseqy[i];\r
+                       ibqx = game.state.baseqx[i];\r
+                       ibqy = game.state.baseqy[i];\r
                        bdist[i] = sqrt(square(ibqx-sx) + square(ibqy-sy));\r
                }\r
-               if (state.rembase > 1) {\r
+               if (game.state.rembase > 1) {\r
                        /* sort into nearest first order */\r
                        int iswitch;\r
                        do {\r
                                iswitch = 0;\r
-                               for (i=1; i < state.rembase-1; i++) {\r
+                               for (i=1; i < game.state.rembase-1; i++) {\r
                                        if (bdist[i] > bdist[i+1]) {\r
                                                int ti = basetbl[i];\r
                                                double t = bdist[i];\r
@@ -429,34 +429,34 @@ void scom(int *ipage) {
                   without too many Klingons, and not already under attack. */\r
                ifindit = iwhichb = 0;\r
 \r
-               for (i2 = 1; i2 <= state.rembase; i2++) {\r
+               for (i2 = 1; i2 <= game.state.rembase; i2++) {\r
                        i = basetbl[i2];        /* bug in original had it not finding nearest*/\r
-                       ibqx = state.baseqx[i];\r
-                       ibqy = state.baseqy[i];\r
+                       ibqx = game.state.baseqx[i];\r
+                       ibqy = game.state.baseqy[i];\r
                        if ((ibqx == quadx && ibqy == quady) ||\r
                                (ibqx == batx && ibqy == baty) ||\r
-                               state.galaxy[ibqx][ibqy] > 899) continue;\r
+                               game.state.galaxy[ibqx][ibqy] > 899) continue;\r
                        /* if there is a commander, an no other base is appropriate,\r
                           we will take the one with the commander */\r
-                       for (j = 1; j <= state.remcom; j++) {\r
-                               if (ibqx==state.cx[j] && ibqy==state.cy[j] && ifindit!= 2) {\r
+                       for (j = 1; j <= game.state.remcom; j++) {\r
+                               if (ibqx==game.state.cx[j] && ibqy==game.state.cy[j] && ifindit!= 2) {\r
                                                ifindit = 2;\r
                                                iwhichb = i;\r
                                                break;\r
                                }\r
                        }\r
-                       if (j > state.remcom) { /* no commander -- use this one */\r
+                       if (j > game.state.remcom) { /* no commander -- use this one */\r
                                ifindit = 1;\r
                                iwhichb = i;\r
                                break;\r
                        }\r
                }\r
                if (ifindit==0) return; /* Nothing suitable -- wait until next time*/\r
-               ibqx = state.baseqx[iwhichb];\r
-               ibqy = state.baseqy[iwhichb];\r
+               ibqx = game.state.baseqx[iwhichb];\r
+               ibqy = game.state.baseqy[iwhichb];\r
                /* decide how to move toward base */\r
-               ideltax = ibqx - state.isx;\r
-               ideltay = ibqy - state.isy;\r
+               ideltax = ibqx - game.state.isx;\r
+               ideltay = ibqy - game.state.isy;\r
        }\r
        /* Maximum movement is 1 quadrant in either or both axis */\r
        if (ideltax > 1) ideltax = 1;\r
@@ -465,62 +465,62 @@ void scom(int *ipage) {
        if (ideltay < -1) ideltay = -1;\r
 \r
        /* try moving in both x and y directions */\r
-       iqx = state.isx + ideltax;\r
-       iqy = state.isy + ideltax;\r
+       iqx = game.state.isx + ideltax;\r
+       iqy = game.state.isy + ideltax;\r
        if (checkdest(iqx, iqy, flag, ipage)) {\r
                /* failed -- try some other maneuvers */\r
                if (ideltax==0 || ideltay==0) {\r
                        /* attempt angle move */\r
                        if (ideltax != 0) {\r
-                               iqy = state.isy + 1;\r
+                               iqy = game.state.isy + 1;\r
                                if (checkdest(iqx, iqy, flag, ipage)) {\r
-                                       iqy = state.isy - 1;\r
+                                       iqy = game.state.isy - 1;\r
                                        checkdest(iqx, iqy, flag, ipage);\r
                                }\r
                        }\r
                        else {\r
-                               iqx = state.isx + 1;\r
+                               iqx = game.state.isx + 1;\r
                                if (checkdest(iqx, iqy, flag, ipage)) {\r
-                                       iqx = state.isx - 1;\r
+                                       iqx = game.state.isx - 1;\r
                                        checkdest(iqx, iqy, flag, ipage);\r
                                }\r
                        }\r
                }\r
                else {\r
                        /* try moving just in x or y */\r
-                       iqy = state.isy;\r
+                       iqy = game.state.isy;\r
                        if (checkdest(iqx, iqy, flag, ipage)) {\r
-                               iqy = state.isy + ideltay;\r
-                               iqx = state.isx;\r
+                               iqy = game.state.isy + ideltay;\r
+                               iqx = game.state.isx;\r
                                checkdest(iqx, iqy, flag, ipage);\r
                        }\r
                }\r
        }\r
        /* check for a base */\r
-       if (state.rembase == 0) {\r
-               frozen.future[FSCMOVE] = 1e30;\r
+       if (game.state.rembase == 0) {\r
+               game.future[FSCMOVE] = 1e30;\r
        }\r
-       else for (i=1; i<=state.rembase; i++) {\r
-               ibqx = state.baseqx[i];\r
-               ibqy = state.baseqy[i];\r
-               if (ibqx==state.isx && ibqy == state.isy && state.isx != batx && state.isy != baty) {\r
+       else for (i=1; i<=game.state.rembase; i++) {\r
+               ibqx = game.state.baseqx[i];\r
+               ibqy = game.state.baseqy[i];\r
+               if (ibqx==game.state.isx && ibqy == game.state.isy && game.state.isx != batx && game.state.isy != baty) {\r
                        /* attack the base */\r
                        if (flag) return; /* no, don't attack base! */\r
                        iseenit = 0;\r
                        isatb=1;\r
-                       frozen.future[FSCDBAS] = state.date + 1.0 +2.0*Rand();\r
-                       if (batx != 0) frozen.future[FSCDBAS] += frozen.future[FCDBAS]-state.date;\r
-                       if (frozen.damage[DRADIO] > 0 && condit != IHDOCKED)\r
+                       game.future[FSCDBAS] = game.state.date + 1.0 +2.0*Rand();\r
+                       if (batx != 0) game.future[FSCDBAS] += game.future[FCDBAS]-game.state.date;\r
+                       if (game.damage[DRADIO] > 0 && condit != IHDOCKED)\r
                                return; /* no warning */\r
                        iseenit = 1;\r
                        if (*ipage == 0)  pause(1);\r
                        *ipage=1;\r
                        proutn("Lt. Uhura-  \"Captain, the starbase in");\r
-                       cramlc(1, state.isx, state.isy);\r
+                       cramlc(1, game.state.isx, game.state.isy);\r
                        skip(1);\r
                        prout("   reports that it is under attack from the Klingon Super-commander.");\r
                        proutn("   It can survive until stardate ");\r
-                       cramf(frozen.future[FSCDBAS], 0, 1);\r
+                       cramf(game.future[FSCDBAS], 0, 1);\r
                        prout(" .\"");\r
                        if (resting==0) return;\r
                        prout("Mr. Spock-  \"Captain, shall we cancel the rest period?\"");\r
@@ -536,14 +536,14 @@ void scom(int *ipage) {
                idebug==0 &&\r
 #endif\r
                (Rand() > 0.2 ||\r
-                (frozen.damage[DRADIO] > 0.0 && condit != IHDOCKED) ||\r
-                frozen.starch[state.isx][state.isy] > 0))\r
+                (game.damage[DRADIO] > 0.0 && condit != IHDOCKED) ||\r
+                game.starch[game.state.isx][game.state.isy] > 0))\r
                return;\r
        if (*ipage==0) pause(1);\r
        *ipage = 1;\r
        prout("Lt. Uhura-  \"Captain, Starfleet Intelligence reports");\r
        proutn("   the Super-commander is in");\r
-       cramlc(1, state.isx, state. isy);\r
+       cramlc(1, game.state.isx, game.state. isy);\r
        prout(".\"");\r
        return;\r
 }\r
@@ -572,15 +572,15 @@ void movetho(void) {
        }\r
 \r
        /* Do nothing if we are blocked */\r
-       if (frozen.quad[idx][idy]!= IHDOT && frozen.quad[idx][idy]!= IHWEB) return;\r
-       frozen.quad[ithx][ithy] = IHWEB;\r
+       if (game.quad[idx][idy]!= IHDOT && game.quad[idx][idy]!= IHWEB) return;\r
+       game.quad[ithx][ithy] = IHWEB;\r
 \r
        if (ithx != idx) {\r
                /* move in x axis */\r
                im = fabs((double)idx - ithx)/((double)idx - ithx);\r
                while (ithx != idx) {\r
                        ithx += im;\r
-                       if (frozen.quad[ithx][ithy]==IHDOT) frozen.quad[ithx][ithy] = IHWEB;\r
+                       if (game.quad[ithx][ithy]==IHDOT) game.quad[ithx][ithy] = IHWEB;\r
                }\r
        }\r
        else if (ithy != idy) {\r
@@ -588,20 +588,20 @@ void movetho(void) {
                im = fabs((double)idy - ithy)/((double)idy - ithy);\r
                while (ithy != idy) {\r
                        ithy += im;\r
-                       if (frozen.quad[ithx][ithy]==IHDOT) frozen.quad[ithx][ithy] = IHWEB;\r
+                       if (game.quad[ithx][ithy]==IHDOT) game.quad[ithx][ithy] = IHWEB;\r
                }\r
        }\r
-       frozen.quad[ithx][ithy] = IHT;\r
+       game.quad[ithx][ithy] = IHT;\r
 \r
        /* check to see if all holes plugged */\r
        for (i = 1; i < 11; i++) {\r
-               if (frozen.quad[1][i]!=IHWEB && frozen.quad[1][i]!=IHT) return;\r
-               if (frozen.quad[10][i]!=IHWEB && frozen.quad[10][i]!=IHT) return;\r
-               if (frozen.quad[i][1]!=IHWEB && frozen.quad[i][1]!=IHT) return;\r
-               if (frozen.quad[i][10]!=IHWEB && frozen.quad[i][10]!=IHT) return;\r
+               if (game.quad[1][i]!=IHWEB && game.quad[1][i]!=IHT) return;\r
+               if (game.quad[10][i]!=IHWEB && game.quad[10][i]!=IHT) return;\r
+               if (game.quad[i][1]!=IHWEB && game.quad[i][1]!=IHT) return;\r
+               if (game.quad[i][10]!=IHWEB && game.quad[i][10]!=IHT) return;\r
        }\r
        /* All plugged up -- Tholian splits */\r
-       frozen.quad[ithx][ithy]=IHWEB;\r
+       game.quad[ithx][ithy]=IHWEB;\r
        dropin(IHBLANK, &dum, &my);\r
        crmena(1,IHT, 2, ithx, ithy);\r
        prout(" completes web.");\r