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

Re: [CF:1349] It lives! (22Jun00 server 0.95.6 on SuSE 6.4)



On Fri, Jun 23, 2000 at 10:37:20AM -0100, Erik Gjertsen wrote:
> On a side note, I had some initial troubles myself. Granted, I did som
> tweaking on include/config.h, among other things disabling NOT_PERM_DEATH
> and enabling RESURRECTION. Linker dies while compiling player.c in
> the server code with the following message:
> 
> player.o: In function `kill_player':
> /home/cross/install/crossfire-0.95.6/server/player.c:1816: undefined
> reference to `gravestone_text'

gravestone_text() got removed accidently with my apply() cleanup patch
because I had overlooked that it's also used by server/player.c.
Please try the attached patch an tell me if it fixes
PERM_DEATH/RESURRECTION.

The patch also fixes memory corruption when a corpse is created, and
changes some insert_ob_in_map() not to use the dead player as the
originator of that operation.

> Another thing, on my local server the pocket realities seem to be fixed
> when a new player gets a new appartment. However, existing players who
> already have an appartment will have the same problem with the wall
> reappearing after visiting one of the pocket realities. Does the fix for
> this problem require modification of the players perm-appartment file
> itself?

I don't know a better way.  :-/

-- 
Jan
diff -ru orig/crossfire-0.95.5-cvs3-patch34/include/sproto.h crossfire-0.95.5-cvs3/include/sproto.h
--- orig/crossfire-0.95.5-cvs3-patch34/include/sproto.h	Fri May 26 11:43:19 2000
+++ crossfire-0.95.5-cvs3/include/sproto.h	Fri Jun 23 11:35:44 2000
@@ -33,7 +33,6 @@
 extern int apply_container ( object *op, object *sack );
 extern int esrv_apply_container ( object *op, object *sack );
 extern char *gravestone_text ( object *op );
-extern int make_gravestone ( object *op, object *grave );
 extern void move_apply ( object *trap, object *victim, object *originator );
 extern int manual_apply ( object *op, object *tmp, int aflag );
 extern int player_apply ( object *pl, object *op, int aflag, int quiet );
diff -ru orig/crossfire-0.95.5-cvs3-patch34/server/apply.c crossfire-0.95.5-cvs3/server/apply.c
--- orig/crossfire-0.95.5-cvs3-patch34/server/apply.c	Mon Jun 19 16:09:49 2000
+++ crossfire-0.95.5-cvs3/server/apply.c	Fri Jun 23 11:35:03 2000
@@ -917,6 +917,40 @@
 
 
 /*
+ * Returns pointer a static string containing gravestone text
+ */
+char *gravestone_text (object *op)
+{
+    static char buf2[MAX_BUF];
+    char buf[MAX_BUF];
+    time_t now = time (NULL);
+
+    strcpy (buf2, "                 R.I.P.\n\n");
+    if (op->type == PLAYER)
+        sprintf (buf, "%s the %s\n", op->name, op->contr->title);
+    else
+        sprintf (buf, "%s\n", op->name);
+    strncat (buf2, "                    ",  20 - strlen (buf) / 2);
+    strcat (buf2, buf);
+    if (op->type == PLAYER)
+        sprintf (buf, "who was in level %d when killed\n", op->level);
+    else
+        sprintf (buf, "who was in level %d when died.\n\n", op->level);
+    strncat (buf2, "                    ",  20 - strlen (buf) / 2);
+    strcat (buf2, buf);
+    if (op->type == PLAYER) {
+        sprintf (buf, "by %s.\n\n", op->contr->killer);
+        strncat (buf2, "                    ",  21 - strlen (buf) / 2);
+        strcat (buf2, buf);
+    }
+    strftime (buf, MAX_BUF, "%b %d %Y\n", localtime (&now));
+    strncat (buf2, "                    ",  20 - strlen (buf) / 2);
+    strcat (buf2, buf);
+    return buf2;
+}
+
+
+/*
  * Returns true if sacrifice was accepted.
  */
 static int apply_altar (object *altar, object *sacrifice, object *originator)
diff -ru orig/crossfire-0.95.5-cvs3-patch34/server/player.c crossfire-0.95.5-cvs3/server/player.c
--- orig/crossfire-0.95.5-cvs3-patch34/server/player.c	Tue Jun 13 22:51:03 2000
+++ crossfire-0.95.5-cvs3/server/player.c	Fri Jun 23 11:46:39 2000
@@ -1692,7 +1680,7 @@
 	        op->contr->killer);
     tmp->msg = add_string(buf);
     tmp->x=op->x,tmp->y=op->y;
-    insert_ob_in_map(tmp,op->map,op);
+    insert_ob_in_map (tmp, op->map, NULL);
 
  /**************************************/
  /*                                    */
@@ -1800,12 +1788,16 @@
 #ifdef NOT_PERMADEATH
     tmp=arch_to_object(find_archetype("gravestone"));
     sprintf(buf,"%s's gravestone",op->name);
+    if (tmp->name)
+        free_string (tmp->name);
     tmp->name=add_string(buf);
     sprintf(buf,"RIP\nHere rests the hero %s the %s,\nwho was killed by %s.\n",
 	    op->name, op->contr->title, op->contr->killer);
+    if (tmp->msg)
+        free_string (tmp->msg);
     tmp->msg = add_string(buf);
     tmp->x=x,tmp->y=y;
-    insert_ob_in_map(tmp,map,op);
+    insert_ob_in_map (tmp, map, NULL);
 #else
     /*  peterm:  added to create a corpse at deathsite.  */
     tmp=arch_to_object(find_archetype("corpse_pl"));
@@ -1817,9 +1809,9 @@
     tmp->x=x;tmp->y=y;
     if (tmp->msg)
 	free_string(tmp->msg);
-    tmp->msg = gravestone_text(op);
+    tmp->msg = add_string (gravestone_text(op));
     SET_FLAG (tmp, FLAG_UNIQUE);
-    insert_ob_in_map(tmp,map,op);
+    insert_ob_in_map (tmp, map, NULL);
 #endif
 }