src/network/nNetObject.h File Reference

#include "nNetwork.h"
#include "tArray.h"
#include "tConsole.h"
#include <string.h>

Include dependency graph for nNetObject.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  nNetObject
class  nNetObject::nKnowsAboutInfo
struct  nNetObjectRegistrar
class  nNOInitialisator< T >

Typedefs

typedef unsigned short nNetObjectID

Functions

bool sn_Update (unsigned short &old, unsigned short n)
bool sn_Update (unsigned long &old, unsigned long n)
void ClearKnows (int user, bool clear=false)
void Cheater (int user)
template<class T>
nMessageoperator>> (nMessage &m, T *&p)
template<class T>
nMessageoperator>> (nMessage &m, tControlledPTR< T > &p)

Variables

tArray< tJUST_CONTROLLED_PTR
< nNetObject > > 
sn_netObjects
tArray< unsigned short > sn_netObjectsOwner


Typedef Documentation

typedef unsigned short nNetObjectID

Definition at line 47 of file nNetObject.h.


Function Documentation

void Cheater ( int  user  ) 

Definition at line 530 of file nNetObject.cpp.

References con, sn_Connections, and sn_DisconnectUser().

Referenced by nAuthentication::HandlePasswordRequest(), nNOInitialisator< T >::Init(), net_control_handler(), net_sync_handler(), new_destination_handler(), nNetObject::Object(), nNetObject::Register(), req_id_handler(), and sn_DoDestroy().

00531 {
00532     // anything to do at all?
00533     if (i != 0 && !sn_Connections[i].socket)
00534     {
00535         return;
00536     }
00537 
00538     con << "User " << i << " tried to cheat.\n";
00539     //  st_Breakpoint();
00540 
00541     if ( i == 0 )
00542         // terminate connection to server
00543         throw tGenericException("There was a network error, the connection to the server had to be terminated.", "Network Error");
00544     else
00545         sn_DisconnectUser(i, "$network_kill_cheater" );
00546 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ClearKnows ( int  user,
bool  clear = false 
)

Definition at line 1795 of file nNetObject.cpp.

References nNetObject::ClearKnows(), GrowingArrayBase::Len(), and sn_netObjectsOwner.

01795                                      {
01796     nNetObject::ClearKnows(user, clear);
01797 
01798     if (clear)
01799         for (int i=sn_netObjectsOwner.Len()-1;i>=0;i--){
01800             if (sn_netObjectsOwner(i)==user)
01801                 sn_netObjectsOwner(i)=0;
01802         }
01803 }

Here is the call graph for this function:

template<class T>
nMessage& operator>> ( nMessage m,
tControlledPTR< T > &  p 
) [inline]

Definition at line 425 of file nNetObject.h.

References NULL, nNetObject::ObjectDangerous(), and nMessage::Read().

00426 {
00427     unsigned short id;
00428     m.Read(id);
00429 
00430     if ( 0 != id )
00431         p = dynamic_cast<T*> ( nNetObject::ObjectDangerous(id) );
00432     else
00433         p = NULL;
00434 
00435     return m;
00436 }

Here is the call graph for this function:

template<class T>
nMessage& operator>> ( nMessage m,
T *&  p 
) [inline]

Definition at line 412 of file nNetObject.h.

References NULL, nNetObject::ObjectDangerous(), and nMessage::Read().

00413 {
00414     unsigned short id;
00415     m.Read(id);
00416 
00417     if ( 0 != id )
00418         p = dynamic_cast<T*> ( nNetObject::ObjectDangerous(id) );
00419     else
00420         p = NULL;
00421 
00422     return m;
00423 }

Here is the call graph for this function:

bool sn_Update ( unsigned long &  old,
unsigned long  n 
)

Definition at line 674 of file nNetObject.cpp.

00674                                                   {
00675     if ( 0 == old )
00676     {
00677         old = n;
00678         return true;
00679     }
00680 
00681     long diff=old-n;
00682     if (diff<0){
00683         old=n;
00684         return true;
00685     }
00686     else
00687         return false;
00688 }

bool sn_Update ( unsigned short &  old,
unsigned short  n 
)

Definition at line 657 of file nNetObject.cpp.

Referenced by gCycle::ReadSync(), nConfItemBase::s_GetConfigMessage(), and nNetObject::SyncIsNew().

00657                                                     {
00658     if ( 0 == old )
00659     {
00660         old = n;
00661         return true;
00662     }
00663 
00664     short diff=old-n;
00665     if (diff<0){
00666         old=n;
00667         return true;
00668     }
00669     else
00670         return false;
00671 }

Here is the caller graph for this function:


Variable Documentation

tArray<tJUST_CONTROLLED_PTR<nNetObject> > sn_netObjects

Referenced by nWaitForAckSync::AckExtraAction(), nNetObject::ClearAll(), nNetObject::ClearKnows(), free_server(), nNetObject::GetID(), nNetObject::GetRefcount(), zValidator::isOwner(), zValidator::isTeamOwner(), zShape::joinWithZone(), kill_id_hog(), net_control_handler(), net_destroy_handler(), next_free(), nWaitForAckSync::nWaitForAckSync(), nNetObject::Object(), nNetObject::ObjectDangerous(), zZone::ReadSync(), nNetObject::Register(), nNetObject::RelabelOnConnect(), nNetObject::Release(), req_id_handler(), zSelectorSingleDeadOwner::select(), zSelectorOwnerTeamTeammate::select(), zSelectorOwnerTeam::select(), zSelectorOwner::select(), sn_DoDestroy(), gGame::StateUpdate(), nNetObject::SyncAll(), and nNetObject::~nNetObject().

tArray<unsigned short> sn_netObjectsOwner

Definition at line 113 of file nNetObject.cpp.

Referenced by clear_owners(), nNetObject::ClearAll(), ClearKnows(), nNetObject::ClearKnows(), kill_id_hog(), and sn_DoDestroy().


Generated on Sat Mar 15 23:01:03 2008 for Armagetron Advanced by  doxygen 1.5.4