[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Enigma-cvs] enigma/src options.cc,1.27,1.28
From: |
Ralf Westram <address@hidden> |
Subject: |
[Enigma-cvs] enigma/src options.cc,1.27,1.28 |
Date: |
Mon, 03 Nov 2003 14:21:38 +0000 |
Update of /cvsroot/enigma/enigma/src
In directory subversions:/tmp/cvs-serv27234
Modified Files:
options.cc
Log Message:
- merged SetLevelFinished + SetLevelTime. If revision changes
old time records get deleted.
Index: options.cc
===================================================================
RCS file: /cvsroot/enigma/enigma/src/options.cc,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** options.cc 27 Oct 2003 11:53:17 -0000 1.27
--- options.cc 3 Nov 2003 14:21:35 -0000 1.28
***************
*** 20,24 ****
#include "enigma.hh"
#ifdef __MINGW32__
! #include <windows.h>
#endif
#include "lua.hh"
--- 20,24 ----
#include "enigma.hh"
#ifdef __MINGW32__
! # include <windows.h>
#endif
#include "lua.hh"
***************
*** 139,172 ****
options::SetLevelTime(const string &pack, const string &level, int
difficulty, int revision, int time)
{
- SetLevelFinished(pack, level, difficulty, revision);
LevelStatus *stat = GetLevelStatus(pack, level);
! assert(stat);
!
! bool new_record = false;
!
! if (difficulty == enigma::DIFFICULTY_EASY) {
! if (stat->time_easy > time || stat->time_easy == -1) {
! stat->time_easy = time;
! LevelStatusChanged = true;
! new_record = true;
! }
! }
! else if (difficulty == enigma::DIFFICULTY_HARD) {
! if (stat->time_hard > time || stat->time_hard == -1) {
! stat->time_hard = time;
! LevelStatusChanged = true;
! new_record = true;
}
- }
- return new_record;
- }
- void
- options::SetLevelFinished(const string &pack, const string &level, int
difficulty, int revision)
- {
- assert(difficulty==enigma::DIFFICULTY_EASY ||
difficulty==enigma::DIFFICULTY_HARD);
-
- if (LevelStatus *stat = GetLevelStatus(pack, level)) {
stat->finished |= difficulty;
stat->solved_revision = revision;
--- 139,152 ----
options::SetLevelTime(const string &pack, const string &level, int
difficulty, int revision, int time)
{
LevelStatus *stat = GetLevelStatus(pack, level);
! if (stat) {
! if (((stat->solved_revision < revision) && (stat->solved_revision >=
1)) || stat->finished == 0)
! {
! stat->time_hard = -1;
! stat->time_easy = -1;
! stat->finished = 0;
}
stat->finished |= difficulty;
stat->solved_revision = revision;
***************
*** 174,180 ****
--- 154,171 ----
else {
SetLevelStatus(pack, level, LevelStatus(-1, -1, difficulty,
revision));
+ stat = GetLevelStatus(pack, level);
+ assert(stat);
+ }
+
+ bool new_record = false;
+ int& time_curr = difficulty == enigma::DIFFICULTY_EASY ? stat->time_easy
: stat->time_hard;
+
+ if (time_curr > time || time_curr == -1) {
+ time_curr = time;
+ new_record = true;
}
LevelStatusChanged = true;
+ return new_record;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Enigma-cvs] enigma/src options.cc,1.27,1.28,
Ralf Westram <address@hidden> <=