Adding a new lock type

Submitted by javelin on Mon, 2012-02-13 19:51

Adding a new lock type

In lock.c, you will see something like this:

const lock_type Basic_Lock = "Basic";     /**< Name of basic lock */
const lock_type Enter_Lock = "Enter";     /**< Name of enter lock */
const lock_type Use_Lock = "Use";         /**< Name of use lock */

You will also see:

const lock_list lock_types[] = {
  {"Basic", TRUE_BOOLEXP, GOD, LF_PRIVATE, NULL},
  {"Enter", TRUE_BOOLEXP, GOD, LF_PRIVATE, NULL},
  {"Use", TRUE_BOOLEXP, GOD, LF_PRIVATE, NULL},

And in lock.h you will see:

extern const lock_type Basic_Lock;
extern const lock_type Enter_Lock;
extern const lock_type Use_Lock;

Just add your lock to these three places in the same fashion.
Of course, your lock will have no effect unless you add code to handle it.