gMenuItemPlayer Class Reference

Inheritance diagram for gMenuItemPlayer:

Inheritance graph
[legend]
Collaboration diagram for gMenuItemPlayer:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 gMenuItemPlayer (uMenu *M, ePlayerNetID *p, const tOutput &help)
virtual void Render (REAL x, REAL y, REAL alpha=1, bool selected=0)
virtual void Enter ()

Private Attributes

ePlayerNetIDplayer


Detailed Description

Definition at line 209 of file gTeam.cpp.


Constructor & Destructor Documentation

gMenuItemPlayer::gMenuItemPlayer ( uMenu M,
ePlayerNetID p,
const tOutput help 
) [inline]

Definition at line 213 of file gTeam.cpp.

00215             : uMenuItem( M, help ),
00216             player ( p )
00217     {
00218     }


Member Function Documentation

virtual void gMenuItemPlayer::Render ( REAL  x,
REAL  y,
REAL  alpha = 1,
bool  selected = 0 
) [inline, virtual]

Reimplemented from uMenuItem.

Definition at line 220 of file gTeam.cpp.

References uMenuItem::DisplayTextSpecial(), ePlayerNetID::GetName(), and player.

00221     {
00222         DisplayTextSpecial( x, y, player->GetName(), selected, alpha );
00223     }

Here is the call graph for this function:

virtual void gMenuItemPlayer::Enter (  )  [inline, virtual]

Reimplemented from uMenuItem.

Definition at line 225 of file gTeam.cpp.

References con, ePlayerNetID::CurrentTeam(), uMenu::Enter(), ePlayerNetID::GetName(), GrowingArrayBase::Len(), MAX_PLAYERS, ePlayer::name, ePlayerNetID::NextTeam(), NULL, eTeam::NumHumanPlayers(), player, ePlayer::PlayerConfig(), ePlayer::PlayerIsInGame(), eTeam::PlayerMayJoin(), tOutput::SetTemplateParameter(), ePlayer::spectate, eTeam::teams, tNEW, and ePlayerNetID::Update().

00226     {
00227         tOutput title;
00228         title.SetTemplateParameter( 1, player->GetName() );
00229         title << "$team_menu_player_title";
00230         uMenu playerMenu( title );
00231         tArray<uMenuItem*> items;
00232 
00233         // quit from spectator mode, the player would be trown out of the team again otherwise
00234         int i;
00235         for ( i = MAX_PLAYERS; i>=0; --i )
00236         {
00237             if ( ePlayer::PlayerIsInGame(i))
00238             {
00239                 ePlayer* localPlayer = ePlayer::PlayerConfig( i );
00240                 ePlayerNetID* pni = localPlayer->netPlayer;
00241                 if ( pni == this->player && localPlayer->spectate )
00242                 {
00243                     localPlayer->spectate = false;
00244                     con << tOutput("$player_toggle_spectator_off", localPlayer->name );
00245                     ePlayerNetID::Update();
00246                 }
00247             }
00248         }
00249 
00250         if ( player->NextTeam()!=NULL)
00251         {
00252             items[items.Len()] = tNEW(gMenuItemSpectate) (&playerMenu, player);
00253         }
00254 
00255         // first pass add teams who probably can't be joined
00256         for ( i = 0; i<eTeam::teams.Len(); i++ )
00257         {
00258             eTeam *team = eTeam::teams(i);
00259             if ( team && team != player->NextTeam() && !team->PlayerMayJoin( player ) )
00260             {
00261                 items[ items.Len() ] = tNEW( gMenuItemPlayerTeam ) ( &playerMenu, player, team );
00262             }
00263         }
00264         // second pass add teams who probably can be joined
00265         // Note: these will appear above the unjoinable ones.
00266         for ( i = 0; i<eTeam::teams.Len(); i++ )
00267         {
00268             eTeam *team = eTeam::teams(i);
00269             if ( team && team != player->NextTeam() && team->PlayerMayJoin( player ))
00270                 items[ items.Len() ] = tNEW( gMenuItemPlayerTeam ) ( &playerMenu, player, team );
00271         }
00272 
00273         items[items.Len()] = tNEW(gMenuItemAutoSelect) (&playerMenu, player);
00274 
00275         if ( /* eTeam::NewTeamAllowed() && */
00276             !( player->NextTeam() && player->NextTeam()->NumHumanPlayers() == 1 &&
00277                player->CurrentTeam() && player->CurrentTeam()->NumHumanPlayers() == 1 )
00278         )
00279         {
00280             items[ items.Len() ] = tNEW( gMenuItemNewTeam ) ( &playerMenu, player );
00281 
00282         }
00283 
00284         items[items.Len()] = tNEW ( gMenuItemSpacer ) ( &playerMenu );
00285         items[items.Len()] = tNEW ( gMenuItemStatus ) ( &playerMenu, player, false);
00286         items[items.Len()] = tNEW ( gMenuItemStatus ) ( &playerMenu, player, true);
00287 
00288         playerMenu.Enter();
00289 
00290         for ( i = items.Len()-1; i>=0; --i )
00291         {
00292             delete items(i);
00293         }
00294     }

Here is the call graph for this function:


Member Data Documentation

ePlayerNetID* gMenuItemPlayer::player [private]

Definition at line 211 of file gTeam.cpp.

Referenced by Enter(), and Render().


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