Commit | Line | Data |
---|---|---|
b5f0675e | 1 | /* |
1e008c14 | 2 | * Copyright (c) 1983 Regents of the University of California. |
c0ca48ec KB |
3 | * All rights reserved. |
4 | * | |
5 | * Redistribution and use in source and binary forms are permitted | |
65c7d3b6 KB |
6 | * provided that the above copyright notice and this paragraph are |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
b5f0675e EW |
16 | */ |
17 | ||
cd818f56 | 18 | #ifndef lint |
65c7d3b6 | 19 | static char sccsid[] = "@(#)game.c 5.3 (Berkeley) %G%"; |
c0ca48ec | 20 | #endif /* not lint */ |
cd818f56 | 21 | |
7fc06086 | 22 | #include "externs.h" |
cd818f56 | 23 | |
6c17b19a | 24 | maxturns(ship, af) |
b3a57661 | 25 | register struct ship *ship; |
6c17b19a | 26 | char *af; |
cd818f56 | 27 | { |
7fc06086 | 28 | register int turns; |
cd818f56 | 29 | |
b3a57661 | 30 | turns = ship->specs->ta; |
6c17b19a | 31 | if (*af = (ship->file->drift > 1 && turns)) { |
cd818f56 | 32 | turns--; |
b3a57661 | 33 | if (ship->file->FS == 1) |
cd818f56 | 34 | turns = 0; |
cd818f56 | 35 | } |
b3a57661 | 36 | return turns; |
cd818f56 CL |
37 | } |
38 | ||
b3a57661 EW |
39 | maxmove(ship, dir, fs) |
40 | register struct ship *ship; | |
41 | int dir, fs; | |
cd818f56 | 42 | { |
b3a57661 | 43 | register int riggone = 0, Move, flank = 0; |
cd818f56 | 44 | |
b3a57661 EW |
45 | Move = ship->specs->bs; |
46 | if (!ship->specs->rig1) | |
47 | riggone++; | |
48 | if (!ship->specs->rig2) | |
49 | riggone++; | |
50 | if (!ship->specs->rig3) | |
51 | riggone++; | |
52 | if (!ship->specs->rig4) | |
53 | riggone++; | |
54 | if ((ship->file->FS || fs) && fs != -1) { | |
cd818f56 | 55 | flank = 1; |
b3a57661 | 56 | Move = ship->specs->fs; |
cd818f56 CL |
57 | } |
58 | if (dir == winddir) | |
b3a57661 | 59 | Move -= 1 + WET[windspeed][ship->specs->class-1].B; |
cd818f56 | 60 | else if (dir == winddir + 2 || dir == winddir - 2 || dir == winddir - 6 || dir == winddir + 6) |
b3a57661 | 61 | Move -= 1 + WET[windspeed][ship->specs->class-1].C; |
cd818f56 | 62 | else if (dir == winddir + 3 || dir == winddir - 3 || dir == winddir - 5 || dir == winddir + 5) |
b3a57661 | 63 | Move = (flank ? 2 : 1) - WET[windspeed][ship->specs->class-1].D; |
cd818f56 CL |
64 | else if (dir == winddir + 4 || dir == winddir - 4) |
65 | Move = 0; | |
66 | else | |
b3a57661 | 67 | Move -= WET[windspeed][ship->specs->class-1].A; |
cd818f56 CL |
68 | Move -= riggone; |
69 | Move = Move < 0 ? 0 : Move; | |
70 | return(Move); | |
71 | } |