I have kingdoms in my mud rather than clans, I made a function to return
the persons kingdom in binary/string form rather than an integer and such.
It crashes when I call it into use.. Why is this?
Here is the code and where it is called.
--in utils.c--
char *king(struct char_data * chh, char *cp, int p)
{
char *kingdo;
kingdo = malloc(50);
bzero(kingdo, strlen(kingdo));
if(p == TRUE)
strcat(kingdo, " ");
switch(GET_KING(chh)){
case 1:
strcat(kingdo,"Despair");
break;
case 2:
strcat(kingdo,"&cTi&Cta&Wn&w");
break;
case 3:
strcat(kingdo,"&KS&bolphir&Ke&w");
break;
case 4:
strcat(kingdo, "Haven");
break;
case 5:
strcat(kingdo, "Olympus");
break;
case 6:
strcat(kingdo, "Demigod");
break;
default:
strcat(kingdo,cp);
break;
}
return kingdo;
}
--in act.informative.c--
in do_score
char *kingdo;
sprintf(kingdo, "%s",king(ch,"no Kingdom",TRUE));
sprintf(buf, "%sYou are a member of %s.\r\n",buf,kingdo);
I've tried different combinations of using pointers and character arrays
and even using the king function directly in the "You are a member of"
sprintf. Any ideas?
______________________________ __ _ _
|TDRD tdlord@elite.net
|QuakeWorld TF2.7 PUBLIC: quake.elite.net ten.bigcity.net
|Irc : irc.elite.net irc.lowrider.com
|MUD : mud.elite.net 4000 HaqMUD
|Clan Epidemic
|Clan Infinity
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST