Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

history.h

Go to the documentation of this file.
00001 /* Definitions for the historical record.
00002    Copyright (C) 1992-1995, 1998-2000 Stanley T. Shebs.
00003 
00004 Xconq is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2, or (at your option)
00007 any later version.  See the file COPYING.  */
00008 
00013 #undef  DEF_HEVT
00014 #define DEF_HEVT(name, CODE, datadescs) CODE,
00015 
00017 typedef enum {
00018 
00019 #include "history.def"
00020 
00021     NUMHEVTTYPES
00022 } HistEventType;
00023 
00030 typedef struct a_hevt_defn {
00031     char *name;                 
00032     char *datadescs;    
00033 } HevtDefn;
00034 
00039 typedef struct a_histevent {
00040     HistEventType type;                         
00041     short startdate;                            
00042     short enddate;                              
00043     SideMask observers;                 
00044     struct a_histevent *next;           
00045     struct a_histevent *prev;           
00046     int data[4];                                
00047 } HistEvent;
00048 
00049 
00055 typedef struct a_pastunit {
00056     short type;                                 
00057     int id;                                             
00058     char *name;                                 
00059     int number;                                 
00060     short x;                                            
00061     short y;                                            
00062     short z;                                            
00063     struct a_side *side;                        
00064     struct a_pastunit *next;            
00065 } PastUnit;
00066 
00068 enum gain_reasons {
00069     initial_gain = 0,           
00070     build_gain = 1,             
00071     capture_gain = 2,           /*1< capture */
00072     other_gain = 3,             
00073     num_gain_reasons = 4        
00074 };
00075 
00077 enum loss_reasons {
00078     combat_loss = 0,            
00079     capture_loss = 1,           
00080     starvation_loss = 2,        
00081     accident_loss = 3,          
00082     attrition_loss = 4,         
00083     disband_loss = 5,           
00084     other_loss = 6,             
00085     num_loss_reasons = 7        
00086 };
00087 
00089 enum damage_reasons {
00090     combat_dmg,                 
00091     accident_dmg,               
00092     attrition_dmg,              
00093     starvation_dmg              
00094 };
00095 
00097 extern HevtDefn hevtdefns[];
00098 
00099 /*1 \brief Historical Events list. */
00100 extern HistEvent *history;
00101 
00103 extern PastUnit *past_unit_list;
00104 
00105 extern void init_history(void);
00106 extern void start_history(void);
00107 extern HistEvent *create_historical_event(HistEventType type);
00108 extern HistEvent *record_event(HistEventType type, SideMask observers, ...);
00109 extern void record_unit_death(Unit *unit, HistEventType reason);
00110 extern void record_unit_name_change(Unit *unit, char *newname);
00111 extern void record_unit_side_change(Unit *unit, Side *newside,
00112                                     HistEventType reason, Unit *agent);
00113 extern void count_gain(Side *side, int u, enum gain_reasons reason);
00114 extern void count_loss(Side *side, int u, enum loss_reasons reason);
00115 extern void end_history(void);
00116 extern HistEvent *get_nth_history_line(Side *side, int n, HistEvent **nextevt);
00117 extern PastUnit *create_past_unit(int type, int id);
00118 extern PastUnit *find_past_unit(int n);
00119 extern char *past_unit_desig(PastUnit *pastunit);
00120 extern PastUnit *change_unit_to_past_unit(Unit *unit);
00121 extern void dump_statistics(void);
00122 
00123 extern int update_total_hist_lines(Side *side);
00124 extern int build_hist_contents(Side *side, int n, HistEvent **histcontents, int numvis);
00125 extern int total_gain(Side *side, int u);
00126 extern int total_loss(Side *side, int u);

Generated on Sat Sep 17 10:28:53 2005 for XconqKernel by doxygen 1.3.6