/*Mud-wide spellups by Theodryck */
/* You need to add the declarations in merc.h */
/* Add do_spup to the command table in interp.c */

/* Add this to act_wiz.c */
void do_spup( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA       *rch;
    CHAR_DATA       *wch;
    ROOM_INDEX_DATA *location;
    ROOM_INDEX_DATA *original;
    char            arg1[MAX_INPUT_LENGTH];
    char            buf[MAX_STRING_LENGTH];
    char            *arg2;

    rch = get_char( ch );

    if ( !authorized( rch, "spup" ) )
        return;

    one_argument( argument, arg1 );



    original = ch->in_room;

    if( arg1[0]== '\0' )
     {
      send_to_char( "Which spell would you like to cast on the mud?", ch );
      return;
     }

    /*
     * See if 'ch' still exists before continuing!
     * Handles 'at XXXX quit' case.
     */
    for ( wch = char_list; wch; wch = wch->next )
    {
       if ( wch == ch )
         continue;

       if( wch->deleted )
         continue;

       if( IS_IMMORTAL( wch ) )
	 continue;

       if (!IS_NPC ( wch ) )
        {
         arg2 = wch->name;
         location = find_location( ch, wch->name );
         sprintf( buf, "'%s' %s", arg1, wch->name );
         char_from_room( ch );
         char_to_room( ch, location );
         do_cast( ch, buf );

        }
    }

    char_from_room( ch );
    char_to_room( ch, original );

    return;
}