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

Re: CF: More Server log messages



On Mon, May 29, 2000 at 04:16:45AM -0700, John Cater wrote:
> name cancellation, arch cancellation, type 141 with fly/walk on/off not handled
> in move_apply()
> name boulder, arch t_boulder, type 48 with fly/walk on/off not handled in
> move_apply()

These types (and also ball lightning) are now handled by move_apply().

> cast_cone(): arch flowers doesn't have walk_on 1 and fly_on 1

Just a debugging message.  I think it can be removed soon.

> Player 'Pox' tried apply the unknown object (117657)

One possible cause is that a bomb in Pox' inventory exploded which left
an object in the client's inventory.  Applying or examining such an
object causes these messages.

Same thing can happen if a dm did something like "create cancellation".

There were also two bugs in fire_bow() and do_throw() that could cause
this situation.

> BUG: SK_level(arch snowball_l, name snowball_l): level <= 0

Looks like a firechest.  There were several bugs.


The attached patch is already in the CVS tree.  From the CHANGES file:

server/apply.c: move_apply(): Added handling of THROWN_OBJ, CANCELLATION
and BALL_LIGHTNING.
server/spell_effect.c: cancellation(): Traverse inventory of objects
with type THROWN_OBJ.

server/player.c: fire_bow() and server_skills.c: do_throw(): Bugfix: Don't
use op->count of freed objects.  Use was_destroyed() to check for freed
objects instead of QUERY_FLAG (FLAG_FREED).

server/spell_util.c: fire_a_ball(): Bugfixes: Use op->other_arch as
the archetype to fire, not FBULLET.  (-> Firechests now cast fire balls
again, not snowballs.)  Set level of fired archetype.  Check if object
was destroyed after insert_ob_in_map().

server/time.c: move_firewall() and move_firechest(): Do nothing if
object has no map.  Fixes server crashes if a dm creates such a thing
in the inventory.

-- 
Jan
diff -ru orig/crossfire-0.95.5-cvs2-patch17/lib/checkarch.pl crossfire-0.95.5-cvs2/lib/checkarch.pl
--- orig/crossfire-0.95.5-cvs2-patch17/lib/checkarch.pl	Fri May 26 11:26:51 2000
+++ crossfire-0.95.5-cvs2/lib/checkarch.pl	Mon May 29 16:04:40 2000
@@ -41,6 +41,10 @@
 		    &warn ("arch $arch is alive, but doesn't have level");
 		    $warnings++;
 		}
+                if ($type == 61 && $level <= 0) {
+                    &warn ("arch $arch is a FIRECHEST, but doesn't have level");
+                    $warnings++;
+                }
                 if ($type == 62 && $level <= 0) {
                     &warn ("arch $arch is a FIREWALL, but doesn't have level");
                     $warnings++;
diff -ru orig/crossfire-0.95.5-cvs2-patch17/server/apply.c crossfire-0.95.5-cvs2/server/apply.c
--- orig/crossfire-0.95.5-cvs2-patch17/server/apply.c	Mon May 29 16:45:47 2000
+++ crossfire-0.95.5-cvs2/server/apply.c	Mon May 29 18:14:49 2000
@@ -1104,6 +1104,7 @@
     }
     return;
 
+  case THROWN_OBJ:
   case ARROW:
     if(QUERY_FLAG(victim, FLAG_ALIVE)&&trap->speed) {
       tag_t trap_tag = trap->count;
@@ -1119,7 +1120,15 @@
     }
     return;
 
-  case CONE: /* A cone in the form of a wall */
+  case CANCELLATION:
+  case BALL_LIGHTNING:
+    if (QUERY_FLAG (victim, FLAG_ALIVE))
+      hit_player (victim, trap->stats.dam, trap, trap->attacktype);
+    else if (victim->material)
+      save_throw_object (victim, trap->attacktype);
+    return;
+
+  case CONE:
     if(QUERY_FLAG(victim, FLAG_ALIVE)&&trap->speed) {
       uint32 attacktype = trap->attacktype & ~AT_COUNTERSPELL;
       if (attacktype)
diff -ru orig/crossfire-0.95.5-cvs2-patch17/server/player.c crossfire-0.95.5-cvs2/server/player.c
--- orig/crossfire-0.95.5-cvs2-patch17/server/player.c	Fri May 26 11:26:52 2000
+++ crossfire-0.95.5-cvs2/server/player.c	Mon May 29 16:32:10 2000
@@ -906,6 +906,7 @@
 static void fire_bow(object *op, int dir)
 {
   object *bow, *arrow = NULL, *left;
+  tag_t left_tag;
   for(bow=op->inv; bow; bow=bow->below)
     if(bow->type==BOW && QUERY_FLAG(bow, FLAG_APPLIED))
       break;
@@ -939,6 +940,7 @@
 	return;
   }
   left = arrow; /* these are arrows left to the player */
+  left_tag = left->count;
   arrow = get_split_ob(arrow, 1);
   set_owner(arrow,op);
   arrow->direction=dir;
@@ -968,8 +970,8 @@
   play_sound_map(op->map, op->x, op->y, SOUND_FIRE_ARROW);
   insert_ob_in_map(arrow,op->map,op);
   move_arrow(arrow);
-  if (QUERY_FLAG(left, FLAG_FREED))
-      esrv_del_item(op->contr, left->count);
+  if (was_destroyed (left, left_tag))
+      esrv_del_item(op->contr, left_tag);
   else
       esrv_send_item(op, left);
 }
