/
LIB3/
LIB3/D/ADMIN/
LIB3/D/ADMIN/OBJ/
LIB3/D/ADMIN/ROOM/W/
LIB3/D/HOME/
LIB3/D/HOME/CITY/ARENA/
LIB3/D/HOME/CITY/ITEMS/
LIB3/D/HOME/CITY/POSTOFFI/
LIB3/DOC/
LIB3/GLOBAL/SPECIAL/
LIB3/GLOBAL/VIRTUAL/
LIB3/NET/
LIB3/NET/CONFIG/
LIB3/NET/DAEMON/CHARS/
LIB3/NET/GOPHER/
LIB3/NET/INHERIT/
LIB3/NET/OBJ/
LIB3/NET/SAVE/
LIB3/NET/VIRTUAL/
LIB3/OBJ/B_DAY/
LIB3/OBJ/HANDLERS/TERM_TYP/
LIB3/PLAYERS/B/
LIB3/PLAYERS/N/
LIB3/ROOM/
LIB3/SAVE/
LIB3/SAVE/BOARDS/
LIB3/SAVE/ENVIRON/
LIB3/SAVE/POST/
LIB3/STD/COMMANDS/SHADOWS/
LIB3/STD/CREATOR/
LIB3/STD/DOM/
LIB3/STD/EFFECTS/
LIB3/STD/EFFECTS/HEALING/
LIB3/STD/EFFECTS/OTHER/
LIB3/STD/EFFECTS/POISONS/
LIB3/STD/ENVIRON/
LIB3/STD/GUILDS/
LIB3/STD/LIQUIDS/
LIB3/STD/ROOM/
LIB3/STD/TRIGGER/SHADOW/
LIB3/W/
LIB3/W/BANNOR/
LIB3/W/NEWSTYLE/
#pragma save_binary
/* handles the indirection needed for living objects...
 */
#include "money.h"

varargs int adjust_money( mixed i, string type )
{
    object  ob;
    int     val;

    ob = present( "Some Money For Me", this_object() );
    if( !ob )
    {
	ob = clone_object( MONEY_OBJECT );
	ob->move( this_object() );
    }
    val = (int)ob->query_value();
    ob->adjust_money( i, type );
    val = (int)ob->query_value() - val;
    return val;
}

mixed  *query_money_array()
{
    object  ob;

    ob = present( "Some Money For Me", this_object() );
    if( !ob )
    {
	ob = clone_object( MONEY_OBJECT );
	ob->move( this_object() );
    }
    return( mixed * ) ob->query_money_array();
}

void    set_money_array( mixed *arr )
{
    object  ob;

    ob = present( "Some Money For Me", this_object() );
    if( !ob )
    {
	ob = clone_object( MONEY_OBJECT );
	ob->move( this_object() );
    }
    ob->set_money_array( arr );
}

int     query_value()
{
    object  ob;

    ob = present( "Some Money For Me", this_object() );
    if( !ob )
    {
	ob = clone_object( MONEY_OBJECT );
	ob->move( this_object() );
    }
    return( int ) ob->query_value();
}

int     query_money( string type )
{
    object  ob;

    ob = present( "Some Money For Me", this_object() );
    if( !ob )
    {
	ob = clone_object( MONEY_OBJECT );
	ob->move( this_object() );
    }
    return( int ) ob->query_money( type );
}

int     pay_money( mixed *m_array )
{
    int     i, j, val;
    mixed  *m_a;
    object  ob;

    ob = present( "Some Money For Me", this_object() );
    if( !ob )
    {
	ob = clone_object( MONEY_OBJECT );
	ob->move( this_object() );
    }
    val = (int)ob->query_value();
    for( i = 0; i < sizeof( m_array ); i += 2 )
    {
	m_a = (mixed *)MONEY_HAND->make_payment( m_array[ i ], m_array[ i + 1 ],
						 this_object() );
	for( j = 0; j < sizeof( m_a[ 0 ] ); j += 2 )
	    ob->adjust_money( -m_a[ 0 ][ j + 1 ], m_a[ 0 ][ j ] );
	for( j = 0; j < sizeof( m_a[ 1 ] ); j += 2 )
	    ob->adjust_money( m_a[ 1 ][ j + 1 ], m_a[ 1 ][ j ] );
    }
    val = (int)ob->query_value() - val;
    return val;
}