siran
Sorceror
After about 5-6 hours of modifying a LOT of code involving most types of weapons, runuo crashes on startup with no crash log. The message given is "StackOverflowException".
Using WinMerge I compared my code with yesterday's backup and could not find any examples of infinite loops or self-calling code. I found a post where someone reported a similar problem involving the GetProperties method, so I removed a modification I had made to GetProperties in the BaseWeapon.cs script. That solved the problem and half the reason for this post is maybe that will help someone else who encounters this problem. The other half of the reason for this post is to see if anyone can shed some light on WHY this modification caused the problem.
Here is the change I made:
I added the two lines above the list.Add line, where I am calling a method I made in ResourceInfo.cs which is as follows:
This method simply accesses a new variable I added to CraftAttributeInfo to allow damage to be modified depending on the resource of which the weapon is made.
What I don't understand is what about this would cause a stack overflow exception.
Using WinMerge I compared my code with yesterday's backup and could not find any examples of infinite loops or self-calling code. I found a post where someone reported a similar problem involving the GetProperties method, so I removed a modification I had made to GetProperties in the BaseWeapon.cs script. That solved the problem and half the reason for this post is maybe that will help someone else who encounters this problem. The other half of the reason for this post is to see if anyone can shed some light on WHY this modification caused the problem.
Here is the change I made:
Code:
MinDamage += (int)(MinDamage * CraftResources.GetDamageModifier (Resource));
MaxDamage += (int)MaxDamage * CraftResources.GetDamageModifier (Resource));
list.Add (1061168, "{0}/t{1}", MinDamage.ToString (), MaxDamage.ToString ());
Code:
public static double GetDamageModifier (CraftResource resource)
{
double modifier = 0.0;
CraftResourceInfo info = GetInfo (resource);
CraftAttributeInfo attr = info.AttributeInfo;
if (attr != null)
modifier = attr.DamageModifier;
return modifier;
}
What I don't understand is what about this would cause a stack overflow exception.