Public Member Functions | |
eVoteItemServerControlled () | |
eVoteItemServerControlled (tString const &description, tString const &details) | |
~eVoteItemServerControlled () | |
void | HandleChanged (nMessage &m) |
void | SendChanged () |
Static Public Member Functions | |
static void | s_HandleChanged (nMessage &m) |
Protected Member Functions | |
virtual bool | DoFillFromMessage (nMessage &m) |
virtual void | DoFillToMessage (nMessage &m) const |
virtual void | DoExecute () |
virtual nDescriptor & | DoGetDescriptor () const |
virtual void | Evaluate () |
virtual tString | DoGetDescription () const |
virtual tString | DoGetDetails () const |
Protected Attributes | |
tString | description_ |
the description of the vote | |
tString | details_ |
details on the vote | |
Private Attributes | |
bool | expired_ |
flag set when the vote expired on the server |
Definition at line 777 of file eVoter.cpp.
eVoteItemServerControlled::eVoteItemServerControlled | ( | ) | [inline] |
Definition at line 781 of file eVoter.cpp.
00782 : description_( "No Info" ) 00783 , details_( "No Info" ) 00784 , expired_( false ) 00785 { 00786 }
eVoteItemServerControlled::eVoteItemServerControlled | ( | tString const & | description, | |
tString const & | details | |||
) | [inline] |
Definition at line 788 of file eVoter.cpp.
00789 : description_( description ) 00790 , details_( details ) 00791 , expired_( false ) 00792 {}
eVoteItemServerControlled::~eVoteItemServerControlled | ( | ) | [inline] |
Definition at line 794 of file eVoter.cpp.
References nSERVER, and sn_GetNetState().
00795 { 00796 if ( sn_GetNetState() == nSERVER ) 00797 { 00798 expired_ = true; 00799 SendChanged(); 00800 } 00801 }
static void eVoteItemServerControlled::s_HandleChanged | ( | nMessage & | m | ) | [inline, static] |
Definition at line 803 of file eVoter.cpp.
References eVoteItem::GetID(), HandleChanged(), eVoteItem::items_, GrowingArrayBase::Len(), and nMessage::Read().
Referenced by se_HandleServerVoteChanged().
00804 { 00805 unsigned short id; 00806 m.Read( id ); 00807 for ( int i = items_.Len()-1; i>=0; --i ) 00808 { 00809 eVoteItem* vote = items_[i]; 00810 if ( vote->GetID() == id ) 00811 { 00812 eVoteItemServerControlled * vote2 = dynamic_cast< eVoteItemServerControlled * >( vote ); 00813 if ( vote2 ) 00814 vote2->HandleChanged( m ); 00815 } 00816 } 00817 }
void eVoteItemServerControlled::HandleChanged | ( | nMessage & | m | ) | [inline] |
Definition at line 819 of file eVoter.cpp.
References nMessage::Read(), eVoteItem::Update(), and eVoteItem::UpdateMenuItem().
Referenced by s_HandleChanged().
00820 { 00821 unsigned short expired; 00822 m.Read( expired ); 00823 expired_ = expired; 00824 m >> description_; 00825 m >> details_; 00826 00827 Update(); 00828 UpdateMenuItem(); 00829 }
void eVoteItemServerControlled::SendChanged | ( | ) | [inline] |
Definition at line 831 of file eVoter.cpp.
References eVoteItem::GetID(), server_vote_expired_handler, and tNEW.
00832 { 00833 tJUST_CONTROLLED_PTR< nMessage > m = tNEW( nMessage )( server_vote_expired_handler ); 00834 *m << GetID(); 00835 *m << (unsigned short)expired_; 00836 *m << description_; 00837 *m << details_; 00838 m->BroadCast(); 00839 }
virtual bool eVoteItemServerControlled::DoFillFromMessage | ( | nMessage & | m | ) | [inline, protected, virtual] |
Reimplemented from eVoteItem.
Reimplemented in eVoteItemHarmServerControlled.
Definition at line 842 of file eVoter.cpp.
References eVoteItem::DoFillFromMessage().
00843 { 00844 m >> description_; 00845 m >> details_; 00846 return eVoteItem::DoFillFromMessage( m ); 00847 };
virtual void eVoteItemServerControlled::DoFillToMessage | ( | nMessage & | m | ) | const [inline, protected, virtual] |
Reimplemented from eVoteItem.
Reimplemented in eVoteItemHarmServerControlled.
Definition at line 849 of file eVoter.cpp.
References eVoteItem::DoFillToMessage().
Referenced by eVoteItemHarmServerControlled::DoFillToMessage().
00850 { 00851 m << description_; 00852 m << details_; 00853 eVoteItem::DoFillToMessage( m ); 00854 };
virtual void eVoteItemServerControlled::DoExecute | ( | ) | [inline, protected, virtual] |
Implements eVoteItem.
Reimplemented in eVoteItemSuspend, and eVoteItemKickServerControlled.
Definition at line 856 of file eVoter.cpp.
nDescriptor & eVoteItemServerControlled::DoGetDescriptor | ( | ) | const [protected, virtual] |
Implements eVoteItem.
Reimplemented in eVoteItemHarmServerControlled.
Definition at line 910 of file eVoter.cpp.
References new_server_vote_handler.
Referenced by eVoteItemHarmServerControlled::DoGetDescriptor().
00911 { 00912 return new_server_vote_handler; 00913 }
virtual void eVoteItemServerControlled::Evaluate | ( | ) | [inline, protected, virtual] |
Reimplemented from eVoteItem.
Definition at line 860 of file eVoter.cpp.
References eVoteItem::Evaluate(), nSERVER, sn_GetNetState(), and eVoteItem::Update().
00861 { 00862 // update clients (i.e. if a player to be kicked changed his name) 00863 if ( sn_GetNetState() == nSERVER ) 00864 { 00865 Update(); 00866 SendChanged(); 00867 } 00868 00869 if ( expired_ ) 00870 delete this; 00871 else 00872 eVoteItem::Evaluate(); 00873 }
virtual tString eVoteItemServerControlled::DoGetDescription | ( | ) | const [inline, protected, virtual] |
Implements eVoteItem.
Reimplemented in eVoteItemHarmServerControlled.
Definition at line 875 of file eVoter.cpp.
Referenced by eVoteItemHarmServerControlled::DoGetDescription().
00876 { 00877 return expired_ ? tString("Expired vote") : description_; 00878 }
virtual tString eVoteItemServerControlled::DoGetDetails | ( | ) | const [inline, protected, virtual] |
Reimplemented from eVoteItem.
Reimplemented in eVoteItemHarmServerControlled.
Definition at line 880 of file eVoter.cpp.
Referenced by eVoteItemHarmServerControlled::DoGetDetails().
tString eVoteItemServerControlled::description_ [mutable, protected] |
the description of the vote
Definition at line 885 of file eVoter.cpp.
Referenced by eVoteItemHarmServerControlled::Update().
tString eVoteItemServerControlled::details_ [mutable, protected] |
details on the vote
Definition at line 886 of file eVoter.cpp.
Referenced by eVoteItemHarmServerControlled::Update().
bool eVoteItemServerControlled::expired_ [private] |