[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/inherit/citizens.c

This handler keeps track of citizenships and magistrates.

Written by Pinkfish

Started Fri Jun 23 20:38:10 PDT 2000

Includes

This class includes the following files /include/refresh.h, /include/player_handler.h, /include/playtesters.h and /include/player.h

Method index

Public Functions

These are functions that everyone can access.

add_citizen
int add_citizen(string area,
                string citizen)

This method adds a citizen to the specified area.

Parameters:
area - the area to add the citizen too
citizen - the citizen to add to the area


add_magistrate
int add_magistrate(string area,
                   string magistrate)

This method adds a magistrate to the area. If there are no more magistrate slots then this fails.

Parameters:
area - the area to add the magistrate too
magistrate - the magistrate to add


create_area
int create_area(string area,
                int num_magistrates)

This method creates an area for citizens to womble in.

Parameters:
area - the name of the area to create
num_magistrates - the number of magistrates

Returns:
1 on succes, 0 on failure


is_citizen_of
int is_citizen_of(string area,
                  string citizen)

This method checks to see if the specified person is a citizen or not.

Parameters:
area - the area to check them in
citizen - the person to check for citizenship

Returns:
1 if they are a citizen, 0 if not


is_magistrate
int is_magistrate(string magistrate)

This method determines if someone is a magistrate of any area

Parameters:
magistrate - the person to check for magistrateship

Returns:
1 if they are a magistrate, 0 if not


is_magistrate_anywhere
int is_magistrate_anywhere(string person)

This method checks to see if the person is a magistrate anywhere. It will return 1 if they are a magistrate, 0 if they are not.

Parameters:
person - the person to check

Returns:
1 if they are, 0 if not


is_magistrate_of
int is_magistrate_of(string area,
                     string magistrate)

This method checks to see if the specified person is a magistrate or not.

Parameters:
area - the area to check them in
magistrate - the person to check for magistrateship

Returns:
1 if they are a magistrate, 0 if not


normalize_area
string normalize_area(string area)

This method normalizes an area name, turns it into the name to use as an index.

Parameters:
area - the area name to lookup

Returns:
the name to use as an index


player_delete
void player_delete(string name,
                   int type)

This is the function called by the refresh-handler when a player is deleted

Parameters:
name - The player's name
type - The type of the event.


player_refresh
void player_refresh(object player,
                    int type)

This is the function called by the refresh-handler when a player refreshes

Parameters:
player - The player object
type - The type of the event.


query_citizen
string query_citizen(string citizen)

This method checks to see if the specified person is a citizen and where they are a citizen.

Parameters:
citizen - the person to find where they are the citizen of

Returns:
where they are a citizen, or 0 on failure


query_citizenship_areas
string * query_citizenship_areas()

This method returns all the areas for citizenship.

Returns:
the possible areas for citizenship


query_citizenships
string * query_citizenships(string citizen)

This method checks to see where a person has citizenships. Do not use unless absolytely nessessary. In most cases you should know which area you are querying for citizenship.

Parameters:
citizen - the person to find where they are the citizen of


query_magistrates
string * query_magistrates(string area)

This method returns the current magistrates for the area.

Parameters:
area - the area to get the magistrates for

Returns:
the array of the current magistrates


query_number_of_citizens
int query_number_of_citizens(string area)

This method returns the number of citizens in the given area.

Parameters:
area - the area to lookup

Returns:
the number of citizens


query_number_of_magistrates
int query_number_of_magistrates(string area)

This method returns the number of magistrates needed for the area.

Parameters:
area - the area to check the magistrates for

Returns:
the number of allow\ed magistrates


remove_citizen
int remove_citizen(string area,
                   string citizen)

This method removes a citizen from the specified area.

Parameters:
area - the area to remove the citizen from
citizen - the citizen to remove from the area


Protected Functions

These are functions that only objects inheriting the class can access.

setup_magistrates
void setup_magistrates(string area,
                       string * magistrates)

This method sets up a new bunch of elected magistrates.

Parameters:
area - the area to setup them up in
magistrates - the new bunch to setup