ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/utils.c
(Generate patch)

Comparing deliantra/server/common/utils.c (file contents):
Revision 1.1.1.1 by root, Fri Feb 3 07:11:41 2006 UTC vs.
Revision 1.1.1.2 by elmex, Wed Feb 22 18:01:23 2006 UTC

1/* 1/*
2 * static char *rcsid_utils_c = 2 * static char *rcsid_utils_c =
3 * "$Id: utils.c,v 1.1.1.1 2006/02/03 07:11:41 root Exp $"; 3 * "$Id: utils.c,v 1.1.1.2 2006/02/22 18:01:23 elmex Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
47 * and if goodbad is non-zero, luck increases the roll, if zero, it decreases. 47 * and if goodbad is non-zero, luck increases the roll, if zero, it decreases.
48 * Generally, op should be the player/caster/hitter requesting the roll, 48 * Generally, op should be the player/caster/hitter requesting the roll,
49 * not the recipient (ie, the poor slob getting hit). [garbled 20010916] 49 * not the recipient (ie, the poor slob getting hit). [garbled 20010916]
50 */ 50 */
51 51
52int random_roll(int min, int max, object *op, int goodbad) { 52int random_roll(int min, int max, const object *op, int goodbad) {
53 int omin, diff, luck, base, ran; 53 int omin, diff, luck, base, ran;
54 54
55 omin = min; 55 omin = min;
56 diff = max - min + 1; 56 diff = max - min + 1;
57 ((diff > 2) ? (base = 20) : (base = 50)); /* d2 and d3 are corner cases */ 57 ((diff > 2) ? (base = 20) : (base = 50)); /* d2 and d3 are corner cases */
83/* 83/*
84 * This is a 64 bit version of random_roll above. This is needed 84 * This is a 64 bit version of random_roll above. This is needed
85 * for exp loss calculations for players changing religions. 85 * for exp loss calculations for players changing religions.
86 */ 86 */
87 87
88sint64 random_roll64(sint64 min, sint64 max, object *op, int goodbad) { 88sint64 random_roll64(sint64 min, sint64 max, const object *op, int goodbad) {
89 sint64 omin, diff, luck, ran; 89 sint64 omin, diff, luck, ran;
90 int base; 90 int base;
91 91
92 omin = min; 92 omin = min;
93 diff = max - min + 1; 93 diff = max - min + 1;
132 * Generally, op should be the player/caster/hitter requesting the roll, 132 * Generally, op should be the player/caster/hitter requesting the roll,
133 * not the recipient (ie, the poor slob getting hit). 133 * not the recipient (ie, the poor slob getting hit).
134 * The args are num D size (ie 4d6) [garbled 20010916] 134 * The args are num D size (ie 4d6) [garbled 20010916]
135 */ 135 */
136 136
137int die_roll(int num, int size, object *op, int goodbad) { 137int die_roll(int num, int size, const object *op, int goodbad) {
138 int min, diff, luck, total, i, gotlucky, base, ran; 138 int min, diff, luck, total, i, gotlucky, base, ran;
139 139
140 diff = size; 140 diff = size;
141 min = 1; 141 min = 1;
142 luck = total = gotlucky = 0; 142 luck = total = gotlucky = 0;
266 266
267/* when doing transmutation of objects, we have to recheck the resistances, 267/* when doing transmutation of objects, we have to recheck the resistances,
268 * as some that did not apply previously, may apply now. 268 * as some that did not apply previously, may apply now.
269 */ 269 */
270 270
271void transmute_materialname(object *op, object *change) 271void transmute_materialname(object *op, const object *change)
272{ 272{
273 materialtype_t *mt; 273 materialtype_t *mt;
274 int j; 274 int j;
275 275
276 if (op->materialname == NULL) 276 if (op->materialname == NULL)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines