[CF-Devel] dump_gods & server/editor split

Pertti Karppinen (OH6KTR) pjka at cc.jyu.fi
Tue Jan 9 05:55:51 CST 2001


I did a fix to get dump_gods to print out avatar and servant info correctly.
Reason why I didn't put it into CVS is that as dump_gods is in common/holy.c
and thus goes into the libcross.a but determine_holy_arch is in server/gods.c.

One or the other needs to be moved, but I'm not sure which one. Most
probably the dump_god, because I see not a lot of use for it in crossedit.

This brings up the point of splitting server/editor again.
It seems that we need not a 2-way split but 3-way:
server, editor and lib. We need to strip the lib down as much ass possible,
but not more :), as we don't want to do all the loader stuff and such twice
everytime something changes.

So first thing to do, if we aim for the split, is to identify which stuff in
the lib (dir common) is actually used, or potentially useable, in both
server and editor. Functions that are clearly needed in one or the other,
need to be moved to the appropriate dir.
There seems to 352 functions, according to libproto.h, in the lib now. 
A script to check actual calls made to these functions in both server and
editor should be trivial to do.
-----------------------diff_starts---------------------------------
Index: holy.c
===================================================================
RCS file: /home/cvs/CVS/crossfire/common/holy.c,v
retrieving revision 1.3
diff -u -r1.3 holy.c
--- holy.c	2000/12/04 00:40:03	1.3
+++ holy.c	2001/01/09 11:35:55
@@ -6,6 +6,7 @@
 #include <global.h>
 #include <living.h>
 #include <spells.h>
+#include <sproto.h>
 
 static godlink *init_godslist() {
     godlink *gl = (godlink *) malloc(sizeof(godlink));
@@ -129,22 +130,26 @@
     fprintf(stderr,"\n");
     for(glist=first_god;glist;glist=glist->next) {
       object *god=pntr_to_god_obj(glist);
+      object *avatar=NULL,*serv=NULL;
       char tmpbuf[HUGE_BUF];
       int tmpvar,gifts=0;
 
       fprintf(stderr,"GOD: %s\n",god->name);
-      fprintf(stderr," avatar stats:\n");
-      fprintf(stderr,"  S:%d C:%d D:%d I:%d W:%d P:%d\n", 
-	god->stats.Str,god->stats.Con,god->stats.Dex, 
-  	god->stats.Int,god->stats.Wis,god->stats.Pow);
-      fprintf(stderr,"  lvl:%d speed:%4.2f\n", 
-  	god->level,god->speed);
-      fprintf(stderr,"  wc:%d ac:%d hp:%d dam:%d \n",
-  	god->stats.wc,god->stats.ac,god->stats.hp,god->stats.dam);
-      fprintf(stderr," enemy: %s\n",god->title?god->title:"NONE");
-      if(god->other_arch) {
-	object *serv = &god->other_arch->clone;
-        fprintf(stderr," servant stats: (%s)\n",god->other_arch->name);
+      avatar=arch_to_object(determine_holy_arch(god,"avatar"));
+      if(avatar)  {
+	fprintf(stderr," avatar stats:\n");
+        fprintf(stderr,"  S:%d C:%d D:%d I:%d W:%d P:%d\n", 
+	  avatar->stats.Str,avatar->stats.Con,avatar->stats.Dex, 
+  	  avatar->stats.Int,avatar->stats.Wis,avatar->stats.Pow);
+        fprintf(stderr,"  lvl:%d speed:%4.2f\n", 
+  	  avatar->level,avatar->speed);
+        fprintf(stderr,"  wc:%d ac:%d hp:%d dam:%d \n",
+  	  avatar->stats.wc,avatar->stats.ac,avatar->stats.hp,avatar->stats.dam);
+      } else
+        fprintf(stderr," avatar: NONE\n");
+      serv=arch_to_object(determine_holy_arch(god,"holy servant"));
+      if(serv)  {
+        fprintf(stderr," servant stats: (%s)\n",serv->name);
         fprintf(stderr,"  S:%d C:%d D:%d I:%d W:%d P:%d\n", 
 	  serv->stats.Str,serv->stats.Con,serv->stats.Dex, 
   	  serv->stats.Int,serv->stats.Wis,serv->stats.Pow);

-----------------------diff_ends-----------------------------------
-- 
BSc. Pertti Karppinen <
     
     pjka at iki.fi
     
     >                   |'Bridge Players |
Systems Designer, University of Jyvaskyla, Finland    |      Do        |
     
     http://www.iki.fi/~pjka/
     
      | Office  : +358 14 260 2088 |      It        |
HAM: OH6KTR QTH: KP22UF  | Cellular: +358 40 564 0786 | on the Table'  |

    
    


More information about the crossfire mailing list