enigma-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Enigma-cvs] enigma/src levelpack.cc,1.11,1.12


From: Ralf Westram <address@hidden>
Subject: [Enigma-cvs] enigma/src levelpack.cc,1.11,1.12
Date: Mon, 03 Nov 2003 14:22:12 +0000

Update of /cvsroot/enigma/enigma/src
In directory subversions:/tmp/cvs-serv28000

Modified Files:
        levelpack.cc 
Log Message:
- tests correct usage of par_time / par_time_easy / par_time_normal



Index: levelpack.cc
===================================================================
RCS file: /cvsroot/enigma/enigma/src/levelpack.cc,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** levelpack.cc        30 Oct 2003 19:05:28 -0000      1.11
--- levelpack.cc        3 Nov 2003 14:22:10 -0000       1.12
***************
*** 140,147 ****
          if (p != string::npos && line.at(p) == '{') { // found a level 
description
              string filename, name, author;
!             int    revision  = 1;
!             bool   easymode  = false;
!             int    par_time  = -1;
!             int    par_moves = -1;
              string hint1, hint2;
  
--- 140,149 ----
          if (p != string::npos && line.at(p) == '{') { // found a level 
description
              string filename, name, author;
!             int    revision        = 1;
!             bool   easymode        = false;
!             int    par_time        = -1;
!             int    par_time_easy   = -1;
!             int    par_time_normal = -1;
!             int    par_moves       = -1;
              string hint1, hint2;
  
***************
*** 196,208 ****
                  }
  
!                 if      (tag == "file") filename       = content;
!                 else if (tag == "name") name           = content;
!                 else if (tag == "author") author       = content;
!                 else if (tag == "revision") revision   = 
atoi(content.c_str());
!                 else if (tag == "easymode") easymode   = (content == "1");
!                 else if (tag == "par_time") par_time   = 
atoi(content.c_str());
!                 else if (tag == "par_moves") par_moves = 
atoi(content.c_str());
!                 else if (tag == "hint1") hint1         = content;
!                 else if (tag == "hint2") hint2         = content;
                  else {
                      xerror = strf("unknown tag '%s'", tag.c_str());
--- 198,212 ----
                  }
  
!                 if      (tag == "file") filename                   = content;
!                 else if (tag == "name") name                       = content;
!                 else if (tag == "author") author                   = content;
!                 else if (tag == "revision") revision               = 
atoi(content.c_str());
!                 else if (tag == "easymode") easymode               = (content 
== "1");
!                 else if (tag == "par_time") par_time               = 
atoi(content.c_str());
!                 else if (tag == "par_time_easy") par_time_easy     = 
atoi(content.c_str());
!                 else if (tag == "par_time_normal") par_time_normal = 
atoi(content.c_str());
!                 else if (tag == "par_moves") par_moves             = 
atoi(content.c_str());
!                 else if (tag == "hint1") hint1                     = content;
!                 else if (tag == "hint2") hint2                     = content;
                  else {
                      xerror = strf("unknown tag '%s'", tag.c_str());
***************
*** 214,219 ****
  
              if (!error) {
                  m_levels.push_back(LevelInfo(GAMET_ENIGMA, filename, name, 
author, revision,
!                                              easymode, par_time, par_moves, 
hint1, hint2));
              }
          }
--- 218,243 ----
  
              if (!error) {
+                 if (easymode) {
+                     if (par_time>0) {
+                         error = "'par_time' not allowed when easymode=1 (use 
par_time_easy and par_time_normal)";
+                     }
+                 }
+                 else {
+                     if (par_time_normal>0 || par_time_easy>0) {
+                         error = "'par_time_easy' and 'par_time_normal' are 
not allowed when easymode=0 (use par_time)";
+                     }
+                 }
+             }
+ 
+             if (!error) {
+                 if (!easymode) {
+                     par_time_easy = par_time_normal = par_time;
+                 }
+ 
                  m_levels.push_back(LevelInfo(GAMET_ENIGMA, filename, name, 
author, revision,
!                                              easymode,
!                                              par_time_easy, par_time_normal,
!                                              par_moves,
!                                              hint1, hint2));
              }
          }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]