Annotation of 43BSDReno/games/trek/rest.c, revision 1.1.1.1

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 provided
                      6:  * that: (1) source distributions retain this entire copyright notice and
                      7:  * comment, and (2) distributions including binaries display the following
                      8:  * acknowledgement:  ``This product includes software developed by the
                      9:  * University of California, Berkeley and its contributors'' in the
                     10:  * documentation or other materials provided with the distribution and in
                     11:  * all advertising materials mentioning features or use of this software.
                     12:  * Neither the name of the University nor the names of its contributors may
                     13:  * be used to endorse or promote products derived from this software without
                     14:  * specific prior written permission.
                     15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     16:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     17:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     18:  */
                     19: 
                     20: #ifndef lint
                     21: static char sccsid[] = "@(#)rest.c     5.4 (Berkeley) 6/1/90";
                     22: #endif /* not lint */
                     23: 
                     24: # include      "trek.h"
                     25: # include      "getpar.h"
                     26: 
                     27: /*
                     28: **  REST FOR REPAIRS
                     29: **
                     30: **     You sit around and wait for repairs to happen.  Actually, you
                     31: **     sit around and wait for anything to happen.  I do want to point
                     32: **     out however, that Klingons are not as patient as you are, and
                     33: **     they tend to attack you while you are resting.
                     34: **
                     35: **     You can never rest through a long range tractor beam.
                     36: **
                     37: **     In events() you will be given an opportunity to cancel the
                     38: **     rest period if anything momentous happens.
                     39: */
                     40: 
                     41: rest()
                     42: {
                     43:        double                  t;
                     44:        register int            percent;
                     45: 
                     46:        /* get the time to rest */
                     47:        t = getfltpar("How long");
                     48:        if (t <= 0.0)
                     49:                return;
                     50:        percent = 100 * t / Now.time + 0.5;
                     51:        if (percent >= 70)
                     52:        {
                     53:                printf("Spock: That would take %d%% of our remaining time.\n",
                     54:                        percent);
                     55:                if (!getynpar("Are you really certain that is wise"))
                     56:                        return;
                     57:        }
                     58:        Move.time = t;
                     59: 
                     60:        /* boundary condition is the LRTB */
                     61:        t = Now.eventptr[E_LRTB]->date - Now.date;
                     62:        if (Ship.cond != DOCKED && Move.time > t)
                     63:                Move.time = t + 0.0001;
                     64:        Move.free = 0;
                     65:        Move.resting = 1;
                     66: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.