Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CF: Some crash fixes
- To: crossfire (at) ifi.uio.no
- Subject: CF: Some crash fixes
- From: Jan Echternach <>
- Date: Mon, 15 May 2000 23:06:21 +0200
- Mail-Followup-To:
- Reply-To: Jan Echternach <>
- Sender:
These fixes are already in the CVS tree.
common/living.c: drain_stat(): There are 7 stats now, not 6.
This patch is untested because I couldn't get a demelich to drain my
stats. But it is "obviously correct".
server/rune.c: rune_attack(): Check that victim still exists after
hit_player() was missing. This fixes server crashes if monster applied
a chest, found a diseased needle and was killed by it.
Some people don't even check for destroyed objects immediately after
hit_player(). Maybe object management should be rewritten to use
reference counts for the sole purpose of forcing programmers to think
about objects' lifetime. A was_destroyed() call seems to be too easy
to forget when I look at this bug.
server/spell_effect.c: cast_charm(): out_of_map() check was missing.
This fixes server crashes when a player casted this spell near the edge
of a map.
Hmm. Somebody fixed cast_pacify() and cast_charm_undead() but forgot
about cast_charm() which is the ancestor of these functions...
--- common/living.c-orig Mon May 15 22:38:20 2000
+++ common/living.c Mon May 15 22:38:38 2000
@@ -738,7 +738,7 @@
*/
void drain_stat(object *op) {
- drain_specific_stat(op, RANDOM()%6);
+ drain_specific_stat(op, RANDOM()%7);
}
void drain_specific_stat(object *op, int deplete_stats) {
--- server/rune.c-orig Mon May 15 22:39:55 2000
+++ server/rune.c Mon May 15 22:40:00 2000
@@ -191,6 +191,8 @@
{
if(victim) {
hit_player(victim,op->stats.dam,op,op->attacktype);
+ if (QUERY_FLAG (victim, FLAG_FREED))
+ return;
/* if there's a disease in the needle, put it in the player */
if(op->randomitems!=NULL) create_treasure(op->randomitems,op,GT_INVENTORY,
(victim->map?victim->map->difficulty:1),0);
--- server/spell_effect.c-orig Mon May 15 22:40:07 2000
+++ server/spell_effect.c Mon May 15 22:40:55 2000
@@ -2460,6 +2460,8 @@
object *tmp,*effect;
for(i=1;i<MIN(9+SP_level_strength_adjust(op,caster,spellnum),SIZEOFFREE);i++) {
+ if (out_of_map(op->map,op->x+freearr_x[i],op->y+freearr_y[i]))
+ continue;
for(tmp=get_map_ob(op->map,op->x+freearr_x[i],op->y+freearr_y[i]);
tmp&&(!QUERY_FLAG(tmp,FLAG_MONSTER));tmp=tmp->above);
if(!tmp) continue;
--
Jan
-
[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to ]