[an error occurred while processing this directive]
[<a href="index.shtml">Package Index</a></code> | <a href="index_std.shtml">Mudlib Index</a></code> | <a href="index_eff.shtml">Effect Index</a></code>]<br><h2>File /std/shops/controllers/craft_shop_controller.c</h2>
This is to handle a place where players can sell a number of neato
craft items they have made up.  It will be extended to deal with
books as well.
<p>
It keeps track of who sold each item and how much they will
receive when they pay for it.  Then tracks the royalties so
they can come back and collect them.
<p>
This will be run as a handler object so that npcs and rooms can
both run as this sort of shop.
<p>
NB: This object is not saved using save_object.  You need to set the
save and load functions for this system to work.<p>Written by Pinkfish<p>Started Thu Feb  5 15:39:57 CST 1998
<h2>Includes</h2>
This class includes the following files <a href="include.playtesters.h.shtml">/include/playtesters.h</a>, /include/shops/craft_shop.h, <a href="include.move_failures.h.shtml">/include/move_failures.h</a>, <a href="include.money.h.shtml">/include/money.h</a>, /include/shops/bank.h, <a href="include.player.h.shtml">/include/player.h</a> and <a href="include.obj_parser.h.shtml">/include/obj_parser.h</a><h2>Class Index</h2>
<ul><li><a href="#class_craft_category">craft_category</a>
<br/>
This is the class with information about the category in it.
<li><a href="#class_craft_object">craft_object</a>
<br/>
This keeps track of the object information itself.
<li><a href="#class_craft_sellable">craft_sellable</a>
<br/>
This class is the main sellable list.
</ul><h2>Method index</h2>
<dl><ul>
<li><a href="#add_category_accepted">add_category_accepted</a>(string)<br/>
This method adds a category and sets it as already being accepted.
<li><a href="#add_category_request">add_category_request</a>(string, object, int)<br/>
Add a request for a new category.
<li><a href="#add_list_object">add_list_object</a>(object, string, int, string, string, int)<br/>
This will allow us to add an object into the inventory of the
craft shop.
<li><a href="#add_to_sellables">add_to_sellables</a>(string, string, class craft_object *)<br/>
This method adds a selable into the current sellable array.
<li><a href="#adjust_royalty">adjust_royalty</a>(string, int)<br/>
This method adjusts the current royalties for the player.
<li><a href="#buy_objects">buy_objects</a>(object *, string, int, string, string, int)<br/>
This method will buy the specified objects and place them into our
current potential sell list.
<li><a href="#change_category_of_shop_object">change_category_of_shop_object</a>(object, string)<br/>
This method changes the category of the shop object.
<li><a href="#change_name_of_shop_object">change_name_of_shop_object</a>(object, string, int)<br/>
This method changes the name of the shop object.
<li><a href="#change_value_of_shop_object">change_value_of_shop_object</a>(object, int)<br/>
This method changes the value of the shop object.
<li><a href="#create_all_real_objects">create_all_real_objects</a>(object, object *)<br/>
This method creates real objects for all the passed in dummy objects.
<li><a href="#create_auto_load_file">create_auto_load_file</a>(mixed, int)<br/>
This method creates a save file for the specified objects autoloading
capability.
<li><a href="#create_craft_object">create_craft_object</a>(object, string, int, string)<br/>
This method creates a craft object from the input actual object.
<li><a href="#create_craft_sellable">create_craft_sellable</a>()<br/>
This method creates a sellable class.
<li><a href="#create_dummy_object">create_dummy_object</a>(string, string, int, class craft_object)<br/>
This method creates a dummy object for use when selling items.
<li><a href="#create_real_auto_load_object">create_real_auto_load_object</a>(int, object)<br/>
This method creates a real object from the save file number.
<li><a href="#create_real_object">create_real_object</a>(object, class craft_object)<br/>
This method turns a craft_object class into an actual object.
<li><a href="#delete_objects">delete_objects</a>(string)<br/>
This method deletes the specified list entry.
<li><a href="#find_matching_objects">find_matching_objects</a>(string)<br/>
This method finds the objects which matched the passed in pattern.
<li><a href="#find_shop_object">find_shop_object</a>(class craft_object)<br/>
This method figured out what the real object is for the class.
<li><a href="#has_voted_for_category">has_voted_for_category</a>(string, object)<br/>
This method checks to see if the player has voted (or nominated) for a
specified category already.
<li><a href="#is_valid_category">is_valid_category</a>(string)<br/>
This method checks to make sure that the category is valid.
<li><a href="#load_it">load_it</a>()<br/>
This method loads the current state of the system.
<li><a href="#pay_out_royalty">pay_out_royalty</a>(string, string, int)<br/>
This method pays out the royalties owed to the specified player.
<li><a href="#query_all_royalties">query_all_royalties</a>()<br/>
This method returns the royalty mapping on the object.
<li><a href="#query_categories">query_categories</a>()<br/>
This method returns the list of categories for the current shop.
<li><a href="#query_category_description">query_category_description</a>(string)<br/>
This method returns the category description.
<li><a href="#query_category_information">query_category_information</a>(string)<br/>
This method returns the category information.
<li><a href="#query_category_of">query_category_of</a>(string, string)<br/>
This method returns the category associated with this name/category
set.
<li><a href="#query_category_of_shop_object">query_category_of_shop_object</a>(object)<br/>
This method returns the category of the speficied shop object.
<li><a href="#query_category_timeout">query_category_timeout</a>(string)<br/>
This method returns the time the current category has left before it
times out.
<li><a href="#query_class_of_shop_object">query_class_of_shop_object</a>(object)<br/>
This method searches the current sell list to see if the object
passed corresponds to any of the existing things in our
sell list.
<li><a href="#query_dont_use_name">query_dont_use_name</a>()<br/>
This method is used to determine the status of the flag which controls
adding the owners name to shop objects by default.
<li><a href="#query_id_of_shop_object">query_id_of_shop_object</a>(object)<br/>
This method returns the id associated with the shop object.
<li><a href="#query_items_with_shop_id">query_items_with_shop_id</a>(string)<br/>
This method returns all the objects which match the specified
id of the shop object.
<li><a href="#query_list_object_cost">query_list_object_cost</a>(string, string)<br/>
This method returns the cost of the specified type of object.
<li><a href="#query_name_of_shop_object">query_name_of_shop_object</a>(object)<br/>
This method returns the list name associated with the shop
object.
<li><a href="#query_next_shop_id">query_next_shop_id</a>()<br/>
This method attempts to figure out what the next id would
be for the object.
<li><a href="#query_owner_of_shop_object">query_owner_of_shop_object</a>(object)<br/>
This method returns the owner associated with the shop
object.
<li><a href="#query_owner_sellables">query_owner_sellables</a>(string)<br/>
This method returns the list of sellables that the owner currently
has in the shop.
<li><a href="#query_royalty">query_royalty</a>(string)<br/>
This method returns the current royalties for the specified person.
<li><a href="#query_sell_list">query_sell_list</a>()<br/>
This method returns the container associated with the sell list.
<li><a href="#query_sell_list_obs">query_sell_list_obs</a>()<br/>
This method returns all the current objects in the sell list.
<li><a href="#query_short_of_shop_object">query_short_of_shop_object</a>(object)<br/>
This method returns the possible short descriptions of the shop objects.
<li><a href="#remove_auto_load_file">remove_auto_load_file</a>(int)<br/>
This method removes the auto load stuff after it is no longer needed.
<li><a href="#remove_category_accepted">remove_category_accepted</a>(string)<br/>
This method removes a category immediately.
<li><a href="#remove_list_object">remove_list_object</a>(string, string, class craft_object)<br/>
This method removes a single object from the current object list.
<li><a href="#remove_shop_id">remove_shop_id</a>(string)<br/>
This method removes an id when that book has been taken from the
shop.
<li><a href="#remove_shop_object">remove_shop_object</a>(object)<br/>
This method removes the real data behind the specified shop object.
<li><a href="#save_it">save_it</a>()<br/>
This method saves the current state of the system.
<li><a href="#sell_objects">sell_objects</a>(object *, string, object, int, int, int ref)<br/>
This method sells the specified shop objects to the player.
<li><a href="#set_category_description">set_category_description</a>(string, string)<br/>
This method sets the description of the category.
<li><a href="#set_category_function">set_category_function</a>(function)<br/>
This method is called when categories complete each of their phases to
see if the idea was passed by enough majority or whatever to go onto
the next one.
<li><a href="#set_category_information">set_category_information</a>(string, string)<br/>
This method sets the information of the category.
<li><a href="#set_dont_use_name">set_dont_use_name</a>(int)<br/>
This method is called by the controled object onto here to control
if the owners name is added to shop objects.
<li><a href="#set_id_of_shop_objects">set_id_of_shop_objects</a>(object *, string)<br/>
This method sets the current id of the shop objects.
<li><a href="#set_load_function">set_load_function</a>(function)<br/>
This method sets the load function on the class.
<li><a href="#set_save_function">set_save_function</a>(function)<br/>
This method sets the save function on the class.
<li><a href="#update_craft_object">update_craft_object</a>(object, object)<br/>
This method updates the internal representation of the specified
craft object.
<li><a href="#value_of_objects">value_of_objects</a>(object *)<br/>
This method determines the price of all the shop objects in the
array.
<li><a href="#vote_for_category">vote_for_category</a>(string, object, int)<br/>
This method allows the player to vote for the specified category.
</ul><h2>Public Functions</h2>
These are functions that everyone can access.<p>
.<ul><a name="add_category_accepted">
add_category_accepted</a><pre>
int add_category_accepted(string name)
</pre></br>
This method adds a category and sets it as already being accepted.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the name of the category to add

