def create_undo_state(self): n_history = 200 state = save_load.create_save_state(self.game.map) if self.undo_index < len(self.undo_states) - 1: # delete redo info if have undone stuff and then do new things self.undo_states = self.undo_states[:self.undo_index] self.undo_states.append(state) self.undo_index += 1 if len(self.undo_states) > n_history: self.undo_index = n_history - 1
def create_undo_state(self): n_history = 200 state = save_load.create_save_state(self.game.map) if self.undo_index < len( self.undo_states ) - 1: # delete redo info if have undone stuff and then do new things self.undo_states = self.undo_states[:self.undo_index] self.undo_states.append(state) self.undo_index += 1 if len(self.undo_states) > n_history: self.undo_index = n_history - 1
def exit_edit_mode(self): self.save_state = save_load.create_save_state(self.game.map) self.disable_main_editor()