File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Metro/Metro_RP2350_Chips_Challenge Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -268,7 +268,8 @@ def _handle_commands(self):
268
268
self .request_password ()
269
269
elif command == PREVIOUS_LEVEL :
270
270
if self ._gamelogic .current_level_number > 1 :
271
- if self ._savestate .is_level_unlocked (self ._gamelogic .current_level_number - 1 ):
271
+ if (self ._gamelogic .current_level_number - 1 == 1 or
272
+ self ._savestate .is_level_unlocked (self ._gamelogic .current_level_number - 1 )):
272
273
self .reset_level ()
273
274
self ._gamelogic .dec_level ()
274
275
self .save_level ()
@@ -412,10 +413,10 @@ def request_password(self):
412
413
level = self ._savestate .find_unlocked_level (password )
413
414
if not 0 < level <= self ._gamelogic .last_level :
414
415
self .show_message ("That is not a valid level number." )
415
- elif (level and password and
416
+ elif (level > 1 and password and
416
417
self ._gamelogic .current_level .passwords [level ] != password ):
417
418
self .show_message ("You must enter a valid password." )
418
- elif (self ._savestate .is_level_unlocked (level ) and
419
+ elif (level != 1 and self ._savestate .is_level_unlocked (level ) and
419
420
self ._savestate .find_unlocked_level (level ) is None
420
421
and self ._savestate .find_unlocked_level (password ) is None ):
421
422
self .show_message ("You must enter a valid password." )
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ def load(self):
60
60
with open ("/sd/" + SAVESTATE_FILE , "r" ) as f :
61
61
data = json .load (f )
62
62
self ._levels = data ["levels" ]
63
- except OSError :
63
+ except ( OSError , ValueError ) :
64
64
pass
65
65
66
66
def set_level_score (self , level , score , time_left ):
You can’t perform that action at this time.
0 commit comments