</dl>

<ul><a name="add_category_request">
add_category_request</a><pre>
int add_category_request(string name,
                         object player,
                         int timeout)
</pre></br>
Add a request for a new category.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the name of the category
<br/>player - the person who suggested it
<br/>timeout - the initial timeout for the nomination period
<li><b>Returns:</b>
<br/>1 if successful added, 0 if not

</dl>

<ul><a name="add_list_object">
add_list_object</a><pre>
int add_list_object(object ob,
                    string name,
                    int cost,
                    string owner,
                    string category,
                    int dont_update_cost)
</pre></br>
This will allow us to add an object into the inventory of the
craft shop.  If the name already exists in the inventory we
just increment the number left by the number passed in here.
If the number left goes below 0 then the item is remove
from the inventory.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the object to add
<br/>name - the tag to use for it
<br/>num - the number to add
<br/>category - the category to add the item to
<br/>dont_update_cost - allows the same name to have multiple prices
<li><b>See also:</b>
<br/><a href="#remove_list_object">remove_list_object()</a> and <a href="#add_sell_list_name">add_sell_list_name()
</a></dl>

<ul><a name="adjust_royalty">
adjust_royalty</a><pre>
void adjust_royalty(string player,
                    int amt)
</pre></br>
This method adjusts the current royalties for the player.
<br/><ul>
<li><b>Parameters:</b>
<br/>player - the name of the player to pay the royalties to
<br/>amt - the amount to adjust the value by
<li><b>See also:</b>
<br/><a href="#query_royalties">query_royalties()</a> and <a href="#pay_out_royalties">pay_out_royalties()
</a></dl>

