Hello everyone,
This is going to probably be a newbie question, so for that I
apologize. I'd still like some ideas if possible.
Here's a typical example.
Let's say we want to copy an NPC name and an argument to a buffer.
sprintf( buf, "%s %s", victim->name, arg2 );
Then we want to:
do_transfer( ch, buf );
This is all good and well. If the victim name is "Ghoul", and the
argument is "3000", it transfers ghoul to 3000. Yay.
But what if it's oldstyle smurfette? It then becomes "transfer oldstyle
smurfette 3000". That's not how I want it.
Sure, I can modify my transfer.. but it's not a question of transfer, it's
passing NPC names to generic functions. So here's how I temporarily set
it up, just to make sure it works.
for ( victim = ch->in_room->people; victim; victim = victim_next )
{
victim_next = victim->next_in_room;
if( is_same_group( who,victim ) )
{
sprintf( cname, "%s", victim->name );
for (i = 0; cname[i] != '\0'; i++)
{
if(isspace(cname[i]))
cname[i] = '\0';
}
// sprintf( buf, "%s %s", victim->name, arg2 );
sprintf( buf, "%s %s", cname, arg2 );
log_string( buf );
do_mptransfer( ch, buf );
}
}
This is the ugliest, most hackish job EVER. But it does work. oldstyle
smurfette gets truncated to just oldstyle. So then it becomes an issue of
whether or not there are two oldstyles in the room. This means my
temporary hack isn't a final solution either.
My question then is, what would be a better way to accomplish this? I
would appreciate any input.
Thanks.
Jimmy