irskep / clubsandwich

A BearLibTerminal framework for Python 3
MIT License
60 stars 10 forks source link

director.py DirectorLoop class error #5

Closed jainokaine closed 7 years ago

jainokaine commented 7 years ago

I found an error with The Scene example on the website. I changed a thing to make it work but have no clue if I borked it or not.

OLD CODE

    def terminal_update(self):
        i = 0
        for j, scene in enumerate(self.scene_stack):
            if scene.covers_screen:
                i = j
        for scene in self.scene_stack[i:]:
            scene.terminal_update(scene == self.scene_stack[-1]) #THIS PRODUCES AN ERROR
        return not self.should_exit

MY JANKY ATTEMPT

     def terminal_update(self):
        i = 0
        for j, scene in enumerate(self.scene_stack):
            if scene.covers_screen:
                i = j
        for scene in self.scene_stack[i:]:
            scene = self.scene_stack[-1]#<=== EDITED THIS
            scene.terminal_update()
        return not self.should_exit

That said, it now works but no clue if I ruined any other features.

irskep commented 7 years ago

That doesn't really fix it. Check this out: 1fd68ca89cac564f4abba2e1e6f8073c70b137a8