WindowMud

Dnode.cpp Source Code

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

/***********************************************************
* WindowMud - Window Mud Server                            *
* File:   Dnode.cpp                                        *
* Usage:  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;
  PlayerInp                           = "";
  PlayerIpAddress                     = IpAddress;
  PlayerOut                           = "";

  PlayerStateBye                      = false;
  PlayerStateSendBanner               = true;
}

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

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

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

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

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