BSD 4_3_Tahoe release
[unix-history] / usr / src / games / sail / dr_1.c
index 89fde55..04884aa 100644 (file)
@@ -1,12 +1,23 @@
 /*
 /*
- * Copyright (c) 1983 Regents of the University of California,
- * All rights reserved.  Redistribution permitted subject to
- * the terms of the Berkeley Software License Agreement.
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char *sccsid = "@(#)dr_1.c      2.13 85/04/25";
-#endif
+static char sccsid[] = "@(#)dr_1.c     5.3 (Berkeley) 6/18/88";
+#endif /* not lint */
 
 #include "driver.h"
 
 
 #include "driver.h"
 
@@ -388,49 +399,47 @@ next()
                                [sizeof bestship->file->captain - 1] = 0;
                        log(bestship);
                }
                                [sizeof bestship->file->captain - 1] = 0;
                        log(bestship);
                }
-               sync_close(1);
-               exit(0);
+               return -1;
        }
        Write(W_TURN, SHIP(0), 0, turn, 0, 0, 0);
        }
        Write(W_TURN, SHIP(0), 0, turn, 0, 0, 0);
-       if (turn % 7 == 0) {
-               if (die() >= cc->windchange || !windspeed) {
+       if (turn % 7 == 0 && (die() >= cc->windchange || !windspeed)) {
+               switch (die()) {
+               case 1:
+                       winddir = 1;
+                       break;
+               case 2:
+                       break;
+               case 3:
+                       winddir++;
+                       break;
+               case 4:
+                       winddir--;
+                       break;
+               case 5:
+                       winddir += 2;
+                       break;
+               case 6:
+                       winddir -= 2;
+                       break;
+               }
+               if (winddir > 8)
+                       winddir -= 8;
+               if (winddir < 1)
+                       winddir += 8;
+               if (windspeed)
                        switch (die()) {
                        case 1:
                        switch (die()) {
                        case 1:
-                               winddir = 1;
-                               break;
                        case 2:
                        case 2:
-                               break;
-                       case 3:
-                               winddir++;
-                               break;
-                       case 4:
-                               winddir--;
+                               windspeed--;
                                break;
                        case 5:
                                break;
                        case 5:
-                               winddir += 2;
-                               break;
                        case 6:
                        case 6:
-                               winddir -= 2;
+                               windspeed++;
                                break;
                        }
                                break;
                        }
-                       if (winddir > 8)
-                               winddir -= 8;
-                       if (winddir < 1)
-                               winddir += 8;
-                       if (windspeed)
-                               switch (die()) {
-                               case 1:
-                               case 2:
-                                       windspeed--;
-                                       break;
-                               case 5:
-                               case 6:
-                                       windspeed++;
-                                       break;
-                               }
-                       else
-                               windspeed++;
-                       Write(W_WIND, SHIP(0), 0, winddir, windspeed, 0, 0);
-               }
+               else
+                       windspeed++;
+               Write(W_WIND, SHIP(0), 0, winddir, windspeed, 0, 0);
        }
        }
+       return 0;
 }
 }