Closed SphereII closed 7 years ago
In PostProcessConfigs(XmlDataProvider gameDataProvider) Method:
XmlNodeList xmlNodeList2 = gameDataProvider.GetData("blocks").QueryNodes("/blocks/block/@id");
Logging.LogInfo("Blocks to process: " + xmlNodeList2.Count);
for (int j = 0; j < xmlNodeList2.Count; j++)
{
XmlAttribute xmlAttribute2 = xmlNodeList2[j] as XmlAttribute;
if (xmlAttribute2 != null)
{
string innerText2 = xmlAttribute2.InnerText;
bool flag3 = false;
int num4 = 0;
if (!int.TryParse(innerText2, out num4))
{
flag3 = true;
}
if (flag3)
{
Logging.LogInfo("Assign id: " + num2);
**num2 = this.GetNextHighestID(gameDataProvider, num2);**
xmlAttribute2.InnerText = num2.ToString();
}
}
}
Logging.LogInfo("PostProcess highest BlockID: " + num2);
With node method:
public int GetNextHighestID(XmlDataProvider gameDataProvider, int intLastHighest)
{
for (int x = intLastHighest; x < 2049; x++)
{
if (gameDataProvider.GetData("blocks").QueryNode("blocks/block[@id='" + x.ToString() + "']") == null)
{
Logging.Log("Found free block: " + x.ToString());
return x;
}
}
Logging.LogError("Exceeded Block Limit for available numbers");
return -1;
}
Should be sorted in 0.7.2
Not sure if it's related to this, but in a new Config, I'm getting a crash:
FoundConfig: traders
FoundConfig: utilityai
FoundConfig: vehicles
FoundConfig: weathersurvival
FoundConfig: xui
Found sub dir: C:\SDXModding\SDX0.7.2c\Backups\7 Days To Die\Data/Config\XUi
Found sub dir: C:\SDXModding\SDX0.7.2c\Backups\7 Days To Die\Data/Config\XUi_Menu
Searching files in: C:\SDXModding\SDX0.7.2c\Backups\7 Days To Die\Data/Config\XUi_Menu
FoundConfig: XUi_Menu/controls
FoundConfig: XUi_Menu/styles
FoundConfig: XUi_Menu/windows
FoundConfig: XUi_Menu/xui
Searching files in: C:\SDXModding\SDX0.7.2c\Backups\7 Days To Die\Data/Config\XUi
FoundConfig: XUi/controls
FoundConfig: XUi/styles
FoundConfig: XUi/windows
Apply mod config patch: Winter Wonderland
Applying patch: C:\SDXModding\SDX0.7.2c/Targets\7DaysToDie\Mods\WinterWonderLand\Config\WinterWonderland.xml...
AddXmlByXPath: /blocks
Found 3
EVENT: Run sub task: Run Xml Patcher mod scripts
WARN: No assembly from BuildAndRunPatchModsTask
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at SDX7DTD.frmMain.<frmMain_Load>b__9_0()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
It works in previous versions. WinterWonderland.txt
Tested and worked as intended.
SDX is looking for the highest free block id. Since the blocks file has a lot of holes in their ID, it'd be expected that SDX can fill in the missing IDs, rather than going to next highest.