money_concepts

concepts
CONCEPT
        money

OBJECTS
        /obj/money.c, /obj/money_demon.c, /lib/money.c

AUTHOR
        Sique, Mar 8 1995

DESCRIPTION
        The money is served by two main objects:
        the money object the player carries around and the money demon,
        which is mainly a database server for the money types.

        The money library contains lots of useful functions to deal with
        the money, but it just sets up calls for either the money objects
        or the money demon.

        The money object carries a mapping which consists of the names of
        the coin types and the number of them the player carries around.
        The money demon has a database of those coin types, which knows
        about the different properties like value, contains, name, description
        and others.
        Every descriptional function inside the money ask the money demon
        for the concrete values the carried money mapping has.

        A change in the money database also causes an immediate change in the
        values, weights, descriptions... in all money objects.
        So be very careful with those changes, because the weight may differ
        without noticing the environment about.

        The money object needs some sophisicated extensions to the normal
        functions an object has like id() and move().
        Because the id() has to split the money into two parts (one that is
        meant by the id string, and the remaining), and the remaining has to
        be kept out of way until the action ended the money uses the player's
        RegisterCmdFun() to set up a call to money_rearrange() to be executed
        after the action ended. This function moves the money and all occuring
        remainings back to their origin environments and merges all money
        objects in the same environment together.
        Also every move() sets up a call to money_rearrange(), because in the
        new environment may already exist an other money object.
        At least remove() calls money_rearrange() first before removing the
        money object, to avoid inconsistencies.

        money_rearrange() can't be called recursively, it checks first, if it's
        already working.

SEE ALSO
        money(S), money-howto(C)