<ul><a name="buy_objects">
buy_objects</a><pre>
object * buy_objects(object * obs,
                     string name,
                     int cost,
                     string owner,
                     string category,
                     int dont_update_costs)
</pre></br>
This method will buy the specified objects and place them into our
current potential sell list.  This will destroy the objects after
it has been added into the sell list correctly.
<br/><ul>
<li><b>Parameters:</b>
<br/>obs - the object to sell
<br/>name - the name of the object to sell
<br/>cost - the cost of the object being sold
<br/>owner - the person to who the object belongs
<br/>category - the category of the object
<br/>dont_update_costs - allows the system to handle objects with the same
name and different costs
<li><b>See also:</b>
<br/><a href="#sell_objects">sell_objects()
</a></dl>

<ul><a name="change_category_of_shop_object">
change_category_of_shop_object</a><pre>
int change_category_of_shop_object(object ob,
                                   string new_category)
</pre></br>
This method changes the category of the shop object.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the shop object to change
<br/>new_category - the new category of the shop object

</dl>

<ul><a name="change_name_of_shop_object">
change_name_of_shop_object</a><pre>
int change_name_of_shop_object(object ob,
                               string new_name,
                               int dont_update_cost)
</pre></br>
This method changes the name of the shop object.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the shop object to change
<br/>new_name - the new name of the shop object
<br/>dont_update_cost - allows the names to merge and not update costs
<li><b>Returns:</b>
<br/>1 on success, 0 on failure

</dl>

