[Package Index | Mudlib Index | Effect Index]

File /std/shops/player_shop/office.c

The standard inheritable object for player-run shop offices.

Description

This office is the nerve centre of the shop. Most of the data structures are defined and maintained from here, and virtually all of the managerial functions are forwarded here. It is this object that passes the common variables across to other files as they call for them. This minimises the complexity of setting up each object - as long as they point to this object, and this object is correctly set up, the objects will know which shop they belong to, who the employees are, who the proprietor is etc.

Before the shop will function correctly, it must be registered with the handler - see set_very_short()

Most of the functions defined in the office are not needed by creators. Those that are needed are shown in the examples. Other functions are not necessary, but may be useful.

The source to this object is split into 15 different files. The main file, office.c includes the other files under the office_code directory. This is intended to ease code maintenance as the total size of the office code (as of December 2000) is around 165k.

In general, the functions contained in office.c are those intended to be used directly by creators. The other functions are called internally by the shop.

The data itself is also saved into several files. The data is arranged into these files to minimise the amount of disk activity when changes are made. For example, employee data changes every time an employee does something. The list of applicants, however, changes only when an application status changes. They are, therefore, saved into seperate files. Also, each save call is subject to a callout, and will limit the amount of disk writing actually done. The only data not stored by this file is the stock data, which is saved by each cabinet individually. All data and logs are saved into several files within a directory "/d/(domain)/save/player_shops/(shop_very_short)/". In addition, some data are cleared if it hasn't been used for a while. This will typically save up to 100k of memory for a store the size of Tarnach's.

The shop supports notice boards, posting all hirings, promotions, bonus amounts in addition to any posts requested in the inheriting object. In the absence of a board, all posts are mailed to each employee and each employee will have access to an additional "memo" command in the office.

Applications are handled automatically, with managers voting whether to accept or reject an application. On gaining positive votes from at least 50% of the managers, an applicant is hired. If they receive more than 50% negative votes, they are rejected. If there are insufficient votes to settle the decision, an applicant will be hired if more managers have voted for than against. Policy suggestions are handled in a similar way.

The shop's two main administration routines are run on a regular basis. The first of these is run every day and is responsible for checking that employees are still valid players (not deleted chars or creators). It conducts automatic promotions, and handles demotions for inactive employees. It also updates the lists of declined applicants and banned people and removes that status if applicable. Finally, it calls the check_hire_list() function to see if we can hire any new employees.

The second is run every Discworld month. This review involves paying employees directly into their nominated bank account, and awarding bonuses based on the current value of the bonus fund.

See also:
/include/player_shop.h, /std/shops/player_shop/mgr_office.c, /std/shops/player_shop/counter.c, /std/shops/player_shop/storeroom.c, /std/shops/player_shop/shop_front.c and /std/shops/player_shop/shopkeeper.c

Written by Ringo

Started 1st August 1999

Example

#include "path.h"

inherit "/std/shops/player_shop/office";

void setup()
{
   set_light(60);
   set_place("Lancre");
   set_language("morporkian");
   set_proprietor("Tarnach Fendertwin");
   set_shop_name("Tarnach Fendertwin's Quality Consumables (Creel Springs)");
   set_very_short("TFQC-CS", PATH + "save/");
   set_channel("tarnachcs", 0);
   set_stock_policy("magical spell components");

   set_shop_front(PATH+ "front");
   set_counter(PATH+ "counter");
   set_storeroom(PATH+ "storeroom");
   set_directions("east", "east", "east");

   set_shopkeeper(PATH + "shopkeeper");

   set_short("office of Tarnach's shop");
   set_long("This room is the office of the Creel Springs branch of "
     "Tarnach Fendertwin's Quality Consumables.  There is a door to the "
     "managers' office in the south wall.\n");
   add_sign("The sign is a small piece of paper stuck to the wall.\n",
     "This seems to be a handwritten note from Tarnach himself.  "
     "The handwriting, not to mention the spelling and the grammar, "
     "is appalling, so it's difficult to make out much.  All you "
     "can understand is something about what the \"office\" is for.",
     "sign", "sign" )->add_property( "there", "on one wall");
   add_exit("east", PATH+ "counter", "door");
   add_manager_exit("south", PATH + "mgr_office");
}

Inherits

This class inherits the following classes /std/room/basic_room.c

Includes

This class includes the following files /include/refresh.h, /include/money.h, /include/board.h, /std/shops/player_shop/office_code/stock.c, /std/shops/player_shop/office_code/policies.c, /std/shops/player_shop/office_code/personnel.c, /std/shops/player_shop/office_code/logging.c, /std/shops/player_shop/office_code/lists.c, /std/shops/player_shop/office_code/cabinets.c, /std/shops/player_shop/office_code/applications.c, /std/shops/player_shop/office_code/admin.c, /include/move_failures.h, /include/mail.h, /std/shops/player_shop/office_code/save.c, /std/shops/player_shop/office_code/review.c, /std/shops/player_shop/office_code/memo.c, /std/shops/player_shop/office_code/masked.c, /std/shops/player_shop/office_code/emp_cmd.c, /std/shops/player_shop/office_code/baddies.c, /std/shops/player_shop/office.h, /include/shops/bank.h and /include/player_shop.h

Method index

Public Functions

These are functions that everyone can access.

.