Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: POISON fix



Hi,

When a monster applies a POISON object (i.e. poisonous booze), the
server crashes.  The attached patch fixes this problem.  Documentation
and a test map are included.

PS: I'm sorry for my last message without a subject.  The MUA asked "No
subject, abort sending (y/n)?" and I answered "(N)o, don't send message
without subject.".  :-}

-- 
Jan
diff -ru orig/crossfire-0.95.5-patch2/doc/crossfire.doc crossfire-0.95.5/doc/crossfire.doc
--- orig/crossfire-0.95.5-patch2/doc/crossfire.doc	Wed Mar 22 08:56:54 2000
+++ crossfire-0.95.5/doc/crossfire.doc	Fri Apr  7 16:44:42 2000
@@ -725,6 +725,16 @@
 If food is zero, there is no limit on how many times the sign can be read.
 
 ------------------------------------------------------------------------------
+POISONOUS BOOZE:
+
+stats.hp  Poison player or monster that applies this booze with stats.hp
+          poison damage.
+
+stats.hp must be greater 0 to do damage.  It used to be less than 0 for
+-stats.hp direct damage, but that has changed.  stats.hp <= 0 now means no
+damage at all, just loss of 25% food.
+
+------------------------------------------------------------------------------
 Flags & specifications: (usage: flag value)
 
 Note: the flags are case sensitive.
diff -ru orig/crossfire-0.95.5-patch2/server/apply.c crossfire-0.95.5/server/apply.c
--- orig/crossfire-0.95.5-patch2/server/apply.c	Fri Apr  7 14:32:54 2000
+++ crossfire-0.95.5/server/apply.c	Fri Apr  7 16:51:31 2000
@@ -1748,25 +1748,22 @@
     decrease_ob(tmp);
     return 1;
   case POISON:
-#if 0
-   /* monsters can now use this */
-    if(op->type!=PLAYER)
-      return 0;
-#endif
     if(QUERY_FLAG(tmp, FLAG_UNPAID)) {
-      new_draw_info(NDI_UNIQUE, 0,op,"You should pay for it first.");
+      if (op->type == PLAYER)
+        new_draw_info(NDI_UNIQUE, 0,op,"You should pay for it first.");
       return 1;
     }
-    play_sound_player_only(op->contr, SOUND_DRINK_POISON,0,0);
-/*    op->stats.hp+=tmp->stats.hp;*/
-    /* I think this is better */
-    LOG(llevDebug,"Trying to poison player for %d hp\n", tmp->stats.hp);
-    hit_player(op, tmp->stats.hp, tmp, AT_POISON);
-    op->stats.food-=op->stats.food/4;
-    if(op->type==PLAYER) {
+    if (op->type == PLAYER) {
+      play_sound_player_only(op->contr, SOUND_DRINK_POISON,0,0);
       new_draw_info(NDI_UNIQUE, 0,op,"Yech!  That tasted poisonous!");
       strcpy(op->contr->killer,"poisonous booze");
     }
+    if (tmp->stats.hp > 0) {
+      LOG(llevDebug,"Trying to poison player/monster for %d hp\n",
+          tmp->stats.hp);
+      hit_player(op, tmp->stats.hp, tmp, AT_POISON);
+    }
+    op->stats.food-=op->stats.food/4;
     decrease_ob(tmp);
     return 1;
   case SAVEBED:
arch map
msg
Creator: Gnat the Gnu
Email: gnu@foo.bar
Date: Fri Apr  7 16:10:13 2000
endmsg
hp 1
sp 1
x 5
y 5
end
arch poison
hp 10
nrof 100
end
arch swall_2_1_2
x 2
y 1
end
arch swall_2_1_2
x 2
y 3
end
arch swall_2_1_2
x 3
y 1
end
arch poison
x 3
y 2
end
arch swall_2_1_2
x 3
y 3
end
arch swall_2_1_2
x 4
y 1
end
arch orc
x 4
y 2
pick_up 32
can_apply 32
end
arch swall_2_1_2
x 4
y 3
end