--- deliantra/server/common/holy.C 2006/08/31 17:54:14 1.3 +++ deliantra/server/common/holy.C 2006/09/03 00:18:39 1.4 @@ -7,15 +7,15 @@ #include #include +//TODO: make a constructor static godlink *init_godslist(void) { - godlink *gl = (godlink *) malloc(sizeof(godlink)); - if(gl==NULL) - fatal(OUT_OF_MEMORY); - gl->name=NULL; /* how to describe the god to the player */ - gl->arch=NULL; /* pointer to the archetype of this god */ - gl->id=0; /* id of the god */ - gl->pantheon=NULL; /* the group to which the god belongs (not implemented) */ - gl->next=NULL; /* next god in this linked list */ + godlink *gl = new godlink; + + // name=NULL; /* how to describe the god to the player */ + // arch=NULL; /* pointer to the archetype of this god */ + // id=0; /* id of the god */ + // pantheon=NULL; /* the group to which the god belongs (not implemented) */ + // next=NULL; /* next god in this linked list */ return gl; } @@ -45,7 +45,7 @@ god = init_godslist(); god->arch = god_arch; - god->name=add_string(god_arch->clone.name); + god->name = god_arch->clone.name; if(!first_god) god->id = 1; else { @@ -55,7 +55,7 @@ first_god = god; #ifdef DEBUG_GODS - LOG(llevDebug,"Adding god %s (%d) to list\n",god->name,god->id); + LOG(llevDebug,"Adding god %s (%d) to list\n",&god->name,god->id); #endif } @@ -76,11 +76,10 @@ } /* if the object name hasnt' been changed, we tack on the gods name */ if(!strcmp(op->name,op->arch->clone.name)) { - if(op->name!=NULL) free_string(op->name); - sprintf(buf,"%s of %s",op->name,god->name); - op->name = add_string(buf); + sprintf(buf,"%s of %s",&op->name,&god->name); + op->name = buf; } - op->title=add_string(god->name); + op->title = god->name; return 1; } return 0; @@ -116,8 +115,7 @@ LOG(llevDebug,"Freeing god information\n"); for (god=first_god; god; god=godnext) { godnext=god->next; - if (god->name) free_string(god->name); - free(god); + delete god; } }