<ul><a name="change_value_of_shop_object">
change_value_of_shop_object</a><pre>
void change_value_of_shop_object(object ob,
                                 int value)
</pre></br>
This method changes the value of the shop object.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the shop object
<br/>value - the new value

</dl>

<ul><a name="create_all_real_objects">
create_all_real_objects</a><pre>
object * create_all_real_objects(object player,
                                 object * obs)
</pre></br>
This method creates real objects for all the passed in dummy objects.
Remember to dest the objects after you are finished with them.
<br/><ul>
<li><b>Parameters:</b>
<br/>obs - the dummy objects to find real ones of
<li><b>Returns:</b>
<br/>the real object values
<li><b>See also:</b>
<br/><a href="#create_real_object">create_real_object()</a><li><b>Example:</b>
<br/><pre>real_obs = create_real_objects(this_player(), obs);
foreach (ob in real_obs) {
   ret += ob->the_short + ":\n" + ob->long() + "\n";
}
</pre></dl>

<ul><a name="create_craft_object">
create_craft_object</a><pre>
class craft_object create_craft_object(object ob,
                                       string owner,
                                       int cost,
                                       string category)
</pre></br>
This method creates a craft object from the input actual object.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the real input object
<br/>owner - the owner of the object
<br/>cost - the cost of the object
<br/>category - the category of the object
<li><b>Returns:</b>
<br/>a nice craft object

</dl>

<ul><a name="create_craft_sellable">
create_craft_sellable</a><pre>
class craft_sellable create_craft_sellable()
</pre></br>
This method creates a sellable class.
<br/><ul>
<li><b>Returns:</b>
<br/>a new sellable class

</dl>

<ul><a name="create_real_object">
create_real_object</a><pre>
object create_real_object(object player,
                          class craft_object craft)
</pre></br>
This method turns a craft_object class into an actual object.
<br/><ul>
<li><b>Parameters:</b>
<br/>craft - the craft object to create
<li><b>Returns:</b>
<br/>the newly formed craft object
<li><b>See also:</b>
<br/><a href="#create_all_real_objects">create_all_real_objects()
</a></dl>

<ul><a name="delete_objects">
delete_objects</a><pre>
void delete_objects(string id)
</pre></br>
This method deletes the specified list entry.  The player
owner will not be payed.
<br/><ul>
<li><b>Parameters:</b>
<br/>id - The list entry to delete

</dl>

<ul><a name="find_matching_objects">
find_matching_objects</a><pre>
class obj_match find_matching_objects(string str)
</pre></br>
This method finds the objects which matched the passed in pattern.
Note, this returns the dummy pointer objects not the actual
objects, they need to be changed into real objects before they
are really sold.
<br/><ul>
<li><b>Parameters:</b>
<br/>str - the pattern to match the objects on
<li><b>Returns:</b>
<br/>the matching objects
<li><b>See also:</b>
<br/><a href="#query_class_of_shop_object">query_class_of_shop_object()</a>, <a href="#value_of_objects">value_of_objects()</a> and <a href="#sell_objects">sell_objects()
</a></dl>

<ul><a name="find_shop_object">
find_shop_object</a><pre>
object find_shop_object(class craft_object frog)
</pre></br>
This method figured out what the real object is for the class.
<br/><ul>
<li><b>Parameters:</b>
<br/>frog - the class to find the object for
<li><b>Returns:</b>
<br/>the dummy object for the class

</dl>

<ul><a name="has_voted_for_category">
has_voted_for_category</a><pre>
int has_voted_for_category(string name,
                           object player)
</pre></br>
This method checks to see if the player has voted (or nominated) for a
specified category already.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the name of the category
<br/>player - the player being checked
<li><b>Returns:</b>
<br/>1 if they have voted/nominated 0 if they have not

</dl>

<ul><a name="is_valid_category">
is_valid_category</a><pre>
int is_valid_category(string category)
</pre></br>
This method checks to make sure that the category is valid.  This
means a category that has been properly accepted.
<br/><ul>
<li><b>Parameters:</b>
<br/>category - the category to check

</dl>

<ul><a name="load_it">
load_it</a><pre>
void load_it()
</pre></br>
This method loads the current state of the system.
<br/><ul>
<li><b>See also:</b>
<br/><a href="#set_load_function">set_load_function()
</a></dl>

<ul><a name="pay_out_royalty">
pay_out_royalty</a><pre>
void pay_out_royalty(string player,
                     string place,
                     int amount)
