ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/holy.C
(Generate patch)

Comparing deliantra/server/common/holy.C (file contents):
Revision 1.3 by root, Thu Aug 31 17:54:14 2006 UTC vs.
Revision 1.4 by root, Sun Sep 3 00:18:39 2006 UTC

5 5
6#include <global.h> 6#include <global.h>
7#include <living.h> 7#include <living.h>
8#include <spells.h> 8#include <spells.h>
9 9
10//TODO: make a constructor
10static godlink *init_godslist(void) { 11static godlink *init_godslist(void) {
11 godlink *gl = (godlink *) malloc(sizeof(godlink)); 12 godlink *gl = new godlink;
12 if(gl==NULL) 13
13 fatal(OUT_OF_MEMORY);
14 gl->name=NULL; /* how to describe the god to the player */ 14 // name=NULL; /* how to describe the god to the player */
15 gl->arch=NULL; /* pointer to the archetype of this god */ 15 // arch=NULL; /* pointer to the archetype of this god */
16 gl->id=0; /* id of the god */ 16 // id=0; /* id of the god */
17 gl->pantheon=NULL; /* the group to which the god belongs (not implemented) */ 17 // pantheon=NULL; /* the group to which the god belongs (not implemented) */
18 gl->next=NULL; /* next god in this linked list */ 18 // next=NULL; /* next god in this linked list */
19 19
20 return gl; 20 return gl;
21} 21}
22 22
23/* init_gods() - this takes a look at all of the archetypes to find 23/* init_gods() - this takes a look at all of the archetypes to find
43 } 43 }
44 44
45 god = init_godslist(); 45 god = init_godslist();
46 46
47 god->arch = god_arch; 47 god->arch = god_arch;
48 god->name=add_string(god_arch->clone.name); 48 god->name = god_arch->clone.name;
49 if(!first_god) 49 if(!first_god)
50 god->id = 1; 50 god->id = 1;
51 else { 51 else {
52 god->id = first_god->id + 1; 52 god->id = first_god->id + 1;
53 god->next = first_god; 53 god->next = first_god;
54 } 54 }
55 first_god = god; 55 first_god = god;
56 56
57#ifdef DEBUG_GODS 57#ifdef DEBUG_GODS
58 LOG(llevDebug,"Adding god %s (%d) to list\n",god->name,god->id); 58 LOG(llevDebug,"Adding god %s (%d) to list\n",&god->name,god->id);
59#endif 59#endif
60} 60}
61 61
62/* baptize_altar() - (cosmetically) change the name to that of the 62/* baptize_altar() - (cosmetically) change the name to that of the
63 * god in question, then set the title for later use. -b.t. 63 * god in question, then set the title for later use. -b.t.
74 LOG(llevError,"baptise_altar(): bizarre nameless god!\n"); 74 LOG(llevError,"baptise_altar(): bizarre nameless god!\n");
75 return 0; 75 return 0;
76 } 76 }
77 /* if the object name hasnt' been changed, we tack on the gods name */ 77 /* if the object name hasnt' been changed, we tack on the gods name */
78 if(!strcmp(op->name,op->arch->clone.name)) { 78 if(!strcmp(op->name,op->arch->clone.name)) {
79 if(op->name!=NULL) free_string(op->name);
80 sprintf(buf,"%s of %s",op->name,god->name); 79 sprintf(buf,"%s of %s",&op->name,&god->name);
81 op->name = add_string(buf); 80 op->name = buf;
82 } 81 }
83 op->title=add_string(god->name); 82 op->title = god->name;
84 return 1; 83 return 1;
85 } 84 }
86 return 0; 85 return 0;
87} 86}
88 87
114 godlink *god, *godnext; 113 godlink *god, *godnext;
115 114
116 LOG(llevDebug,"Freeing god information\n"); 115 LOG(llevDebug,"Freeing god information\n");
117 for (god=first_god; god; god=godnext) { 116 for (god=first_god; god; god=godnext) {
118 godnext=god->next; 117 godnext=god->next;
119 if (god->name) free_string(god->name);
120 free(god); 118 delete god;
121 } 119 }
122} 120}
123 121
124 122

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines