eVoteItemKick Class Reference

Inheritance diagram for eVoteItemKick:

Inheritance graph
[legend]
Collaboration diagram for eVoteItemKick:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 eVoteItemKick (ePlayerNetID *player)
 ~eVoteItemKick ()

Protected Member Functions

virtual char const * DoGetPrefix () const
virtual int DoGetExtraBias () const
virtual bool DoCheckValid (int senderID)
virtual void DoExecute ()


Detailed Description

Definition at line 1150 of file eVoter.cpp.


Constructor & Destructor Documentation

eVoteItemKick::eVoteItemKick ( ePlayerNetID player  )  [inline]

Definition at line 1154 of file eVoter.cpp.

01155         : eVoteItemHarm( player )
01156     {}

eVoteItemKick::~eVoteItemKick (  )  [inline]

Definition at line 1158 of file eVoter.cpp.

01159     {}


Member Function Documentation

virtual char const* eVoteItemKick::DoGetPrefix (  )  const [inline, protected, virtual]

Implements eVoteItemHarm.

Definition at line 1163 of file eVoter.cpp.

01163 { return "kick"; }

virtual int eVoteItemKick::DoGetExtraBias (  )  const [inline, protected, virtual]

Reimplemented from eVoteItem.

Definition at line 1174 of file eVoter.cpp.

References se_votingBiasKick.

01175     {
01176         return se_votingBiasKick;
01177     }

virtual bool eVoteItemKick::DoCheckValid ( int  senderID  )  [inline, protected, virtual]

Reimplemented from eVoteItemHarm.

Reimplemented in eVoteItemKickServerControlled.

Definition at line 1179 of file eVoter.cpp.

References eVoteItemHarm::DoCheckValid(), eVoter::GetVoter(), eVoter::lastKickVote_, eVoter::lastNameChangePreventor_, nCLIENT, nNetObject::Owner(), se_minTimeBetweenKicks, sn_ConsoleOut(), sn_GetNetState(), and tSysTimeFloat().

01180     {
01181         ePlayerNetID * player = GetPlayer();
01182 
01183         // check if player is protected from kicking
01184         if ( player && sn_GetNetState() != nCLIENT )
01185         {
01186             eVoter * voter = eVoter::GetVoter( player->Owner() );
01187             if ( voter )
01188             {
01189                 double time = tSysTimeFloat();
01190                 if ( time < voter->lastKickVote_ + se_minTimeBetweenKicks )
01191                 {
01192                     tOutput message("$vote_redundant");
01193                     sn_ConsoleOut( message, senderID );
01194                     return false;
01195                 }
01196                 else
01197                 {
01198                     voter->lastKickVote_ = time;
01199                     voter->lastNameChangePreventor_ = time;
01200                 }
01201             }
01202         }
01203 
01204         return eVoteItemHarm::DoCheckValid( senderID );
01205     };

Here is the call graph for this function:

virtual void eVoteItemKick::DoExecute (  )  [inline, protected, virtual]

Implements eVoteItem.

Reimplemented in eVoteItemKickServerControlled.

Definition at line 1207 of file eVoter.cpp.

References nMachine::GetMachine(), MAXCLIENTS, nMachine::OnKick(), se_VoteKickPlayer(), and se_VoteKickUser().

Referenced by eVoteItemKickServerControlled::DoExecute().

01208     {
01209         ePlayerNetID * player = GetPlayer();
01210         nMachine * machine = GetMachine();
01211         if ( player )
01212         {
01213             // kick the player, he is online
01214             se_VoteKickPlayer( player );
01215         }
01216         else if ( machine )
01217         {
01218             // the player left. Inform the machine that he would have gotten kicked.
01219             // kick all players that connected from that machine
01220             bool kick = false;
01221             for ( int user = MAXCLIENTS; user > 0; --user )
01222             {
01223                 if ( &nMachine::GetMachine( user ) == machine )
01224                 {
01225                     se_VoteKickUser( user );
01226                     kick = true;
01227                 }
01228             }
01229             
01230             // if no user could be kicked, notify at least the machine that
01231             // somebody would have been kicked.
01232             if ( !kick )
01233             {
01234                 machine->OnKick();
01235             }
01236         }
01237     }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:31:16 2008 for Armagetron Advanced by  doxygen 1.5.4