Author Topic: [FIXED] New Battle crash when changing deployments with different maxAlienRank  (Read 430 times)

Offline CrazedHarpooner

  • Colonel
  • ****
  • Posts: 101
    • View Profile
New Battle crash when changing deployments with different maxAlienRank and you don't actively update the selected race after the change.

TLDR
If your currently selected mission in New Battle has a certain maxAlienRank that, let's say, matches 20 factions, and you then change to another mission, but only 10 factions match the necessary ranks the list will change, BUT the currently selected race "index" doesn't. If you have selected a race "index" that is one of the last 10 from the old deployment, since there' no valid races for those indexes in the new deployment it won't update the text on the faction button, and if you immedietly click on [OK] after just changing the mission (deployment) you'll get this crash (see 1st attached image). If you actively change the faction to one in the new list after changing the mission you'll avoid the crash.

Detailed explanation
Whenever you change the selected mission in a New Battle, the engine will check what alien races (or factions) have a number of "ranks" valid for the deployment and populate the faction list accordingly. Depending on what faction "index" was selected before the change it may simply change to a faction in the new list that matches the index position of the old one, but if the "index" faction is outside the list of valid factions for the new deployment, the button showing the faction WON'T update which may appear as that faction is the currently selected one, but if you proceed to press [OK] without updating the selected faction, it will crash.

Note: while I am using the word "index", I'm uncertain if it's the correct term, but it's the closest thing I can associate it with.

Real case example where I've noticed it:
Mod: The X-Com Files (issue not exclusive to this mod)
Once in New Battle
Select Mission: MiB Outpost (STR_MIB_OUTPOST)
Select Faction: Men In Black (STR_MIB)
Change Mission to: MiB Lunar Base Landing (STR_MIB_LUNAR_BASE_LANDING)
Observe that the faction doesn't appear to change.
Click OK - Crash

If you like you can observe the faction list while you have the Lunar Base mission selected, and notice it is relatively short (only 6). If you repeat the process above, but make sure the selected faction is any of the first 6 ones while the Outpost mission is selected and then change, the faction will update to the matching one in that order. Repeating the same process with any of the other races beyond the sixth one will result in the crash. Also, depending on the race selected, you may get a garbled race name in the crash window (see 2nd attached image).