home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Games / Xconq 7.1.0 / src / xconq-7.1.0 / kernel / history.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-07  |  3.0 KB  |  95 lines  |  [TEXT/R*ch]

  1. /* Definitions for the historical record.
  2.    Copyright (C) 1992, 1993, 1994, 1995 Stanley T. Shebs.
  3.  
  4. Xconq is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.  See the file COPYING.  */
  8.  
  9. typedef enum {
  10.  
  11. #undef  DEF_HEVT
  12. #define DEF_HEVT(name, CODE, datadescs) CODE,
  13.  
  14. #include "history.def"
  15.  
  16.     NUMHEVTTYPES
  17. } HistEventType;
  18.  
  19. /* This is the form of the definition of a event type. */
  20.  
  21. typedef struct a_hevt_defn {
  22.     char *name;
  23.     char *datadescs;
  24. } HevtDefn;
  25.  
  26. typedef struct a_histevent {
  27.     HistEventType type;        /* type of historical event */
  28.     short startdate;        /* date of event's start */
  29.     short enddate;        /* date of event's end */
  30.     SideMask observers;        /* which sides know about this event */
  31.     struct a_histevent *next;    /* link to next in list */
  32.     struct a_histevent *prev;    /* link to previous in list */
  33.     short data[4];        /* data describing event */
  34. } HistEvent;
  35.  
  36. /* This is a snapshot of key bits of a unit's state at a particular
  37.    moment. */
  38.  
  39. typedef struct a_pastunit {
  40.     short type;            /* type */
  41.     short id;            /* truly unique id number */
  42.     char *name;            /* the name, if given */
  43.     int number;            /* semi-unique number */
  44.     short x, y, z;        /* position of unit in world */
  45.     struct a_side *side;    /* whose side this unit is on */
  46.     struct a_pastunit *next;    /* pointer to next in list */
  47. } PastUnit;
  48.  
  49. enum gain_reasons {
  50.     initial_gain = 0,
  51.     build_gain = 1,
  52.     capture_gain = 2,
  53.     other_gain = 3,
  54.     num_gain_reasons = 4
  55. };
  56.  
  57. enum loss_reasons {
  58.     combat_loss = 0,
  59.     capture_loss = 1,
  60.     starvation_loss = 2,
  61.     accident_loss = 3,
  62.     disband_loss = 4,
  63.     other_loss = 5,
  64.     num_loss_reasons = 6
  65. };
  66.  
  67. enum damage_reasons {
  68.     combat_dmg,
  69.     accident_dmg
  70. };
  71.  
  72. extern HevtDefn hevtdefns[];
  73.  
  74. extern HistEvent *history;
  75.  
  76. extern PastUnit *past_unit_list;
  77.  
  78. extern void init_history PARAMS ((void));
  79. extern void start_history PARAMS ((void));
  80. extern HistEvent *create_historical_event PARAMS ((HistEventType type));
  81. extern HistEvent *record_event PARAMS ((HistEventType type, SideMask observers, ...));
  82. extern void record_unit_death PARAMS ((Unit *unit, HistEventType reason));
  83. extern void record_unit_name_change PARAMS ((Unit *unit, char *newname));
  84. extern void record_unit_side_change PARAMS ((Unit *unit, Side *newside, HistEventType reason, Unit *agent));
  85. extern void count_gain PARAMS ((Side *side, int u, enum gain_reasons reason));
  86. extern void count_loss PARAMS ((Side *side, int u, enum loss_reasons reason));
  87. extern void end_history PARAMS ((void));
  88. extern HistEvent *get_nth_history_line PARAMS ((Side *side, int n, HistEvent **nextevt));
  89. extern PastUnit *create_past_unit PARAMS ((int type, int id));
  90. extern PastUnit *find_past_unit PARAMS ((int n));
  91. extern char *past_unit_desig PARAMS ((PastUnit *pastunit));
  92. extern PastUnit *change_unit_to_past_unit PARAMS ((Unit *unit));
  93. extern void dump_statistics PARAMS ((void));
  94.  
  95.