/*
....[@@@..[@@@..............[@.................. MUD++ is a written from
....[@..[@..[@..[@..[@..[@@@@@....[@......[@.... scratch multi-user swords and
....[@..[@..[@..[@..[@..[@..[@..[@@@@@..[@@@@@.. sorcery game written in C++.
....[@......[@..[@..[@..[@..[@....[@......[@.... This server is an ongoing
....[@......[@..[@@@@@..[@@@@@.................. development project.  All 
................................................ contributions are welcome. 
....Copyright(C).1995.Melvin.Smith.............. Enjoy. 
------------------------------------------------------------------------------
Melvin Smith (aka Fusion)         msmith@falcon.mercer.peachnet.edu 
MUD++ development mailing list    mudpp-list@spice.com
------------------------------------------------------------------------------
char_act.cc
*/

#include "string.h"
#include "llist.h"
#include "index.h"
#include "indexable.h"
#include "room.h"
#include "bit.h"
#include "char.h"

void Char::quaff( Object * obj )
{
	// Leave check for isPotion to caller, this is a utility member
	out( "You work the seal off " );
	out( obj->getShort() );
	out( "\n\rYou quaff " );
	out( obj->getShort() );
	out( "\n\r" );

	in_room->outAllCharExcept( getShort(), this, 0 );
	in_room->outAllCharExcept( " works the seal off ", this, 0 );
	in_room->outAllCharExcept( obj->getShort(), this, 0 );
	in_room->outAllCharExcept( ".\n\r", this, 0 );
	in_room->outAllCharExcept( getShort(), this, 0 );
	in_room->outAllCharExcept( " quaffs ", this, 0 );
	in_room->outAllCharExcept( obj->getShort(), this, 0 );
	in_room->outAllCharExcept( ".\n\r", this, 0 );

	obj->cast( this );
	obj->extract();
	delete obj;
}


void Char::quaff( const char * arg )
{
	if( ! *arg )
		return;

	Object * obj = getObjInv( arg );

	if( !obj )
	{
		out( "You don't have that.\n\r" );
		return;
	}
	else
	if( !obj->isPotion() )
	{
		out( "That is not a potion.\n\r" );
		return;
	}

	quaff( obj );
}