Back to index

extremetuxracer  0.5beta
Public Member Functions | Public Attributes | Private Attributes
PlayerCupData Class Reference

#include <player.h>

Collaboration diagram for PlayerCupData:
Collaboration graph

List of all members.

Public Member Functions

 PlayerCupData ()
bool getCupCourseData (std::string course, PlayerCourseData &data)
bool updateCupCourseData (std::string course, double time, int herring, int score, bool won)
void saveData (std::ofstream &sfile)
void loadData (std::ifstream &sfile)

Public Attributes

bool won
bool loaded

Private Attributes

std::map< std::string,

Detailed Description

Definition at line 48 of file player.h.

Constructor & Destructor Documentation

Definition at line 132 of file player.cpp.

 : won(false), loaded(false)

Member Function Documentation

bool PlayerCupData::getCupCourseData ( std::string  course,
PlayerCourseData data 

Definition at line 138 of file player.cpp.

       std::map<std::string,PlayerCourseData>::iterator it;
       if( (it=courses.find(course))!=courses.end() ){
              data = (*it).second;
              return true;
       return false; 
void PlayerCupData::loadData ( std::ifstream &  sfile)

Definition at line 177 of file player.cpp.

       char buff[256];
       int numcourses;
       sfile >> won;
       sfile >> numcourses;
       for(int i=0; i<numcourses; i++){   
              PlayerCourseData& course=courses[buff];
              sfile >> course.won;
              sfile >> course.time;
              sfile >> course.herring;
              sfile >> course.score;             
       loaded = true;
void PlayerCupData::saveData ( std::ofstream &  sfile)

Definition at line 160 of file player.cpp.

              sfile << won << std::endl;
              sfile << courses.size() << std::endl;
                     std::map<std::string,PlayerCourseData>::iterator it;
                     for(it=courses.begin(); it!=courses.end(); it++){
                            sfile << (*it).first << std::endl;
                            sfile << (*it).second.won << std::endl;
                            sfile << (*it).second.time << std::endl;
                            sfile << (*it).second.herring << std::endl;
                            sfile << (*it).second.score << std::endl;
bool PlayerCupData::updateCupCourseData ( std::string  course,
double  time,
int  herring,
int  score,
bool  won 

Definition at line 150 of file player.cpp.

       return courses[course].update(time,herring,score,won);

Member Data Documentation

std::map<std::string,PlayerCourseData> PlayerCupData::courses [private]

Definition at line 50 of file player.h.

Definition at line 64 of file player.h.

Definition at line 54 of file player.h.

The documentation for this class was generated from the following files: