ClanGenOfficial / clangen

Warrior Cats fan game
https://clangen.io
Other
259 stars 456 forks source link

[BUG] crash when skipping moons #2844

Open selkirks opened 2 weeks ago

selkirks commented 2 weeks ago

Type: (only select one)

Describe the bug i have 'save every 5 moons' setting on. upon getting to the 4th moon and moon skipping, game crashes

Grade: (only select one)

Reproduce Steps to reproduce the behavior:

  1. make a new clan
  2. turn auto-save on
  3. moon skip

Commit # or Game Version Number: e21871523586d97e06bd175613546a24ff5075fd

Screenshots Traceback (most recent call last): File "C:\Users\Leafy\Documents\Github\clangen\main.py", line 348, in MANAGER.process_events(event) File "C:\Users\Leafy\AppData\Roaming\Python\Python310\site-packages\pygame_gui\ui_manager.py", line 240, in process_events consumed_event = ui_element.process_event(event) File "C:\Users\Leafy\Documents\Github\clangen\scripts\game_structure\windows.py", line 1705, in process_event if event.ui_element == self.close_button: AttributeError: 'SaveError' object has no attribute 'close_button'

PoppyBlossom commented 2 weeks ago

/assign-me

github-actions[bot] commented 2 weeks ago

👋 Hey @PoppyBlossom, thanks for your interest in this issue! 🎉

âš  Note that this issue will become unassigned if it isn't closed within 7 days.

🔧 A maintainer can also add the 📌 Pinned label to prevent it from being unassigned automatically.

PoppyBlossom commented 2 weeks ago

It looks like we needed the game to pause when saving.

PoppyBlossom commented 2 weeks ago
Traceback (most recent call last):
  File "clangen\scrip--ts\events.py", line 298, in one_moon
    game.save_cats()
  File "clangen\scrip--ts\game_structure\game_essentials.py", line 429, in save_cats
    for inter_cat in self.cat_class.all_cats.values():
RuntimeError: dictionary changed size during iteration
PoppyBlossom commented 2 weeks ago

I tried pausing the game while it's saving but the save time was too painful to wait so we need to find some new ways to implement this, I am currently thinking about creating a deep copy of the stuff that needed to be saved and doing it on a different thread?