~ubuntu-branches/ubuntu/wily/xmoto/wily-proposed

« back to all changes in this revision

Viewing changes to src/ReplayList.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2006-09-14 21:01:20 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060914210120-bvr7yu9rafb3fivp
Tags: 0.2.1-1
* New upstream release.
* Removed manpages and desktop files from the Debian package as they are now
  provided upstream.
* Make the package binNMUable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    std::vector<std::string> ReplayFiles;
33
33
    ReplayFiles = FS::findPhysFiles("Replays/*.rpl");
34
34
 
35
 
    for(int i=0; i<ReplayFiles.size(); i++) {
 
35
    for(unsigned int i=0; i<ReplayFiles.size(); i++) {
36
36
      addReplay(FS::getFileBaseName(ReplayFiles[i]));
37
37
    }
38
38
  }
41
41
    ReplayInfo* rplInfos;
42
42
 
43
43
    if(FS::getFileBaseName(Replay) != "Latest") {    
 
44
      /* Already got this replay? */
 
45
      for(unsigned int i=0;i<m_Replays.size();i++) {
 
46
        if(m_Replays[i]->Name == Replay) {
 
47
          /* Yeah */
 
48
          return;
 
49
        }
 
50
      }
 
51
    
44
52
      rplInfos = Replay::getReplayInfos(Replay);
45
53
      if(rplInfos != NULL) {
46
 
        m_Replays.push_back(rplInfos);
 
54
              m_Replays.push_back(rplInfos);
47
55
      }
 
56
      
48
57
    }
49
58
  }
50
59
 
51
60
  void ReplayList::delReplay(const std::string &Replay) {
52
 
    for(int i=0;i<m_Replays.size();i++) {
 
61
    for(unsigned int i=0;i<m_Replays.size();i++) {
53
62
      if(m_Replays[i]->Name == Replay) {
54
63
        delete m_Replays[i];
55
64
        m_Replays.erase( m_Replays.begin() + i );
62
71
  Clean up stuff
63
72
  ===========================================================================*/
64
73
  void ReplayList::clear(void) {
65
 
    for(int i=0;i<m_Replays.size();i++) {
 
74
    for(unsigned int i=0;i<m_Replays.size();i++) {
66
75
      delete m_Replays[i];
67
76
    }
68
77
    m_Replays.clear();     
76
85
    Ret = new std::vector<ReplayInfo *>;
77
86
 
78
87
    /* find replays */
79
 
    for(int i=0;i<m_Replays.size();i++) {
80
 
      if((PlayerName=="" || PlayerName==m_Replays[i]->Player) &&
81
 
         (LevelID=="" || LevelID==m_Replays[i]->Level)) {
 
88
    for(unsigned int i=0;i<m_Replays.size();i++) {
 
89
      if((PlayerName == "" || PlayerName==m_Replays[i]->Player) &&
 
90
         (LevelID == "" || LevelID==m_Replays[i]->Level)) {
82
91
        /* Got one */
83
92
        Ret->push_back(m_Replays[i]);
84
93
      }
88
97
    return Ret;
89
98
  }
90
99
 
91
 
};
 
100
}
92
101