</pre></br>
This method pays out the royalties owed to the specified player.
<br/><ul>
<li><b>Parameters:</b>
<br/>player - the player to pay out
<br/>place - the place in which the royalties are to occur
<br/>amount - the amount to pay out, 0 for everything
<li><b>See also:</b>
<br/><a href="#query_royalties">query_royalties()</a> and <a href="#adjust_royalties">adjust_royalties()
</a></dl>

<ul><a name="query_all_royalties">
query_all_royalties</a><pre>
mapping query_all_royalties()
</pre></br>
This method returns the royalty mapping on the object.  This is only
use for debug information.
<br/><ul>
<li><b>Returns:</b>
<br/>the royalties mapping

</dl>

<ul><a name="query_categories">
query_categories</a><pre>
string * query_categories()
</pre></br>
This method returns the list of categories for the current shop.
<br/><ul>
<li><b>Returns:</b>
<br/>the list of categories

</dl>

<ul><a name="query_category_description">
query_category_description</a><pre>
string query_category_description(string cat)
</pre></br>
This method returns the category description.
<br/><ul>
<li><b>Parameters:</b>
<br/>cat - the cateogryt to find the description for
<li><b>Returns:</b>
<br/>0 for no description, the main description otherwise

</dl>

<ul><a name="query_category_information">
query_category_information</a><pre>
string query_category_information(string cat)
</pre></br>
This method returns the category information.
<br/><ul>
<li><b>Parameters:</b>
<br/>cat - the cateogryt to find the information for
<li><b>Returns:</b>
<br/>0 for no information, the main information otherwise

</dl>

<ul><a name="query_category_of">
query_category_of</a><pre>
string query_category_of(string name,
                         string owner)
</pre></br>
This method returns the category associated with this name/category
set.


<ul><a name="query_category_of_shop_object">
query_category_of_shop_object</a><pre>
string query_category_of_shop_object(object ob)
</pre></br>
This method returns the category of the speficied shop object.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the object to find the category of
<li><b>Returns:</b>
<br/>the category of the object

</dl>

<ul><a name="query_category_timeout">
query_category_timeout</a><pre>
int query_category_timeout(string name)
</pre></br>
This method returns the time the current category has left before it
times out.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the name of the cateogyr
<li><b>Returns:</b>
<br/>the time it timesout

</dl>

<ul><a name="query_class_of_shop_object">
query_class_of_shop_object</a><pre>
class craft_object query_class_of_shop_object(object ob)
</pre></br>
This method searches the current sell list to see if the object
passed corresponds to any of the existing things in our
sell list.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the object to check
<li><b>Returns:</b>
<br/>the craft_object class pointed to by the object
<li><b>See also:</b>
<br/><a href="#add_object">add_object()</a>, <a href="#remove_object">remove_object()</a> and <a href="#create_real_object">create_real_object()
</a></dl>

<ul><a name="query_dont_use_name">
query_dont_use_name</a><pre>
int query_dont_use_name()
</pre></br>
This method is used to determine the status of the flag which controls
adding the owners name to shop objects by default.
If this is set to 1
then the owners name will  not be added by default.
<br/><ul>
<li><b>Returns:</b>
<br/>1 if the object owners name is not used, 0 if it is

</dl>

<ul><a name="query_id_of_shop_object">
query_id_of_shop_object</a><pre>
string query_id_of_shop_object(object ob)
</pre></br>
This method returns the id associated with the shop object.
This is the one letter id used for buying selling etc.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the shop object to query the id of
<li><b>Returns:</b>
<br/>the id of the shop object

</dl>

<ul><a name="query_items_with_shop_id">
query_items_with_shop_id</a><pre>
object * query_items_with_shop_id(string id)
</pre></br>
This method returns all the objects which match the specified
id of the shop object.
<br/><ul>
<li><b>Parameters:</b>
<br/>id - the shop id to match on
<li><b>Returns:</b>
<br/>the objects which match it

</dl>

<ul><a name="query_list_object_cost">
query_list_object_cost</a><pre>
int query_list_object_cost(string name,
                           string owner)
</pre></br>
This method returns the cost of the specified type of object.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the name of the object
<br/>owner - the owner of the object
<li><b>Returns:</b>
<br/>the cost of the object, 0 if it is not known
<li><b>See also:</b>
<br/><a href="#query_owner_sellables">query_owner_sellables()
</a></dl>

