home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume13 / dominion / part26 / misc.h < prev    next >
C/C++ Source or Header  |  1992-02-11  |  8KB  |  215 lines

  1.  /* misc.h - various definitions used in dominion */
  2.  
  3. /*
  4.  * Copyright (C) 1990 Free Software Foundation, Inc.
  5.  * Written by the dominion project.
  6.  *
  7.  * This file is part of dominion.
  8.  *
  9.  * dominion is free software; you can redistribute it and/or
  10.  * modify it under the terms of the GNU General Public License as published
  11.  * by the Free Software Foundation; either version 1, or (at your option)
  12.  * any later version.
  13.  *
  14.  * This software is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this software; see the file COPYING.  If not, write to
  21.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  */
  23.  
  24.   /* get the control char corresponding to the *upper case*
  25.      char c.  Note:  will probably only work for ascii.
  26.    */
  27. #define CTL(c) (c - 'A' + 1)
  28.   /* the DELETE key */
  29. #define DEL ((char) 0x7F)
  30.  
  31. #ifdef BSD
  32. # define SRND(x) srandom(x)
  33. # define RND() random()
  34. # define strchr(a, b) index(a, b)
  35. #endif BSD
  36.  
  37. #ifdef SYSV
  38. # define SRND(x) srand48(x)
  39. # define RND() lrand48()
  40. #endif SYSV
  41.  
  42. /* Figuring in cur_ stuff. */
  43. #define cur_expend(np) (((np->cur_tech_r_d + np->cur_mag_r_d + np->cur_spy_r_d) * np->money) / 100)
  44. #define cur_expend_metal(np) ((np->cur_tech_r_d_metal * np->metal) / 100)
  45. #define cur_expend_jewels(np) ((np->cur_mag_r_d_jewels * np->jewels) / 100)
  46.  
  47. #define next_thon_money(np) ((np->money - cur_expend(np)) + (calc_revenue(np) - calc_expend(np)))
  48. #define next_thon_metal(np) ((np->metal - cur_expend_metal(np)) + (calc_metal (np) - calc_expend_metal(np)))
  49. #define next_thon_jewels(np) ((np->jewels - cur_expend_jewels(np)) + (calc_jewels (np) - calc_expend_jewels(np)))
  50.  
  51.   /* the number of good workers in a sector */
  52. /* #define n_workers(sp) (min(sp->n_people, (world.nations[sp->owner].race.repro*desig_map[sp->designation].max_employed)/10)) */
  53.  
  54. #define SALT ".."
  55.  
  56.   /* sector flags */
  57. #define SF_BUBBLE 0x01        /* a bubble has been built */
  58. #define SF_QUARANTINE 0x02    /* people cannot migrate */
  59. #define SF_HIDDEN 0x04        /* sector is cloaked */
  60. #define SF_TRADED 0x08        /* sector has been traded */
  61. #define SF_IMPENETRABLE 0x10    /* sector is impenetrable */
  62. #define SF_HOSTILE 0x20            /* sector is hostile */
  63.  
  64.   /* routines that check sector flags */
  65. #define has_bubble(sp) (sp->flags & SF_BUBBLE)
  66. #define has_quarantine(sp) (sp->flags & SF_QUARANTINE)
  67. #define has_hidden(sp) (sp->flags & SF_HIDDEN)
  68. #define has_traded(sp) (sp->flags & SF_TRADED)
  69. #define has_impenetrable(sp) (sp->flags & SF_IMPENETRABLE)
  70. #define has_hostile(sp) (sp->flags & SF_HOSTILE)
  71.  
  72.   /* this is to hide the absolute coordinates from a user */
  73. /* #define xrel(a) (user.nation.id == 0 ? a : a - user.nation.capital.x)
  74. #define yrel(b) (user.nation.id == 0 ? b : b - user.nation.capital.y)
  75. */
  76.   /* definitions for sector visibility:  this is a bit-field */
  77. #define SEE_NOTHING    0x00    /* not on your map at all */
  78. #define SEE_LAND_WATER 0x01    /* see if it is land or water */
  79. #define SEE_OWNER      0x02
  80. #define SEE_DESIG      0x04
  81. #define SEE_POPULATION 0x08
  82. #define SEE_RESOURCES  0x10    /* see what metal etc... are there */
  83. #define SEE_ARMIES     0x20
  84. #define SEE_ALL        0xff    /* see everything (all bits set) */
  85.  
  86.                                 /* Terrains */
  87. #define MIN_TERRAIN  -5
  88. #define JUNGLE        6
  89. #define FOREST        5         /* Terrain describes how the land looks to */
  90. #define BRUSH         4         /* the creatures on or around it. */
  91. #define GRASSLANDS    3
  92. #define SWAMP         2
  93. #define BARREN        1
  94. #define ICE           0
  95. #define RIVER        -1
  96. #define LAKE         -2
  97. #define REEF         -3
  98. #define BAY          -4
  99. #define OCEAN        -5
  100.                                 /* Altitudes by */
  101. #define MOUNTAIN_PEAK 6         
  102. #define MOUNTAINS     5         /* Altitudes describe the height or depth of */
  103. #define PLATEAU       4         /* the land on the specified sector. */
  104. #define HILLS         3         
  105. #define PLAINS        2         
  106. #define LOWLANDS      1         
  107. #define SEA_LEVEL     0         
  108. #define SHALLOWS     -1
  109. #define CONT_SHELF   -2
  110. #define SEA_MOUNT    -3
  111. #define OCEAN_PLAINS -4
  112. #define TRENCH       -5
  113.  
  114.   /* possible sector designations */
  115. #define D_NODESIG     0        /* designations */
  116. /*#define D_RUIN        1 */
  117. #define D_FARM        1
  118. #define D_METAL_MINE  2
  119. #define D_JEWEL_MINE  3
  120. #define D_CITY        4        /* can draft and build; heavy tax */
  121. #define D_CAPITAL     5        /* nation's capital; even more tax */
  122. #define D_UNIVERSITY  6        /* increase intelligence (costs to maintain) */
  123. #define D_TEMPLE      7        /* religion: + morale */
  124. #define D_STADIUM     8        /* entertainment: + morale */
  125. #define D_TRADE_POST  9        /* in foreign land: allows trade */
  126. #define D_EMBASSY    10        /* in foreign land: allows diplo */
  127. #define D_FORT       11        /* must have a garrison */
  128. #define D_HOSPITAL   12        /* decrease death rate (costs to maintain) */
  129. #define D_REFINERY   13        /* put next to a mine, > production */
  130. #define D_MAX_DESIG  D_REFINERY+1 /* the biggest designation number + 1 */
  131. /* #define D_MAX_DESIG (sizeof(desig_map)/sizeof(s_desig_map)) */
  132. #define FORT_BONUS_INCREASE 3    /* how much bonus for passing time in forts */
  133.  
  134.   /* army_type is used for the general description of
  135.      armies, and is loaded at the beginning of a session
  136.      from the file ("army_types")
  137.    */
  138. struct army_type {
  139.   char type[NAMELEN];        /* such as "Infantry" */
  140.   char type_char;        /* could be 'i' for Infantry */
  141.   float move_factor;        /* multiplies the nation's basic move rate */
  142.     /* should we have separate attack and defense bonus? */
  143.   int bonus;            /* added to nation's basic bonus */
  144.     /* the following describe how much it costs to draft a
  145.        SINGLE soldier of this type, and maintain it, except in
  146.        the case of spell points, where it is the price for the
  147.        ENTIRE army.
  148.      */
  149.   int money_draft, metal_draft, jewel_draft;
  150.   int money_maint, metal_maint, jewel_maint, spell_pts_maint;
  151.   int flags;            /* permanent flags */
  152.   char draft_places [NAMELEN];
  153. };
  154.  
  155.   /* spirit_type is used for the general description of
  156.      armies, and is loaded at the beginning of a session
  157.      from the file ("spirit_types")
  158.    */
  159. struct spirit_type {
  160.   char type[NAMELEN];        /* such as "eagle" */
  161.   char type_char;        /* could be 'E' for eagle */
  162.   int size;            /* how many "men" */
  163.   float move_factor;        /* multiplies the nation's basic move rate */
  164.     /* should we have separate attack and defense bonus? */
  165.   int bonus;            /* added to nation's basic bonus */
  166.     /* the following describe how much it costs to draft a
  167.        SINGLE soldier of this type, and maintain it, except in
  168.        the case of spell points, where it is the price for the
  169.        ENTIRE army.  The "flags" field is for permanenty army-type
  170.        flags.
  171.      */
  172.   int spell_pts_draft, jewel_draft, jewel_maint;
  173.   int flags;
  174. };
  175.  
  176.   /* this describes the various types of designation, that their mark
  177.      is, their name, and how much it costs to redesignate to that.  in
  178.      future we might put a general description of designations, and
  179.      also a per-turn cost.
  180.    */
  181. struct s_desig_map {
  182.   char mark;
  183.   char *name;
  184.   int price;            /* how much it costs to redesignate */
  185.   int revenue;            /* per capita revenue in sector */
  186.   int min_employed;        /* how many you need to function */
  187.   int max_employed;        /* how many can be gainfully employed? */
  188. };
  189.  
  190. struct s_altitude_map {
  191.   char mark;
  192.   char *name;
  193.   int value;
  194. };
  195.  
  196. struct army_flags {
  197.   char flag;
  198.   char description [EXECLEN];
  199. };
  200.  
  201.   /* diplomacy statuses */
  202. #define SELF          0
  203. #define UNMET         1
  204. #define JIHAD         2
  205. #define WAR           3
  206. #define HOSTILE       4
  207. #define UNRECOGNIZED  5
  208. #define NEUTRAL       6
  209. #define RECOGNIZED    7
  210. #define FRIENDLY      8
  211. #define ALLIED        9
  212. #define TREATY        10
  213.  
  214. struct item_map { char mark; char *name; }; /* for many things */
  215.