File: history.h

package info (click to toggle)
xconq 7.2.2-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 8,296 kB
  • ctags: 9,199
  • sloc: ansic: 107,849; sh: 2,108; perl: 2,057; makefile: 1,177; sed: 161; csh: 50; awk: 49; lisp: 39
file content (95 lines) | stat: -rw-r--r-- 3,064 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* Definitions for the historical record.
   Copyright (C) 1992, 1993, 1994, 1995 Stanley T. Shebs.

Xconq is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.  See the file COPYING.  */

typedef enum {

#undef  DEF_HEVT
#define DEF_HEVT(name, CODE, datadescs) CODE,

#include "history.def"

    NUMHEVTTYPES
} HistEventType;

/* This is the form of the definition of a event type. */

typedef struct a_hevt_defn {
    char *name;
    char *datadescs;
} HevtDefn;

typedef struct a_histevent {
    HistEventType type;		/* type of historical event */
    short startdate;		/* date of event's start */
    short enddate;		/* date of event's end */
    SideMask observers;		/* which sides know about this event */
    struct a_histevent *next;	/* link to next in list */
    struct a_histevent *prev;	/* link to previous in list */
    short data[4];		/* data describing event */
} HistEvent;

/* This is a snapshot of key bits of a unit's state at a particular
   moment. */

typedef struct a_pastunit {
    short type;			/* type */
    short id;			/* truly unique id number */
    char *name;			/* the name, if given */
    int number;			/* semi-unique number */
    short x, y, z;		/* position of unit in world */
    struct a_side *side;	/* whose side this unit is on */
    struct a_pastunit *next;	/* pointer to next in list */
} PastUnit;

enum gain_reasons {
    initial_gain = 0,
    build_gain = 1,
    capture_gain = 2,
    other_gain = 3,
    num_gain_reasons = 4
};

enum loss_reasons {
    combat_loss = 0,
    capture_loss = 1,
    starvation_loss = 2,
    accident_loss = 3,
    disband_loss = 4,
    other_loss = 5,
    num_loss_reasons = 6
};

enum damage_reasons {
    combat_dmg,
    accident_dmg,
    attrition_dmg
};

extern HevtDefn hevtdefns[];

extern HistEvent *history;

extern PastUnit *past_unit_list;

extern void init_history PARAMS ((void));
extern void start_history PARAMS ((void));
extern HistEvent *create_historical_event PARAMS ((HistEventType type));
extern HistEvent *record_event PARAMS ((HistEventType type, SideMask observers, ...));
extern void record_unit_death PARAMS ((Unit *unit, HistEventType reason));
extern void record_unit_name_change PARAMS ((Unit *unit, char *newname));
extern void record_unit_side_change PARAMS ((Unit *unit, Side *newside, HistEventType reason, Unit *agent));
extern void count_gain PARAMS ((Side *side, int u, enum gain_reasons reason));
extern void count_loss PARAMS ((Side *side, int u, enum loss_reasons reason));
extern void end_history PARAMS ((void));
extern HistEvent *get_nth_history_line PARAMS ((Side *side, int n, HistEvent **nextevt));
extern PastUnit *create_past_unit PARAMS ((int type, int id));
extern PastUnit *find_past_unit PARAMS ((int n));
extern char *past_unit_desig PARAMS ((PastUnit *pastunit));
extern PastUnit *change_unit_to_past_unit PARAMS ((Unit *unit));
extern void dump_statistics PARAMS ((void));