<ul><a name="query_name_of_shop_object">
query_name_of_shop_object</a><pre>
string query_name_of_shop_object(object ob)
</pre></br>
This method returns the list name associated with the shop
object.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the shop object to query the list name of
<li><b>Returns:</b>
<br/>the owner of the shop object

</dl>

<ul><a name="query_next_shop_id">
query_next_shop_id</a><pre>
string query_next_shop_id()
</pre></br>
This method attempts to figure out what the next id would
be for the object.  It will allocate this id as well as returning.
<br/><ul>
<li><b>Returns:</b>
<br/>the next id for the shop
<li><b>See also:</b>
<br/><a href="#remove_shop_id">remove_shop_id()</a> and <a href="#update_sellables">update_sellables()
</a></dl>

<ul><a name="query_owner_of_shop_object">
query_owner_of_shop_object</a><pre>
string query_owner_of_shop_object(object ob)
</pre></br>
This method returns the owner associated with the shop
object.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the shop object to query the owner of
<li><b>Returns:</b>
<br/>the owner of the shop object

</dl>

<ul><a name="query_owner_sellables">
query_owner_sellables</a><pre>
string * query_owner_sellables(string owner)
</pre></br>
This method returns the list of sellables that the owner currently
has in the shop.  This will potentially return more than one of the
same name if the owner has more than one of the same sort of object
being sold.
<br/><ul>
<li><b>Parameters:</b>
<br/>owner - the owner to check
<li><b>Returns:</b>
<br/>the array of all the possible sellables
<li><b>See also:</b>
<br/><a href="#query_list_object_cost">query_list_object_cost()
</a></dl>

<ul><a name="query_royalty">
query_royalty</a><pre>
int query_royalty(string player)
</pre></br>
This method returns the current royalties for the specified person.
<br/><ul>
<li><b>Parameters:</b>
<br/>player - the player to get the royalties for
<li><b>Returns:</b>
<br/>the current royalties
<li><b>See also:</b>
<br/><a href="#adjust_royalties">adjust_royalties()</a> and <a href="#pay_out_royalties">pay_out_royalties()
</a></dl>

<ul><a name="query_sell_list">
query_sell_list</a><pre>
object query_sell_list()
</pre></br>
This method returns the container associated with the sell list.
<br/><ul>
<li><b>Returns:</b>
<br/>the container for the sell list

</dl>

<ul><a name="query_sell_list_obs">
query_sell_list_obs</a><pre>
object * query_sell_list_obs()
</pre></br>
This method returns all the current objects in the sell list.
<br/><ul>
<li><b>Returns:</b>
<br/>all the current objects in the sell list

</dl>

<ul><a name="query_short_of_shop_object">
query_short_of_shop_object</a><pre>
string query_short_of_shop_object(object ob)
</pre></br>
This method returns the possible short descriptions of the shop objects.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the object to find the shorts of
<li><b>Returns:</b>
<br/>the short descriptions

</dl>

<ul><a name="remove_category_accepted">
remove_category_accepted</a><pre>
int remove_category_accepted(string category)
</pre></br>
This method removes a category immediately.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the name of the category

</dl>

<ul><a name="remove_list_object">
remove_list_object</a><pre>
int remove_list_object(string name,
                       string owner,
                       class craft_object ob)
</pre></br>
This method removes a single object from the current object list.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the name of object to remove
<br/>owner - the owner of the object to remove
<br/>ob - the craft object pointer itself we want removed
<li><b>Returns:</b>
<br/>1 if it worked, 0 if not
<li><b>See also:</b>
<br/><a href="#add_list_object">add_list_object()
</a></dl>

<ul><a name="remove_shop_id">
remove_shop_id</a><pre>
void remove_shop_id(string id)
</pre></br>
This method removes an id when that book has been taken from the
shop.
<br/><ul>
<li><b>Parameters:</b>
<br/>id - the id to remove
<li><b>See also:</b>
<br/><a href="#query_next_shop_id">query_next_shop_id()
</a></dl>

<ul><a name="remove_shop_object">
remove_shop_object</a><pre>
int remove_shop_object(object ob)
</pre></br>
This method removes the real data behind the specified shop object.
The object passed in must be one of the dummy objects used for
listing the shops inventory.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the object to remove
<li><b>Returns:</b>
<br/>1 if the object was successfully removed
<li><b>See also:</b>
<br/><a href="#sell_objects">sell_objects()</a> and <a href="#query_class_of_shop_object">query_class_of_shop_object()
</a></dl>

