5 |
* modify it under the terms of the GNU General Public License |
* modify it under the terms of the GNU General Public License |
6 |
* as published by the Free Software Foundation; either version 2 |
* as published by the Free Software Foundation; either version 2 |
7 |
* of the License, or (at your option) any later version. |
* of the License, or (at your option) any later version. |
8 |
* |
* |
9 |
* This program is distributed in the hope that it will be useful, |
* This program is distributed in the hope that it will be useful, |
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
* GNU General Public License for more details. |
* GNU General Public License for more details. |
13 |
* |
* |
14 |
* You should have received a copy of the GNU General Public License along |
* You should have received a copy of the GNU General Public License along |
15 |
* with this program; if not, write to the Free Software Foundation, Inc., |
* with this program; if not, write to the Free Software Foundation, Inc., |
16 |
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
23 |
namespace options |
namespace options |
24 |
{ |
{ |
25 |
using std::string; |
using std::string; |
26 |
|
|
27 |
class OptionObserver { |
class OptionObserver { |
28 |
public: |
public: |
29 |
virtual ~OptionObserver() {} |
virtual ~OptionObserver() {} |
46 |
extern string LevelMusicFile; |
extern string LevelMusicFile; |
47 |
extern bool SkipSolvedLevels; |
extern bool SkipSolvedLevels; |
48 |
|
|
49 |
|
extern bool LevelStatusChanged; // true if any LevelStatus differs from last saved state |
50 |
|
|
51 |
struct LevelStatus { |
struct LevelStatus { |
52 |
LevelStatus(int easy=-1, int hard=-1, int fin=0) |
LevelStatus(int easy=-1, int hard=-1, int fin=0) |
53 |
: par_easy(easy), |
: par_easy(easy), |
56 |
{} |
{} |
57 |
int par_easy, par_hard; // Best time in seconds (-1: use level default) |
int par_easy, par_hard; // Best time in seconds (-1: use level default) |
58 |
int finished; // User completed this level? |
int finished; // User completed this level? |
59 |
// 0=no,1=easy,2=hard,3=easy&hard |
// 0 = no,1=easy,2=hard,3=easy&hard |
60 |
|
|
61 |
|
bool operator != (const LevelStatus& other) const { |
62 |
|
return |
63 |
|
par_easy != other.par_easy || |
64 |
|
par_hard != other.par_hard || |
65 |
|
finished != other.finished; |
66 |
|
} |
67 |
}; |
}; |
68 |
|
|
69 |
/* Get the status of a particular level in a particular pack. |
/* Get the status of a particular level in a particular pack. |
79 |
|
|
80 |
void SetLevelTime(const string &pack, const string &level, int difficulty, int time); |
void SetLevelTime(const string &pack, const string &level, int difficulty, int time); |
81 |
void SetLevelFinished(const string &pack, const string &level, int difficulty); |
void SetLevelFinished(const string &pack, const string &level, int difficulty); |
82 |
|
|
83 |
/* Save the current set of options to the user's configuration |
/* Save the current set of options to the user's configuration |
84 |
file. (Either ~/.enigmarc on Unix systems or ./enigmarc.lua on |
file. (Either ~/.enigmarc on Unix systems or ./enigmarc.lua on |
85 |
Win32. */ |
Win32. */ |