WindowMud

Dnode.cpp Source Code

Download this source code in text format (Dnode.cpp)

/***********************************************************
* WindowMud - Window Mud Server                            *
* File:   Dnode.cpp                                        *
* Usage:  Maintains a linked list of connection data       *
*                                                          *
* No warranty is given or implied.                         *
* There is no license associated with this code.           *
* There are no restrictions on the use of this code.       *
* This code may be used in any way the reader wishes.      *
* No credit or credits are given and none are required.    *
* The reader may take this code and claim they wrote it.   *
************************************************************/

/***********************************************************
* Includes                                                 *
************************************************************/

#include "stdafx.h"         // precompiled headers
#include "Dnode.h"

/***********************************************************
* Globals                                                  *
************************************************************/

int Dnode::Count = 0;

/***********************************************************
 * Dnode constructor                                       *
 ***********************************************************/

Dnode::Dnode(int SocketHandle, CString IpAddress)
{
  Count++;
  DnodeFd                             = SocketHandle;
  InputTick                           = 0;
  pPlayer                             = NULL;
  PlayerInp                           = "";
  PlayerIpAddress                     = IpAddress;
  PlayerName                          = "Player name unknown";
  PlayerNewCharacter                  = "";
  PlayerOut                           = "";
  PlayerPassword                      = "";
  PlayerWrongPasswordCount            = 0;

  PlayerStateBye                      = false;
  PlayerStateLoggingOn                = false;
  PlayerStatePlaying                  = false;
  PlayerStateSendBanner               = true;
  PlayerStateWaitMaleFemale           = false;
  PlayerStateWaitName                 = false;
  PlayerStateWaitNameConfirmation     = false;
  PlayerStateWaitNewCharacter         = false;
  PlayerStateWaitPassword             = false;
}

/***********************************************************
 * Dnode destructor                                        *
 ***********************************************************/

Dnode::~Dnode()
{
  Count--;
  pDnodePrev->pDnodeNext = pDnodeNext;
  pDnodeNext->pDnodePrev = pDnodePrev;
}

////////////////////////////////////////////////////////////
// Private functions static                               //
////////////////////////////////////////////////////////////

/***********************************************************
* Return Dnode count                                       *
************************************************************/

int Dnode::GetCount()
{
  return Count;
}