Fix for MOD Game Options saved

Sto

Should i code today ...
Joined
Dec 15, 2005
Messages
1,144
Location
Marseille (France)
Not sure this has to be included in the unofficial patch. But Since a lots of MODS take the unofficial patch for base, that should be a good thing.
Regarding the increasing number of complains that comes from hidden options selected or not in a MOD because of the last game saved in another MOD, this fix grants at least that the hidden options are like defined in the xml or scenario.

in CvGame::init :
Spoiler :
Code:
	if (GC.getInitCore().getNewGame())
	{
		for (iI = 0; iI < NUM_GAMEOPTION_TYPES; ++iI)
		{
			if (!GC.getGameOptionInfo((GameOptionTypes)iI).getVisible())
			{
				setOption((GameOptionTypes)iI, GC.getGameOptionInfo((GameOptionTypes)iI).getDefault());
			}
		}
	}

and in CvWBDesc.py , CvWBDesc.CvGameDesc.apply :
Spoiler :
Code:
	def apply(self):
		"after reading, apply the game data"
		gc.getGame().setStartYear(self.iStartYear)
##
		for sOptionType in self.options :
                        iOption = gc.getInfoTypeForString(sOptionType)
                        if iOption == -1 :
                                print " CvGameDesc.apply : invalid option index for type %s" %sOptionType
                                continue
                        if not gc.getGameOptionInfo(iOption).getVisible() :
                                gc.getGame().setOption(iOption, True)
##

Tcho !
 
Top Bottom