Skip to content

Commit b5a7bec

Browse files
committed
Minor improvements
1 parent 9a9de92 commit b5a7bec

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

GS2Engine/GS2/Script/Script.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ private void Init(
124124
private void Reset()
125125
{
126126
Machine.Reset();
127-
//GlobalVariables.Clear();
128127
Functions.Clear();
129-
GlobalObjects.Clear();
130128
ExternalFunctions?.Clear();
131129
_bytecode = Array.Empty<ScriptCom>();
132130
}
@@ -288,6 +286,7 @@ private void SetStream(TString bytecodeParam)
288286
doubleString.writeChar(ch);
289287
}
290288

289+
doubleString = doubleString.ToString().Replace("--", "");
291290
op.Value = double.Parse(doubleString.ToString(), CultureInfo.InvariantCulture);
292291
Tools.Debug($" - double({op.Value}) (string)\n");
293292
break;

GS2Engine/GS2/Script/ScriptMachine.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public async Task<IStackEntry> Execute(string functionName, Stack<IStackEntry>?
4444
IStackEntry? opCopy = null;
4545
Stack<IStackEntry> opWith = new();
4646

47-
Tools.DebugLine($"Starting to execute function \"{functionName}\"");
47+
Tools.DebugLine($"Starting to execute function \"{_script.Name}.{functionName}\"");
4848
while (index < _script.Bytecode.Length)
4949
{
5050
int curIndex = index;
@@ -205,9 +205,7 @@ out Script.Command command
205205
IStackEntry ret = 0.ToStackEntry();
206206
if (stack.Count > 0)
207207
ret = stack.Pop();
208-
Tools.DebugLine(
209-
JsonConvert.SerializeObject(Script.GlobalVariables.GetDictionary(), Formatting.Indented)
210-
);
208+
211209
return ret;
212210
case Opcode.OP_SLEEP:
213211
double sleep = getEntryValue<double>(stack.Pop());

GS2Engine/Models/GuiControl.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,11 @@ public IGuiControl? parent
235235
public void AddControl(IGuiControl? obj)
236236
{
237237
if (obj == null) return;
238-
239238
obj.parent = this;
240-
Controls.Add(obj);
239+
lock (Controls)
240+
{
241+
Controls.Add(obj);
242+
}
241243
}
242244

243245
public virtual void Draw()

0 commit comments

Comments
 (0)