mud++0.35/etc/
mud++0.35/etc/guilds/
mud++0.35/help/propert/
mud++0.35/mudC/
mud++0.35/player/
mud++0.35/src/interface/
mud++0.35/src/os/cygwin32/
mud++0.35/src/os/win32/
mud++0.35/src/os/win32/bcppbuilder/
mud++0.35/src/osaddon/
mud++0.35/src/util/
This is short help about how to use Property class.

Idea behind it is to allow changing of some global values at run-time
or reboot time, without need for recompiling. Property class gives interface
which simplify this - it takes care of saving/loading it, parsing parameters
and provides set/display commands for immortals.

Of course there are limitations. There are 3 basic types of properties -
boolean, integer and string. There is a possibilty of putting complicated
data into string property, but you have to watch for parsing time.
It is best for simple data.

Every Property consist of name, type, value, notify fun and runtime flag.
Name, type and value are straighforward. Runtime flag is use only for 
verbosisty - if it is set true it means that all changes to given property
will be resolved in realtime. If it is false, it means that we have to wait
until reboot for change to take effect.

Notify fun is optional. If it is given, it will be notified of all changes
to given property. This allows instant response to some of them.

All properties are saved in one file - etc/mudpp.pro
There are commands probackup and prorestore for creating and restoring backups 
of property files from mud. All backup files have .pro extension, so all files
in mud etc directory with that can be possibly overwritten by backup.
There are also commands proload and prosave to load and save default property
file. Normal behaviour is for prorestore to only replace mudpp.pro file - so
to load it you have to also give proload command.

Format of properties file.
Number of entries consisting of

L type name value

Where L is '#' for end of properties (and there are no next fields), 'R' 
indicates property change of which will take place after reboot (info only
flag - no real power), 'T' is to indicate flag that will reflect changes at 
runtime. 
Type is int,bool or string and indicates format of value.
Name is one word identifier for given property.
Value is value of the property - for boolean properties word 'true' or 'false',
for integer - a number, for string type, string delimted with ~
Examples:
T int	max_player   	100
R int	gcsize_force	2000
R bool	wizlock       	false
R string reboot_wait_info Mud is rebooting - wait a minute.~


How to use it in code ?
In every place you use property, you need to enter following code

static Property * prop = 0;
UseProperty( &prop, "prop_name", PROP_TYPE, "default value" 
				/*,optional arguments*/);

So to use max_players you need to 

static Property * max_player_p =0;
UseProperty( &max_player_p, "max_player", PROP_INT, "100" );
// now you can access this by prop->getInt()
You CANNOT cache this value in any place for more than length of function -
unless you sepcify property as reboot time (as opposed to run-time).

Cost of UseProperty is very small - it is inlined function and after first use
it equals to
if ( !max_player_p )
{
	// not reached
}
If any compiler will not reduce it in this way, we can always move to macro
without problem.

If you want to specify notify fun or reboot time property you need to specify
two more arguments (imagine that setting max_player acctually kicks out
players over limit logged at the time of change).

const char * max_player_notify( Property * pro )
{
	if ( pro->getInt() < 1 )
		return "Number of allowed player has to be greater than zero";

	if ( number_of_logged_player > pro->getInt() )
	{
		// kick out
	}
	return 0;
}

UseProperty( &max_player_p, "max_player", PROP_INT, "100", max_player_notify,
			true);

Why there is const char * return not void ? To allow notify fun to reject
impossible values. If it returns non-NULL it means that value is not accepted.
Caller have to assure that previous valid value is set. Of course if default
value is unacceptable and there is no replacement specifed in property file
mud reports it and stops.
There are few basic notify funs, such as nf_g_zero, nf_ge_zero etc.