ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/RenegadeMapSelector/RenegadeConfig.cpp
(Generate patch)

Comparing trunk/RenegadeMapSelector/RenegadeConfig.cpp (file contents):
Revision 88 by douglas, 2003-03-11T17:16:41-08:00 vs.
Revision 89 by douglas, 2003-03-15T22:00:25-08:00

# Line 16 | Line 16 | bool RenegadeConfig::load()
16          {
17                  string line;
18                  getline(fin, line);
19 +
20 +                if (line[line.length() - 1] == '\r')
21 +                {
22 +                        line.erase(line.length() - 1);
23 +                        linux = true;
24 +                }
25                  
26                  if (line.find("MapName=") == 0)
27                  {
# Line 41 | Line 47 | bool RenegadeConfig::load()
47  
48          if (debug)
49          {
50 <                cerr << "maps = {\n";
50 >                cerr << "linux = " << (linux ? "true" : "false") << "\nmaps = {\n";
51  
52                  for (unsigned index = 0; index < maps.size(); index++)
53                  {
# Line 77 | Line 83 | void RenegadeConfig::save()
83  
84                  if (line == "MapName=")
85                  {
86 <                        fout << "MapName=" << maps[0] << (text.good() ? "\n" : "");
86 >                        fout << "MapName=" << maps[0] << (text.good() ? (linux ? "\r\n" :
87 >                                "\n") : "");
88                  }
89                  else if (line == "MapName00=")
90                  {
# Line 87 | Line 94 | void RenegadeConfig::save()
94                                  sprintf(number, "%02u", index);
95  
96                                  fout << "MapName" << number << "=" << maps[index] << (index + 1
97 <                                        < maps.size() || text.good() ? "\n" : "");
97 >                                        < maps.size() || text.good() ? (linux ? "\r\n" : "\n") : ""
98 >                                        );
99  
100                                  delete [] number;
101                          }
102                  }
103                  else
104                  {
105 <                        fout << line << (text.good() ? "\n" : "");
105 >                        fout << line << (text.good() ? (linux ? "\r\n" : "\n") : "");
106                  }
107          }
108          while (text.good());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines