Hello all.
I was doing some modifications to the stock circle MUD 3.0p19 and I been
working on trying to resolve the problem with this snippet which I am posting
below. Basically...when I added it, it seems to hate it. So after trying to
figure out the problem, since it seems to be clean implemenation, I decided to
post this up.
ACMD(do_namechange){
struct char_data *vict; char *oldname;
int i,j;
char arg1[MAX_STRING_LENGTH];
char arg2[MAX_STRING_LENGTH];
char tmp_name[MAX_STRING_LENGTH];
half_chop(argument, arg1, argument);
half_chop(argument, arg2, argument);
if ((!*arg1) || (!*arg2)) {
send_to_char("Usage: namechange <character> <new name>\r\n", ch);
return;
}
if (!(vict = get_player_vis(ch, arg1, 0))) {
send_to_char("They aren't here.\r\n", ch);
return;
}
if (GET_LEVEL(vict) > 5) {
send_to_char("You can't change the name of someone over level 5.\r\n",ch);
return;
}
if (find_name(arg2)>-1) {
send_to_char("There's already somebody with this name.\r\n",ch);
return;
}
if ((_parse_name(arg2, tmp_name))||strlen(tmp_name) < 2 ||
strlen(tmp_name) > MAX_NAME_LENGTH || !Valid_Name(tmp_name) ||
fill_word(tmp_name) || reserved_word(tmp_name)) {
send_to_char("Illegal name, retry.\r\n", ch);
return;
}
for (i = 0; i <= top_of_p_table; i++)
if (player_table[i].id == GET_IDNUM(vict))
break;
if (player_table[i].id != GET_IDNUM(vict)){
send_to_char("BUG: error in player table!!!!",ch);
log("BUG: error in player table for %s with idnum %d",
GET_NAME(ch),GET_IDNUM(ch));
return;
}
oldname = strdup(GET_NAME(vict));
//player_table[i].name = strdup(arg2);
for (j = 0; (*(player_table[i].name + j) = LOWER(*(arg2 + j))); j++);
strcpy(vict->player.name, CAP(arg2));
sprintf(buf, "(GC) %s has changed the name of %s to %s.",
GET_NAME(ch),GET_NAME(vict), arg2);
mudlog(buf, BRF, LVL_IMMORT, TRUE);
save_char(vict, vict->in_room);
send_to_char("Ok.\r\n",ch);
send_to_char("Your name has changed.\r\n",vict);
}
And when I did the compile, I got this set of errors as follows:
act.wizard.c: In function `do_namechange':
act.wizard.c:2818: too few arguments to function `get_player_vis'
act.wizard.c:2828: warning: implicit declaration of function `find_name'
act.wizard.c:2834: warning: implicit declaration of function `_parse_name'
act.wizard.c:2835: warning: implicit declaration of function `Valid_Name'
act.wizard.c:2836: warning: implicit declaration of function `reserved_word'
act.wizard.c:2842: `player_table' undeclared (first use in this function)
act.wizard.c:2842: (Each undeclared identifier is reported only once
act.wizard.c:2842: for each function it appears in.)
act.wizard.c:2848: warning: int format, long int arg (arg 3)
act.wizard.c:2804: warning: `vict' might be used uninitialized in this function
make[1]: *** [act.wizard.o] Error 1
make[1]: Leaving directory `/var/local/.forgotten/circle2/src'
make: *** [all] Error 2
So.. it seems I must have missed something here. Anyone help on this?
----------------------------------------------------------
Prestiqehosting Inc.
Hosting your unique needs
on silver platter!
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT