# 2.11BSD#431 - /usr/src/games/sail/game.c

##### Functions

    maxmove           X
    maxturns          X

       1: /*
       2:  * Copyright (c) 1983 Regents of the University of California.
       3:  * All rights reserved.  The Berkeley software License Agreement
       4:  * specifies the terms and conditions for redistribution.
       5:  */
       6:
       7: #ifndef lint
       8: static char sccsid[] = "@(#)game.c	5.1 (Berkeley) 5/29/85";
       9: #endif not lint
      10:
      11: #include "externs.h"
      12:
      13: maxturns(ship, af)
      14: register struct ship *ship;
      15: char *af;
      16: {
      17:     register int turns;
      18:
      19:     turns = ship->specs->ta;
      20:     if (*af = (ship->file->drift > 1 && turns)) {
      21:         turns--;
      22:         if (ship->file->FS == 1)
      23:             turns = 0;
      24:     }
      25:     return turns;
      26: }
      27:
      28: maxmove(ship, dir, fs)
      29: register struct ship *ship;
      30: int dir, fs;
      31: {
      32:     register int riggone = 0, Move, flank = 0;
      33:
      34:     Move = ship->specs->bs;
      35:     if (!ship->specs->rig1)
      36:         riggone++;
      37:     if (!ship->specs->rig2)
      38:         riggone++;
      39:     if (!ship->specs->rig3)
      40:         riggone++;
      41:     if (!ship->specs->rig4)
      42:         riggone++;
      43:     if ((ship->file->FS || fs) && fs != -1) {
      44:         flank = 1;
      45:         Move = ship->specs->fs;
      46:     }
      47:     if (dir == winddir)
      48:         Move -= 1 + WET[windspeed][ship->specs->class-1].B;
      49:     else if (dir == winddir + 2 || dir == winddir - 2 || dir == winddir - 6 || dir == winddir + 6)
      50:         Move -= 1 + WET[windspeed][ship->specs->class-1].C;
      51:     else if (dir == winddir + 3 || dir == winddir - 3 || dir == winddir - 5 || dir == winddir + 5)
      52:         Move = (flank ? 2 : 1) - WET[windspeed][ship->specs->class-1].D;
      53:     else if (dir == winddir + 4 || dir == winddir - 4)
      54:         Move = 0;
      55:     else
      56:         Move -= WET[windspeed][ship->specs->class-1].A;
      57:     Move -= riggone;
      58:     Move = Move < 0 ? 0 : Move;
      59:     return(Move);
      60: }

#### Defined functions

maxmove defined in line 28; used 13 times

- in /usr/src/games/sail/dr_2.c line 224, 234
- in /usr/src/games/sail/dr_3.c line 34
- in /usr/src/games/sail/pl_5.c line 32, 54
- in /usr/src/games/sail/pl_7.c line 261-273(8)

maxturns defined in line 13; used 2 times

- in /usr/src/games/sail/dr_3.c line 33
- in /usr/src/games/sail/pl_5.c line 31

#### Defined variables

sccsid defined in line 8; never used

Last modified: 1985-05-30 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 903 |