TeamResults Class Reference

#include <results.h>

Collaboration diagram for TeamResults:

Collaboration graph
[legend]
List of all members.

Public Member Functions

const std::string & getTeamName () const
const SurfacegetTeamLogo () const
const CharactergetMostViolent () const
const CharactergetMostUsefull () const
const CharactergetMostUseless () const
const CharactergetBiggestTraitor () const

Static Public Member Functions

static TeamResultscreateTeamResults (Team *team)
static TeamResultscreateGlobalResults (std::vector< TeamResults * > *list)
static std::vector< TeamResults * > * createAllResults (void)
static void deleteAllResults (std::vector< TeamResults * > *results_list)

Protected Member Functions

 TeamResults (const std::string &name, const Surface *team_logo, const Character *MV, const Character *MUl, const Character *MUs, const Character *BT)

Private Attributes

const std::string teamName
const Surfaceteam_logo
const CharactermostViolent
const CharactermostUsefull
const CharactermostUseless
const CharacterbiggestTraitor

Detailed Description

Definition at line 33 of file results.h.


Constructor & Destructor Documentation

TeamResults::TeamResults ( const std::string &  name,
const Surface team_logo,
const Character MV,
const Character MUl,
const Character MUs,
const Character BT 
) [protected]

Definition at line 31 of file results.cpp.

00037   : teamName(name),
00038     team_logo(logo),
00039     mostViolent(MV),
00040     mostUsefull(MUl),
00041     mostUseless(MUs),
00042     biggestTraitor(BT)
00043 {
00044 }

Here is the caller graph for this function:


Member Function Documentation

std::vector< TeamResults * > * TeamResults::createAllResults ( void   )  [static]

Definition at line 151 of file results.cpp.

00152 {
00153   TeamResults* results;
00154   std::vector<TeamResults*>* results_list = new std::vector<TeamResults*>;
00155 
00156   // Build results list
00157   FOR_EACH_TEAM(team)
00158   {
00159     results = TeamResults::createTeamResults(*team);
00160 
00161     results_list->push_back(results);
00162   }
00163  
00164   // Add overall results to list
00165   results = TeamResults::createGlobalResults(results_list);
00166   results_list->push_back(results);
00167 
00168   return results_list;
00169 }

Here is the call graph for this function:

Here is the caller graph for this function:

TeamResults * TeamResults::createGlobalResults ( std::vector< TeamResults * > *  list  )  [static]

Definition at line 98 of file results.cpp.

00099 {
00100   int         most_violent    = 0;
00101   int         most_useless    = 0x0FFFFFFF;
00102   int         most_usefull    = 0;
00103   int         most_traitor    = 0;
00104   const Character* MostViolent = NULL;
00105   const Character* MostUsefull = NULL;
00106   const Character* MostUseless = NULL;
00107   const Character* BiggestTraitor = NULL;
00108 
00109   for (res_iterator result=list->begin(), last_result=list->end();
00110        result != last_result;
00111        ++result)
00112   {
00113     const Character* player;
00114     // Most damage in one shot
00115     player = (*(result))->getMostViolent();
00116     if(player == NULL) continue;
00117     if (player->GetMostDamage() > most_violent)
00118     {
00119       most_violent = player->GetMostDamage();
00120       MostViolent  = player;
00121     }
00122     // Most damage oplayerall to other teams
00123     if (player->GetOtherDamage() > most_usefull)
00124     {
00125       most_usefull = player->GetOtherDamage();
00126       MostUsefull  = player;
00127     }
00128     // Least damage oplayerall to other teams
00129     if (player->GetOtherDamage() < most_useless)
00130     {
00131       most_useless = player->GetOtherDamage();
00132       MostUseless  = player;
00133     }
00134     // Most damage oplayerall to his own team
00135     if (player->GetOwnDamage() > most_traitor)
00136     {
00137       most_traitor = player->GetOwnDamage();
00138       BiggestTraitor  = player;
00139     }
00140   }
00141 
00142   // We'll do as if NULL is for all teams
00143   return new TeamResults(_("All teams"),
00144                          NULL,
00145                          MostViolent,
00146                          MostUsefull,
00147                          MostUseless,
00148                          BiggestTraitor);
00149 }

