home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume4 / xconq5 / part17 / global.h next >
C/C++ Source or Header  |  1988-07-01  |  2KB  |  51 lines

  1. /* Copyright (c) 1987, 1988  Stanley T. Shebs, University of Utah. */
  2. /* This program may be used, copied, modified, and redistributed freely */
  3. /* for noncommercial purposes, so long as this notice remains intact. */
  4.  
  5. /* RCS $Header: global.h,v 1.1 88/06/21 12:29:41 shebs Exp $ */
  6.  
  7. /* Global data structures. */
  8.  
  9. /* There is actually no inherent limit on the number of winning and losing */
  10. /* conditions, but scenarios usually only need a couple. */
  11.  
  12. #define NUMCONDS 10
  13.  
  14. /* Not many types of conditions (probably could think of a few more). */
  15.  
  16. #define TERRITORY 0
  17. #define UNITCOUNT 1
  18. #define RESOURCECOUNT 2
  19. #define POSSESSION 3
  20.  
  21. /* Win/lose conditions can take several different forms.  Some of these */
  22. /* slots could be glommed into a union, but so what... */
  23.  
  24. typedef struct a_condition {
  25.     bool win;                   /* is this a condition of winning or losing? */
  26.     int type;                   /* based on units, resources, or location? */
  27.     int starttime;              /* first turn to check on condition */
  28.     int endtime;                /* last turn to check on condition */
  29.     int sidesn;                 /* side number to which this cond applies */
  30.     int units[MAXUTYPES];       /* numbers for each type of unit */
  31.     int resources[MAXRTYPES];   /* numbers for each type of resource */
  32.     int x, y;                   /* a location */
  33.     int n;                      /* a vanilla value */
  34. } Condition;
  35.  
  36. /* Definition of structure containing all global variables. */
  37.  
  38. typedef struct a_global {
  39.     int time;            /* the current turn */
  40.     int endtime;                /* the last turn of the game */
  41.     bool setproduct;            /* true if production changes allowed */
  42.     bool leavemap;              /* true if units can leave the map */
  43.     int numconds;               /* number of conditions... */
  44.     Condition winlose[NUMCONDS];  /* and space for the conditions themselves */
  45. } Global;
  46.  
  47. /* Just have the one "global" object. */
  48.  
  49. extern Global global;
  50.  
  51.