Bug - Fixed Wrong Spooky Forest NC selection displayed

AtlanteanScion

New member
I ran into an odd Mafia behavior that confused me, so I delved into the source and found a very minor bug. I'm running the current latest Mafia build (r11387), though I've seen this issue in previous versions.

Description:
In Mafia's Choice Advs tab, if you set the Spooky Forest non-combat option to "Spooky Temple map then skip adventure", then next time you load Mafia, the "spooky sapling & sell bar skins" option will be displayed instead.

Cause:
When Mafia saves the NC option settings, the internal Spooky Forest index is correctly mapped to the associated choiceAdventureXXX values. However, when loading these settings, the index of two options are swapped.

Possible Fix?:
I believe the index settings should be changed as indicated below. This switch statement is currently found at lines 1245-1296 of src/net/sourceforge/kolmafia/swingui/panel/ChoiceOptionsPanel.java.

Code:
// Figure out what to do in the spooky forest
switch ( Preferences.getInteger( "choiceAdventure502" ) )
{
default:
case 0:
	// Manual Control
	index = 0;
	break;

case 1:
	switch ( Preferences.getInteger( "choiceAdventure503" ) )
	{
	case 1:	// Get Meat
		index = 7;
		break;
	case 2:	// Meet Vampire Hunter
		index = 5;
		break;
	case 3:	// Spooky Sapling & Sell Bar Skins
		[COLOR="#FF0000"]index = 4;	// Should be 3?[/COLOR]
		break;
	}
case 2:
	switch ( Preferences.getInteger( "choiceAdventure505" ) )
	{
	case 1:	// Mosquito Larva or Spooky Mushrooms
		index = 1;
		break;
	case 2:	// Tree-holed coin -> Spooky Temple Map
		[COLOR="#FF0000"]index = 3;	// Should be 4?[/COLOR]
		break;
	case 3:	// Meet Vampire
		index = 6;
		break;
	}
	break;
case 3:
	switch ( Preferences.getInteger( "choiceAdventure506" ) )
	{
	case 1:	// Forest Corpses
		index = Preferences.getInteger( "choiceAdventure26" );
		index = index * 2 + Preferences.getInteger( "choiceAdventure" + ( 26 + index ) ) - 3;
		index += 8;
		break;
	case 2:	// Spooky-Gro Fertilizer
		index = 2;
		break;
	case 3:	// Spooky Temple Map
		[COLOR="#FF0000"]index = 3;	// Should be 4?[/COLOR]
		break;
	}
}
 
Top