/* $Id: scoretable.hpp,v 1.7 2005/10/11 16:06:10 chfreund Exp $ */ #ifndef _SCORETABLE_HPP_ #define _SCORETABLE_HPP_ #include // #include "player.hpp" #include "world.hpp" #include "scorekeeper.hpp" #include "widget.h" #include "textlabel.h" using namespace SDLwidgets; class ScoreTable : public WidgetComposite { private: TextLabel* m_tableHeader[5]; std::vector m_scoreLabels; struct TeamScore { Uint8 teamID; Sint32 nFrags, nKills, nDeaths, nDamage; }; class CompareTeamByFrags { private: World* m_world; public: CompareTeamByFrags( World* world ) : m_world( world ) { } int operator()( TeamScore* const t1, TeamScore* const t2 ) const { return t1->nFrags > t2->nFrags; } }; class ComparePlayerByFrags { private: World* m_world; public: ComparePlayerByFrags( World* world ) : m_world( world ) { } int operator()( Player* const p1, Player* const p2 ) const { Scorekeeper* sk = m_world->getScorekeeper(); return sk->getFragsForPlayer( p1->getPlayerID() ) > sk->getFragsForPlayer( p2->getPlayerID() ); } }; public: ScoreTable(); void updateScores( World* world ); }; #endif // _SCORETABLE_HPP_