Here is the call graph for this function:

Here is the caller graph for this function:

TeamResults * TeamResults::createTeamResults ( Team team  )  [static]

Definition at line 46 of file results.cpp.

00047 {
00048   int         most_violent    = 0;
00049   int         most_useless    = 0x0FFFFFFF;
00050   int         most_usefull    = 0;
00051   int         most_traitor    = 0;
00052   const Character* MostViolent = NULL;
00053   const Character* MostUsefull = NULL;
00054   const Character* MostUseless = NULL;
00055   const Character* BiggestTraitor = NULL;
00056 
00057   // Search best/worst performers
00058   for (Team::const_iterator player = team->begin(),
00059        last_player = team->end();
00060        player != last_player;
00061        ++player) 
00062     //FOR_EACH_CHARACTER(team, player)
00063   {
00064     // Most damage in one shot
00065     if (player->GetMostDamage() > most_violent)
00066     {
00067       most_violent = player->GetMostDamage();
00068       MostViolent  = &(*(player));
00069     }
00070     // Most damage oplayerall to other teams
00071     if (player->GetOtherDamage() > most_usefull)
00072     {
00073       most_usefull = player->GetOtherDamage();
00074       MostUsefull  = &(*(player));
00075     }
00076     // Least damage oplayerall to other teams
00077     if (player->GetOtherDamage() < most_useless)
00078     {
00079       most_useless = player->GetOtherDamage();
00080       MostUseless  = &(*(player));
00081     }
00082     // Most damage oplayerall to his own team
00083     if (player->GetOwnDamage() > most_traitor)
00084     {
00085       most_traitor = player->GetOwnDamage();
00086       BiggestTraitor  = &(*(player));
00087     }
00088   }
00089 
00090   return new TeamResults(team->GetName()+" - "+team->GetPlayerName(),
00091                          &team->flag,
00092                          MostViolent,
00093                          MostUsefull,
00094                          MostUseless,
00095                          BiggestTraitor);
00096 }

Here is the call graph for this function:

Here is the caller graph for this function:

void TeamResults::deleteAllResults ( std::vector< TeamResults * > *  results_list  )  [static]

Definition at line 171 of file results.cpp.

00172 {
00173   // Build results list
00174   for (int i=results_list->size()-1; i==0; i--)
00175     delete ((*results_list)[i]);
00176  
00177   // Add overall results to list
00178   delete results_list;
00179 }

Here is the caller graph for this function:

const Character* TeamResults::getBiggestTraitor (  )  const [inline]

Definition at line 61 of file results.h.

00061 { return biggestTraitor; };

Here is the caller graph for this function:

const Character* TeamResults::getMostUsefull (  )  const [inline]

Definition at line 59 of file results.h.

00059 { return mostUsefull; };

Here is the caller graph for this function:

const Character* TeamResults::getMostUseless (  )  const [inline]

Definition at line 60 of file results.h.

00060 { return mostUseless; };

Here is the caller graph for this function:

const Character* TeamResults::getMostViolent (  )  const [inline]

Definition at line 58 of file results.h.

00058 { return mostViolent; };

Here is the caller graph for this function:

const Surface* TeamResults::getTeamLogo (  )  const [inline]

Definition at line 57 of file results.h.

00057 {return team_logo;};

Here is the caller graph for this function:

const std::string& TeamResults::getTeamName (  )  const [inline]

Definition at line 56 of file results.h.

00056 { return teamName; };

Here is the caller graph for this function:


Member Data Documentation

const Character* TeamResults::biggestTraitor [private]

Definition at line 42 of file results.h.

const Character* TeamResults::mostUsefull [private]

Definition at line 40 of file results.h.

const Character* TeamResults::mostUseless [private]

Definition at line 41 of file results.h.

const Character* TeamResults::mostViolent [private]

Definition at line 39 of file results.h.

const Surface* TeamResults::team_logo [private]

Definition at line 38 of file results.h.

const std::string TeamResults::teamName [private]

Definition at line 37 of file results.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 14:23:36 2007 for Wormux by  doxygen 1.4.7