Commit | Line | Data |
---|---|---|
b5f0675e | 1 | /* |
1e008c14 DF |
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. | |
b5f0675e EW |
5 | */ |
6 | ||
cd818f56 | 7 | #ifndef lint |
1e008c14 DF |
8 | static char sccsid[] = "@(#)game.c 5.1 (Berkeley) %G%"; |
9 | #endif not lint | |
cd818f56 | 10 | |
7fc06086 | 11 | #include "externs.h" |
cd818f56 | 12 | |
6c17b19a | 13 | maxturns(ship, af) |
b3a57661 | 14 | register struct ship *ship; |
6c17b19a | 15 | char *af; |
cd818f56 | 16 | { |
7fc06086 | 17 | register int turns; |
cd818f56 | 18 | |
b3a57661 | 19 | turns = ship->specs->ta; |
6c17b19a | 20 | if (*af = (ship->file->drift > 1 && turns)) { |
cd818f56 | 21 | turns--; |
b3a57661 | 22 | if (ship->file->FS == 1) |
cd818f56 | 23 | turns = 0; |
cd818f56 | 24 | } |
b3a57661 | 25 | return turns; |
cd818f56 CL |
26 | } |
27 | ||
b3a57661 EW |
28 | maxmove(ship, dir, fs) |
29 | register struct ship *ship; | |
30 | int dir, fs; | |
cd818f56 | 31 | { |
b3a57661 | 32 | register int riggone = 0, Move, flank = 0; |
cd818f56 | 33 | |
b3a57661 EW |
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) { | |
cd818f56 | 44 | flank = 1; |
b3a57661 | 45 | Move = ship->specs->fs; |
cd818f56 CL |
46 | } |
47 | if (dir == winddir) | |
b3a57661 | 48 | Move -= 1 + WET[windspeed][ship->specs->class-1].B; |
cd818f56 | 49 | else if (dir == winddir + 2 || dir == winddir - 2 || dir == winddir - 6 || dir == winddir + 6) |
b3a57661 | 50 | Move -= 1 + WET[windspeed][ship->specs->class-1].C; |
cd818f56 | 51 | else if (dir == winddir + 3 || dir == winddir - 3 || dir == winddir - 5 || dir == winddir + 5) |
b3a57661 | 52 | Move = (flank ? 2 : 1) - WET[windspeed][ship->specs->class-1].D; |
cd818f56 CL |
53 | else if (dir == winddir + 4 || dir == winddir - 4) |
54 | Move = 0; | |
55 | else | |
b3a57661 | 56 | Move -= WET[windspeed][ship->specs->class-1].A; |
cd818f56 CL |
57 | Move -= riggone; |
58 | Move = Move < 0 ? 0 : Move; | |
59 | return(Move); | |
60 | } |