Mercurial > hg > early-roguelike
annotate xrogue/rogue.h @ 140:856017d63519
xrogue: don't segfault when backstabbing while empty-handed.
The code for backstabbing checked the weapon's properties without
making sure it was not NULL.
author | John "Elwin" Edwards |
---|---|
date | Tue, 05 May 2015 12:12:20 -0400 |
parents | dd137c35c3b1 |
children | aac28331e71d |
rev | line source |
---|---|
133
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
1 /* |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
2 rogue.h - Rogue definitions and variable declarations |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
3 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
4 XRogue: Expeditions into the Dungeons of Doom |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
5 Copyright (C) 1991 Robert Pietkivitch |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
6 All rights reserved. |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
7 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
8 Based on "Advanced Rogue" |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
9 Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
10 All rights reserved. |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
11 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
12 Based on "Rogue: Exploring the Dungeons of Doom" |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
13 Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
14 All rights reserved. |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
15 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
16 See the file LICENSE.TXT for full copyright and licensing information. |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
17 */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
18 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
19 /* |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
20 * some compiler don't handle void pointers well so |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
21 */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
22 #include <assert.h> |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
23 #define reg register |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
24 #define VOID long |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
25 #undef lines |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
26 #define ENCREAD encread |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
27 #define ENCWRITE encwrite |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
28 #undef SCROLL /* UNIX/370 defines SCROLL for some bizarre reason */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
29 #define exfork fork /* Standard fork with no paging available */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
30 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
31 /* |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
32 * Maximum number of different things |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
33 */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
34 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
35 #define MINCOLS 70 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
36 #define MINLINES 22 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
37 #define MAXROOMS 9 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
38 #define MAXTHINGS 9 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
39 #define MAXOBJ 9 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
40 #define MAXSTATS 74 /* max total of all stats at startup */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
41 #define MAXPACK 27 /* max number of items in pack */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
42 #define MAXDOUBLE 14 /* max number of times exppts is doubled */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
43 #define MAXCONTENTS 20 /* max number of things beaker/book can hold */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
44 #define MAXENCHANT 30 /* max number of enchantments on an item */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
45 #define MAXTREAS 25 /* number monsters/treasure in treasure room */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
46 #define MAXTRAPS 20 /* max number of traps that may be on level */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
47 #define MAXTRPTRY 15 /* attempts/level allowed for setting traps */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
48 #define MAXDOORS 4 /* maximum doors to a room */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
49 #define MAXCHANTS 16 /* maximum number of chants for a druid */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
50 #define MAXPRAYERS 16 /* maximum number of prayers for cleric */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
51 #define MAXSPELLS 16 /* maximum number of spells for magician */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
52 #define MAXQUILL 14 /* scrolls the Quill of Nagrom can write */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
53 #define QUILLCHARGES 300 /* max num of charges in the Quill of Nagrom */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
54 #define NUM_CNAMES 26 /* number of names per character level */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
55 #define NUMMONST 211 /* current number of monsters */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
56 #define NUMUNIQUE 60 /* number of UNIQUEs (minus jacaranda) */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
57 #define NUMDINOS 30 /* number of dinosaurs (for OUTSIDE level) */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
58 #define NLEVMONS 3 /* number of new monsters per level */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
59 #define NUMSCORE 20 /* number of entries in score file */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
60 #define HARDER 40 /* at this level start making things harder */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
61 #define LINELEN 256 /* characters in a buffer */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
62 #define JUG_EMPTY -1 /* signifys that the alchemy jug is empty */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
63 #define MAXPURCH (pstats.s_charisma/3) /* num of purchases at t.post */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
64 #define MAXATT 50 /* charactor's attribute maximum number */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
65 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
66 /* Movement penalties */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
67 #define BACKPENALTY 3 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
68 #define SHOTPENALTY 2 /* In line of sight of missile */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
69 #define DOORPENALTY 1 /* Moving out of current room */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
70 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
71 /* |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
72 * these defines are used in calls to get_item() to signify what |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
73 * it is we want |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
74 */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
75 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
76 #define ALL -1 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
77 #define WEARABLE -2 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
78 #define CALLABLE -3 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
79 #define WIELDABLE -4 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
80 #define USEABLE -5 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
81 #define IDENTABLE -6 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
82 #define REMOVABLE -7 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
83 #define PROTECTABLE -8 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
84 #define ZAPPABLE -9 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
85 #define READABLE -10 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
86 #define QUAFFABLE -11 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
87 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
88 /* |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
89 * stuff to do with encumberance |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
90 */ |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
91 |
e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
92 #define NORMENCB 1400 /* normal encumberance */ |