<ul><a name="save_it">
save_it</a><pre>
void save_it()
</pre></br>
This method saves the current state of the system.
<br/><ul>
<li><b>See also:</b>
<br/><a href="#set_save_function">set_save_function()</a> and <a href="#load_it">load_it()
</a></dl>

<ul><a name="sell_objects">
sell_objects</a><pre>
object * sell_objects(object * obs,
                      string place,
                      object player,
                      int cut,
                      int force,
                      int ref total_value)
</pre></br>
This method sells the specified shop objects to the player.  This
will make the payments to the player.  The objects will all attempt
to be moved into the player.  The cut must be between 0 and 100.
<p>
The royalties from selling the object will be placed into the
correct place by the function, so they can be picked up at a 
later date.  The 'cut' will be taken out of the sale.
<br/><ul>
<li><b>Parameters:</b>
<br/>obs - the objects to sell
<br/>place - the place to sell the objects in
<br/>player - the player to sell the objects too
<br/>cut - the cut the manager takes from the sale (percentage)
<br/>force - forces the object to be bought even if it is broken
<li><b>Returns:</b>
<br/>the array of sold objects
<li><b>See also:</b>
<br/><a href="#value_of_objects">value_of_objects()</a>, <a href="#find_matching_objects">find_matching_objects()</a> and <a href="#adjust_royalty">adjust_royalty()
</a></dl>

<ul><a name="set_category_description">
set_category_description</a><pre>
void set_category_description(string cat,
                              string desc)
</pre></br>
This method sets the description of the category.
<br/><ul>
<li><b>Parameters:</b>
<br/>cat - the category to set the description of
<br/>desc - the description of the category

</dl>

<ul><a name="set_category_function">
set_category_function</a><pre>
void set_category_function(function func)
</pre></br>
This method is called when categories complete each of their phases to
see if the idea was passed by enough majority or whatever to go onto
the next one.
<br/><ul>
<li><b>Parameters:</b>
<br/>func - the new category function

</dl>

<ul><a name="set_category_information">
set_category_information</a><pre>
void set_category_information(string cat,
                              string info)
</pre></br>
This method sets the information of the category.
<br/><ul>
<li><b>Parameters:</b>
<br/>cat - the category to set the information of
<br/>info - the information of the category

</dl>

<ul><a name="set_dont_use_name">
set_dont_use_name</a><pre>
void set_dont_use_name(int flag)
</pre></br>
This method is called by the controled object onto here to control
if the owners name is added to shop objects.  If this is set to 1
then the owners name will  not be added by default.
<br/><ul>
<li><b>Parameters:</b>
<br/>flag - the flag to set

</dl>

<ul><a name="set_id_of_shop_objects">
set_id_of_shop_objects</a><pre>
void set_id_of_shop_objects(object * obs,
                            string id)
</pre></br>
This method sets the current id of the shop objects.
<br/><ul>
<li><b>Parameters:</b>
<br/>obs - the objects to set the id for
<br/>id - the new id for them all

</dl>

<ul><a name="set_load_function">
set_load_function</a><pre>
void set_load_function(function func)
</pre></br>
This method sets the load function on the class.  The restore function
will be called with one parameter and is expected to return a string.
The parameter is the file name to load.
<br/><ul>
<li><b>Parameters:</b>
<br/>func - the new load function

</dl>

<ul><a name="set_save_function">
set_save_function</a><pre>
void set_save_function(function func)
</pre></br>
This method sets the save function on the class.  The save function will
be called with two parameters, one is the file name to be saved and
the other is the text to be saved to it.
<br/><ul>
<li><b>Parameters:</b>
<br/>func - the new save function

</dl>

<ul><a name="update_craft_object">
update_craft_object</a><pre>
void update_craft_object(object craft_ob,
                         object replacement_ob)
</pre></br>
This method updates the internal representation of the specified
craft object.  It replaces the saved auto load info with the new
stuff.
<br/><ul>
<li><b>Parameters:</b>
<br/>craft - the craft object containing the info to replace
<br/>replacement_ob - the new object

</dl>