diff -ru orig/crossfire-0.95.5-cvs2-patch17/server/skills.c crossfire-0.95.5-cvs2/server/skills.c
--- orig/crossfire-0.95.5-cvs2-patch17/server/skills.c	Fri May 26 11:26:52 2000
+++ crossfire-0.95.5-cvs2/server/skills.c	Mon May 29 16:30:17 2000
@@ -1378,6 +1378,7 @@
 
 void do_throw(object *op, object *toss_item, int dir) {
     object *throw_ob=toss_item, *left=NULL;
+    tag_t left_tag;
     int eff_str = 0,maxc,str=op->stats.Str,dam=0;
     int pause_f,weight_f=0;
     float str_factor=1.0,load_factor=1.0,item_factor=1.0;
@@ -1465,6 +1466,7 @@
     } /* if object can't be thrown */
  
     left = throw_ob; /* these are throwing objects left to the player */
+    left_tag = left->count;
 
   /* sometimes get_split_ob can't split an object (because op->nrof==0?)
    * and returns NULL. We must use 'left' then 
@@ -1480,8 +1482,8 @@
 	    esrv_del_item(op->contr, left->count);
     }
     else if (op->type==PLAYER) {
-	if (QUERY_FLAG(left, FLAG_FREED))
-	    esrv_del_item(op->contr, left->count);
+	if (was_destroyed (left, left_tag))
+	    esrv_del_item(op->contr, left_tag);
 	else 
 	    esrv_update_item(UPD_NROF, op, left);
     }
diff -ru orig/crossfire-0.95.5-cvs2-patch17/server/spell_effect.c crossfire-0.95.5-cvs2/server/spell_effect.c
--- orig/crossfire-0.95.5-cvs2-patch17/server/spell_effect.c	Fri May 26 13:35:24 2000
+++ crossfire-0.95.5-cvs2/server/spell_effect.c	Mon May 29 16:24:31 2000
@@ -1607,7 +1607,9 @@
 {
   object *tmp;
 
-  if(QUERY_FLAG(op, FLAG_ALIVE)||op->type == CONTAINER) {
+  if (QUERY_FLAG (op, FLAG_ALIVE) || op->type == CONTAINER
+      || op->type == THROWN_OBJ)
+  {
     /* Recur through the inventory */
     for(tmp=op->inv;tmp!=NULL;tmp=tmp->below)
       if (!did_make_save_item(tmp, AT_CANCELLATION))
diff -ru orig/crossfire-0.95.5-cvs2-patch17/server/spell_util.c crossfire-0.95.5-cvs2/server/spell_util.c
--- orig/crossfire-0.95.5-cvs2-patch17/server/spell_util.c	Mon May 29 16:45:47 2000
+++ crossfire-0.95.5-cvs2/server/spell_util.c	Mon May 29 18:07:01 2000
@@ -1173,21 +1173,30 @@
     }
 }
 
-void fire_a_ball(object *op,int dir,int strength) {
-  object *tmp=clone_arch(FBULLET);
+void fire_a_ball (object *op, int dir, int strength)
+{
+  object *tmp;
 
-  if(!dir)
-    LOG(llevError,"Tried to fire a ball without direction.\n");
+  if ( ! op->other_arch) {
+    LOG (llevError, "BUG: fire_a_ball(): no other_arch\n");
+    return;
+  }
+  if ( ! dir) {
+    LOG (llevError, "BUG: fire_a_ball(): no direction\n");
+    return;
+  }
+  tmp = arch_to_object (op->other_arch);
   set_owner(tmp,op);
   tmp->direction=dir;
   tmp->x=op->x,tmp->y=op->y;
   tmp->speed = 1;
   update_ob_speed(tmp);
   tmp->stats.hp=strength;
+  tmp->level = op->level;
   SET_ANIMATION(tmp, dir);
   SET_FLAG(tmp, FLAG_FLYING);
-  insert_ob_in_map(tmp,op->map,op);
-  move_fired_arch(tmp);
+  if ((tmp = insert_ob_in_map (tmp, op->map, op)) != NULL)
+    move_fired_arch (tmp);
 }
 
 void explosion(object *op) {
diff -ru orig/crossfire-0.95.5-cvs2-patch17/server/time.c crossfire-0.95.5-cvs2/server/time.c
--- orig/crossfire-0.95.5-cvs2-patch17/server/time.c	Fri May 26 11:26:52 2000
+++ crossfire-0.95.5-cvs2/server/time.c	Mon May 29 16:00:27 2000
@@ -693,11 +693,15 @@
     in op->stats.sp.  maxsp also has some meaning, i'm not sure what.
     walls can have hp, so they can be torn down. */
 void move_firewall(object *op) {
+  if ( ! op->map)
+    return;   /* dm has created a firewall in his inventory */
   cast_spell(op,op,op->stats.sp?op->stats.sp:(RANDOM()%8)+1,op->stats.dam,
 	1,spellNormal,NULL);
 }
 
 void move_firechest(object *op) {
+  if ( ! op->map)
+    return;   /* dm has created a firechest in his inventory */
   fire_a_ball(op,(RANDOM()%8)+1,7);
 }