Counting Total Number of Players, Male Players, and Female Players
===================================================
http://ew.xidus.net

Disclaimer
==========
This should work on all Smaug derivitives, and keep in mind it doesn't do anything flashy.
Maybe this will have significance to you in some way, I just use it because its an easy
way to keep track of how many players you have in your database. This code was tested on
a heavily modified version of SWR 1.0, but is should work on everyones code anyway. I retain
no responcibility if this code does anything to your code, your game, or the system it's
running on.

This code could very easily be modified to fit any specifications you might want to meet,
seeing how it isn't complicated in any respects. Just thought you should know that.

Instructions
============

(1) mud.h

 Find:
 int          alltimemax;            /* Maximum players ever */

 Add (under):
 int          totalplayers;           /* Number of players in database */
 int          maleplayers;            /* Number of Male players in database */
 int          femaleplayers;          /* Number of Female players in database */

(2) db.c

 Find:
 fprintf( fp, "Highplayertime %s~\n", sys.time_of_max			);

 Add (directly under):
 fprintf( fp, "Totalplayers   %d\n", sys.totalplayers			);
 fprintf( fp, "Maleplayers    %d\n", sys.maleplayers			);
 fprintf( fp, "Femaleplayers  %d\n", sys.femaleplayers			);

 Find:
 void fread_sysdata( SYSTEM_DATA *sys, FILE *fp )

 Scroll down a to  case 'F':

 Find:
 KEY( "Forcepc",	  sys->level_forcepc,	          fread_number( fp ) );

 Add (directly above):
 KEY( "Femaleplayers",	  sys->femaleplayers,	          fread_number( fp ) );


 Scroll down to case 'M':

 Find:
 KEY( "Msetplayer",	  sys->level_mset_player,	  fread_number( fp ) ); 

 Add (directly above):
 KEY( "Maleplayers",	  sys->Maleplayers,	  fread_number( fp ) );


 Scroll down to case 'T':
 Find:
 KEY( "Think",	  sys->think_level,	  fread_number( fp ) );

 Add (directly below):
 KEY( "Totalplayers",	  sys->totalplayers,	  fread_number( fp ) );

(3) comm.c

 Find (should be similar to this..but yours may be different..):
 case CON_GET_NEW_SEX:
     switch ( argument[0] )
     {
     case 'm': case 'M': ch->sex = SEX_MALE;      break;
     case 'f': case 'F': ch->sex = SEX_FEMALE;    break;
     default:
	 write_to_buffer( d, "That's not a sex.\n\rWhat IS your sex? ", 0 );
	 return;
     }

 Add (under):

 if ( ch->sex == SEX_MALE )
 {
	sysdata.maleplayers++;
	sysdata.totalplayers++;
	save_sysdata( sysdata );
 }
 else
 {
	sysdata.femaleplayers++;
	sysdata.totalplayers++;
	save_sysdata( sysdata );
 }

(4) misc.c

 Find (should be at the top):
 extern int       top_exit;

 Add (under):
 void save_sysdata  args( ( SYSTEM_DATA sys ) );


 Now go down to do_suicide. The last line should look like this:
 raw_kill( ch, ch );

 Add (directly above):
 if ( ch->sex == SEX_MALE )
 {
	sysdata.maleplayers--;
	sysdata.totalplayers--;
	save_sysdata( sysdata );
 }
 else
 {
	sysdata.femaleplayers--;
	sysdata.totalplayers--;
	save_sysdata( sysdata );
 }



(5) Go into your system folder and edit your sysdata.dat file. Add Totalplayers, Male & Female
Players to it. So the beginning of the file looks like this:

#SYSTEM
Highlayers     28
Highplayertime Mon Sep  2 11:42:08 2002~
Totalplayers   1
Maleplayers    1
Femaleplayers  0

Those are just mine, your information should be differen't. This will only start
once you have added it obvoiusly, so you may need to adjust totalplayers, maleplayers, and femaleplayers so they fit your current standings. Then it will take care of itself from there. All you will need to do is check the sysdata.dat file for the current standings or make a command (should be simple) that
display's the information while on the mud.


(7) Make clean, then a Make (recompile).

Please send comments, suggestions, bugs, etc. to my e-mail.

Odis, Owner, Coder, and Head Immortal of Gundam Wing: The Awakening
http://ew.xidus.net
huhahua@yahoo.com