827 |
|
|
828 |
unsigned |
unsigned |
829 |
enigma::NextLevel (LevelPack *lp, unsigned levelidx, unsigned max_available, |
enigma::NextLevel (LevelPack *lp, unsigned levelidx, unsigned max_available, |
830 |
bool skip_solved, bool skip_todo_and_unnamed) |
bool skip_solved, bool skip_todo) |
831 |
{ |
{ |
832 |
// returns 0 if none found |
// returns 0 if none found |
833 |
unsigned found = 0; |
unsigned found = 0; |
840 |
|
|
841 |
const LevelInfo *info = lp->get_info(levelidx); |
const LevelInfo *info = lp->get_info(levelidx); |
842 |
|
|
843 |
if (skip_todo_and_unnamed) { // skip "todo" and unnamed levels |
if (skip_todo) { // skip "todo" levels |
844 |
if (info->filename == "todo") { |
if (info->filename == "todo") { |
845 |
printf("Skipping 'todo' level\n"); |
printf("Skipping 'todo' level\n"); |
846 |
continue; |
continue; |
847 |
} |
} |
848 |
if (info->name == "") { |
// if (info->name == "") { |
849 |
printf("Skipping unnamed level '%s'\n", info->filename.c_str()); |
// printf("Skipping unnamed level '%s'\n", info->filename.c_str()); |
850 |
continue; |
// continue; |
851 |
} |
// } |
852 |
} |
} |
853 |
|
|
854 |
bool available = levelidx <= max_available; |
// bool available = levelidx <= max_available; |
855 |
|
bool available = true; // level locking disabled for the time being! |
856 |
|
|
857 |
if (skip_solved || !available) { |
if (skip_solved || !available) { |
858 |
options::LevelStatus *ls = options::GetLevelStatus(lp->get_name(), info->filename); |
options::LevelStatus *ls = options::GetLevelStatus(lp->get_name(), info->filename); |
871 |
} |
} |
872 |
|
|
873 |
unsigned |
unsigned |
874 |
enigma::HighestAvailableLevel(LevelPack *lp) { |
enigma::HighestAvailableLevel(LevelPack *lp) |
875 |
|
{ |
876 |
if( options::WizardMode || // No restriction in WizardMode |
if( options::WizardMode || // No restriction in WizardMode |
877 |
lp->get_name() == "TestLevels") // and test-levelpack |
lp->get_name() == "TestLevels") // and test-levelpack |
878 |
return lp->size()-1; |
return lp->size()-1; |
912 |
return !(index <= max_available || finished >= options::Difficulty); |
return !(index <= max_available || finished >= options::Difficulty); |
913 |
} |
} |
914 |
|
|
915 |
|
unsigned |
916 |
|
enigma::CountSolvedLevels (LevelPack *lp) |
917 |
|
{ |
918 |
|
unsigned cnt = 0; |
919 |
|
for (unsigned i=0; i<lp->size(); ++i) |
920 |
|
{ |
921 |
|
if (options::LevelStatus *ls = GetStatus(lp, i)) |
922 |
|
if (ls->finished) |
923 |
|
++cnt; |
924 |
|
} |
925 |
|
return cnt; |
926 |
|
} |
927 |
|
|
928 |
|
|
929 |
|
|