src/tron/gTeam.cpp File Reference

#include "gTeam.h"
#include "uMenu.h"
#include "ePlayer.h"
#include "eTeam.h"

Include dependency graph for gTeam.cpp:

Go to the source code of this file.

Classes

class  gMenuItemPlayerTeam
class  gMenuItemNewTeam
class  gMenuItemSpectate
class  gMenuItemAutoSelect
class  gMenuItemSpacer
class  gMenuItemStatus
class  gMenuItemPlayer

Functions

static tOutputPrepareTeamText (tOutput *text, eTeam *team, const ePlayerNetID *player, const char *textTemplate)

Variables

static tString se_TeamMenu_Team_Ok ("0xffffff")
static tString se_TeamMenu_Team_Full ("0xaaaaaa")
static tConfItem< tStringse_TeamMenu_Team_Ok_Cfg ("TEAM_MENU_COLOR_TEAM_OK","$team_menu_color_team_ok_help", se_TeamMenu_Team_Ok)
static tConfItem< tStringse_TeamMenu_Team_Full_Cfg ("TEAM_MENU_COLOR_TEAM_FULL","$team_menu_color_team_full_help", se_TeamMenu_Team_Full)


Function Documentation

static tOutput* PrepareTeamText ( tOutput text,
eTeam team,
const ePlayerNetID player,
const char *  textTemplate 
) [static]

Definition at line 42 of file gTeam.cpp.

References ePlayerNetID::CurrentTeam(), GrowingArrayBase::Len(), eTeam::Name(), NULL, eTeam::NumPlayers(), eTeam::PlayerMayJoin(), se_PlayerNetIDs, se_TeamMenu_Team_Full, se_TeamMenu_Team_Ok, and tOutput::SetTemplateParameter().

Referenced by gMenuItemStatus::Render(), and gMenuItemPlayerTeam::Render().

00043 {
00044     // Required for Spectators in display status item
00045     if (team==NULL)
00046     {
00047         text->SetTemplateParameter(1 , tOutput("$team_empty") );
00048         //TODO Easier detection of/cached number of spectators
00049         int spectators = 0;
00050         for (int i = se_PlayerNetIDs.Len()-1; i>=0; i--)
00051         {
00052             ePlayerNetID *p = se_PlayerNetIDs(i);
00053             if (p->CurrentTeam()==NULL)
00054                 spectators++;
00055         }
00056         text->SetTemplateParameter(2 , spectators);
00057         text->SetTemplateParameter(3, "");
00058         *text << textTemplate;
00059         return text;
00060     }
00061 
00062     // Handling the $team_join template ;)
00063     text->SetTemplateParameter(1 , team->Name() );
00064     text->SetTemplateParameter(2 , team->NumPlayers() );
00065     if (team->PlayerMayJoin(player))
00066         text->SetTemplateParameter(3, se_TeamMenu_Team_Ok);
00067     else
00068         text->SetTemplateParameter(3, se_TeamMenu_Team_Full);
00069     *text << textTemplate << "0xffffff";
00070     return text;
00071 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

tString se_TeamMenu_Team_Full("0xaaaaaa") [static]

Referenced by PrepareTeamText().

tConfItem<tString> se_TeamMenu_Team_Full_Cfg("TEAM_MENU_COLOR_TEAM_FULL","$team_menu_color_team_full_help", se_TeamMenu_Team_Full) [static]

tString se_TeamMenu_Team_Ok("0xffffff") [static]

Referenced by PrepareTeamText(), gMenuItemAutoSelect::Render(), gMenuItemSpectate::Render(), and gMenuItemNewTeam::Render().

tConfItem<tString> se_TeamMenu_Team_Ok_Cfg("TEAM_MENU_COLOR_TEAM_OK","$team_menu_color_team_ok_help", se_TeamMenu_Team_Ok) [static]


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