Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempting to Access Crewman Menu When No Crewman in Hospital Causes Game Crash #32

Open
cnelso00 opened this issue Jun 23, 2021 · 2 comments

Comments

@cnelso00
Copy link

I have a "fail silently" fix that I can PR if desired. It just adds a try-catch block around the offending code, in case of an IndexError.

The text of the error is here:

/Users/<username>/code/armcom2/armcom2.py:2445: DeprecationWarning: Call the `con.print_` method instead.
  libtcod.console_print(calendar_main_panel, 2, y, 'No crewmen currently in hospital')
Traceback (most recent call last):
  File "/Users/<username>/code/armcom2/armcom2.py", line 18246, in <module>
    campaign.DoCampaignCalendarLoop()
  File "/Users/<username>/code/armcom2/armcom2.py", line 2857, in DoCampaignCalendarLoop
    crewman = campaign.hospital[selected_hospital_crewman]
IndexError: list index out of range
@sudasana
Copy link
Owner

Sure - you could also check the length of campaign.hospital first, and if it's 0, continue in the loop.

This is fixed in the current Steam version of the game, if you're interested in checking it out. You get the full source code with the game.

@cnelso00
Copy link
Author

That's good to know! I bought the game on Steam, but was out of town when I bought it and only had my macbook, so I downloaded from here and got it running on that machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants