public static void Generate() { if (working) { Log.Error("Cannot call Generate() while already generating. Nested calls are not allowed."); } else { working = true; try { if (symbolStack.Empty) { Log.Warning("Symbol stack is empty."); } else if (globalSettings.map == null) { Log.Error("Called BaseGen.Resolve() with null map."); } else { int num = symbolStack.Count - 1; int num2 = 0; while (true) { if (symbolStack.Empty) { return; } num2++; if (num2 > 100000) { break; } Pair <string, ResolveParams> toResolve = symbolStack.Pop(); if (symbolStack.Count == num) { GlobalSettings obj = globalSettings; ResolveParams second = toResolve.Second; obj.mainRect = second.rect; num--; } try { Resolve(toResolve); } catch (Exception ex) { Log.Error("Error while resolving symbol \"" + toResolve.First + "\" with params=" + toResolve.Second + "\n\nException: " + ex); } } Log.Error("Error in BaseGen: Too many iterations. Infinite loop?"); } } catch (Exception arg) { Log.Error("Error in BaseGen: " + arg); } finally { working = false; symbolStack.Clear(); globalSettings.Clear(); } } }
public static void Generate() { if (working) { Log.Error("Cannot call Generate() while already generating. Nested calls are not allowed."); return; } working = true; currentSymbolPath = ""; globalSettings.ClearResult(); try { if (symbolStack.Empty) { Log.Warning("Symbol stack is empty."); return; } if (globalSettings.map == null) { Log.Error("Called BaseGen.Resolve() with null map."); return; } int num = symbolStack.Count - 1; int num2 = 0; while (!symbolStack.Empty) { num2++; if (num2 > 100000) { Log.Error("Error in BaseGen: Too many iterations. Infinite loop?"); break; } SymbolStack.Element toResolve = symbolStack.Pop(); currentSymbolPath = toResolve.symbolPath; if (symbolStack.Count == num) { globalSettings.mainRect = toResolve.resolveParams.rect; num--; } try { Resolve(toResolve); } catch (Exception ex) { Log.Error(string.Concat("Error while resolving symbol \"", toResolve.symbol, "\" with params=", toResolve.resolveParams, "\n\nException: ", ex)); } } } catch (Exception arg) { Log.Error("Error in BaseGen: " + arg); } finally { globalSettings.landingPadsGenerated = globalSettings.basePart_landingPadsResolved; working = false; symbolStack.Clear(); globalSettings.Clear(); } }