|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted ! 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. ! 16: */ ! 17: ! 18: #ifndef lint ! 19: static char sccsid[] = "@(#)checkcond.c 5.3 (Berkeley) 6/18/88"; ! 20: #endif /* not lint */ ! 21: ! 22: # include "trek.h" ! 23: ! 24: /* ! 25: ** Check for Condition After a Move ! 26: ** ! 27: ** Various ship conditions are checked. First we check ! 28: ** to see if we have already lost the game, due to running ! 29: ** out of life support reserves, running out of energy, ! 30: ** or running out of crew members. The check for running ! 31: ** out of time is in events(). ! 32: ** ! 33: ** If we are in automatic override mode (Etc.nkling < 0), we ! 34: ** don't want to do anything else, lest we call autover ! 35: ** recursively. ! 36: ** ! 37: ** In the normal case, if there is a supernova, we call ! 38: ** autover() to help us escape. If after calling autover() ! 39: ** we are still in the grips of a supernova, we get burnt ! 40: ** up. ! 41: ** ! 42: ** If there are no Klingons in this quadrant, we nullify any ! 43: ** distress calls which might exist. ! 44: ** ! 45: ** We then set the condition code, based on the energy level ! 46: ** and battle conditions. ! 47: */ ! 48: ! 49: checkcond() ! 50: { ! 51: register int i, j; ! 52: ! 53: /* see if we are still alive and well */ ! 54: if (Ship.reserves < 0.0) ! 55: lose(L_NOLIFE); ! 56: if (Ship.energy <= 0) ! 57: lose(L_NOENGY); ! 58: if (Ship.crew <= 0) ! 59: lose(L_NOCREW); ! 60: /* if in auto override mode, ignore the rest */ ! 61: if (Etc.nkling < 0) ! 62: return; ! 63: /* call in automatic override if appropriate */ ! 64: if (Quad[Ship.quadx][Ship.quady].stars < 0) ! 65: autover(); ! 66: if (Quad[Ship.quadx][Ship.quady].stars < 0) ! 67: lose(L_SNOVA); ! 68: /* nullify distress call if appropriate */ ! 69: if (Etc.nkling <= 0) ! 70: killd(Ship.quadx, Ship.quady, 1); ! 71: ! 72: /* set condition code */ ! 73: if (Ship.cond == DOCKED) ! 74: return; ! 75: ! 76: if (Etc.nkling > 0) ! 77: { ! 78: Ship.cond = RED; ! 79: return; ! 80: } ! 81: if (Ship.energy < Param.energylow) ! 82: { ! 83: Ship.cond = YELLOW; ! 84: return; ! 85: } ! 86: Ship.cond = GREEN; ! 87: return; ! 88: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.