saltyhotdog / BattletechIssueTracker

Public issue tracker to communicate with modders and HBS.
MIT License
6 stars 0 forks source link

Accessing Pilot List with no Mechwarriors other than the Commander throws an Exception #1

Closed saltyhotdog closed 6 years ago

saltyhotdog commented 6 years ago

Describe the problem When the user dismisses all of their pilots and the game accesses the pilot list through PilotRoster.GetNext() it will throw an exception. This occurs when a forcedevent is attempted in SimGameEventTrackers.

Provide an example of the code where the problem occurs The problem occurs in SimGameEventTrackers.cs on line 174:

{
    this.predefinedPilot = this.sim.PilotRoster.GetNext(true);
}

Provide an example of your proposed solution The code needs a try catch that will set this.predefinedPilot to this.sim.Commander if an exception is caught.

try                 
{                       
    this.predefinedPilot = this.sim.PilotRoster.GetNext(true);
}
catch
{
    this.predefinedPilot = this.sim.Commander;
}

Provide a link to a commit in the private repo for this issue https://github.com/saltyhotdog/BattletechSLN/commit/b5bed5b5bee459f09ecbcd601f741eb9e1c8a43e

Leave any additional comments here Fixing this will make mods that start the player off with fewer resources a lot easier to use.

caardappel-hbs commented 6 years ago

This has been fixed for the 1.1 update.