<ul><a name="value_of_objects">
value_of_objects</a><pre>
int value_of_objects(object * obs)
</pre></br>
This method determines the price of all the shop objects in the
array.
<br/><ul>
<li><b>Parameters:</b>
<br/>obs - the objects to price
<li><b>Returns:</b>
<br/>the price of the shop objects
<li><b>See also:</b>
<br/><a href="#find_matching_objects">find_matching_objects()</a>, <a href="#query_class_of_shop_object">query_class_of_shop_object()</a> and <a href="#sell_objects">sell_objects()
</a></dl>

<ul><a name="vote_for_category">
vote_for_category</a><pre>
int vote_for_category(string name,
                      object player,
                      int choice)
</pre></br>
This method allows the player to vote for the specified category.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the name of the category
<br/>player - the player voting
<br/>choice - their choice
<li><b>Returns:</b>
<br/>1 if the vote was successful, 0 if not

</dl>


<h2>Protected Functions</h2>
These are functions that only objects inheriting the class can access.<p>
<ul><a name="add_to_sellables">
add_to_sellables</a><pre>
void add_to_sellables(string name,
                      string owner,
                      class craft_object * ob)
</pre></br>
This method adds a selable into the current sellable array.
<br/><ul>
<li><b>Parameters:</b>
<br/>name - the name the object willb elisted under
<br/>owner - the owner of the object being sold
<br/>ob - the objects being sold
<li><b>See also:</b>
<br/><a href="#add_sell_list_object">add_sell_list_object()</a> and <a href="#change_name_of_object">change_name_of_object()
</a></dl>

<ul><a name="create_auto_load_file">
create_auto_load_file</a><pre>
int create_auto_load_file(mixed ob,
                          int fixed_num)
</pre></br>
This method creates a save file for the specified objects autoloading
capability.  If the number to write to is non-null then it will
write to that object.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the object to get an autoload number for
<br/>fixed_num - the file number to write to
<li><b>Returns:</b>
<br/>the auto load number
<li><b>See also:</b>
<br/><a href="#save_it">save_it()
</a></dl>

<ul><a name="create_dummy_object">
create_dummy_object</a><pre>
object create_dummy_object(string owner,
                           string name,
                           int cost,
                           class craft_object craft)
</pre></br>
This method creates a dummy object for use when selling items.  This
allows use to use alias names for the potions when buying/selling
and not the real name of the container.  When bought these names
will be added to the thingy as aliases.
<br/><ul>
<li><b>Parameters:</b>
<br/>owner - the owner of the object
<br/>name - the sell list name of the object
<li><b>Returns:</b>
<br/>a dummy object to place into the sell list

</dl>

<ul><a name="create_real_auto_load_object">
create_real_auto_load_object</a><pre>
object create_real_auto_load_object(int num,
                                    object player)
</pre></br>
This method creates a real object from the save file number.
<br/><ul>
<li><b>Parameters:</b>
<br/>num - the save file number
<li><b>Returns:</b>
<br/>the nice shiny new object
<li><b>See also:</b>
<br/><a href="#create_auto_load_file">create_auto_load_file()
</a></dl>

<ul><a name="remove_auto_load_file">
remove_auto_load_file</a><pre>
void remove_auto_load_file(int num)
</pre></br>
This method removes the auto load stuff after it is no longer needed.
<br/><ul>
<li><b>Parameters:</b>
<br/>num - the file number to remove
<li><b>See also:</b>
<br/><a href="#create_object_from_auto_load">create_object_from_auto_load()
</a></dl>


<h2>Classes</h2>
These are nice data types for dealing with...  Data!<p>
<ul>
<li><a name="class_craft_category">
craft_category</a><pre>
class craft_category {
                       int state;
                       string description;
                       string information;
                       string * voted;
                       int yes;
                       int no;
                       int abstain;
                       int timeout;
}

</pre><br/>
This is the class with information about the category in it.
<p>

<li><a name="class_craft_object">
craft_object</a><pre>
class craft_object {
                     int cost;
                     string cap_owner;
                     int ob_num;
                     string category;
                     string short;
}

</pre><br/>
This keeps track of the object information itself.<p>

<li><a name="class_craft_sellable">
craft_sellable</a><pre>
class craft_sellable {
                       mapping objects;
}

</pre><br/>
This class is the main sellable list.
<p>

</ul>
[an error occurred while processing this directive]

