Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Content.Tests/DMTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void TestFiles(string sourceFile, DMTestFlags testFlags, int errorCode) {
Assert.Fail("No global proc named RunTest");
return DreamValue.Null;
}
});
}).Dispose();

var watch = new Stopwatch();
watch.Start();
Expand Down
2 changes: 1 addition & 1 deletion DMCompiler/Compiler/DM/DMParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2761,7 +2761,7 @@ private void BracketWhitespace() {
if (callParameters.Length is < 1)
Emit(WarningCode.InvalidArgumentCount, callLoc,
"Expected at least 1 argument for animate()");

return new DMASTAnimate(identifier.Location, callParameters);
}
default:
Expand Down
2 changes: 2 additions & 0 deletions DMCompiler/DM/DMCodeTree.Vars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ private bool HandleGlobalVar(DMCompiler compiler, DMObject dmObject, int pass) {
compiler.GlobalInitProc.DebugSource(value.Location);
value.EmitPushValue(new(compiler, dmObject, compiler.GlobalInitProc));
compiler.GlobalInitProc.Assign(DMReference.CreateGlobal(globalId));
compiler.GlobalInitProc.Pop();
return true;
}

Expand Down Expand Up @@ -298,6 +299,7 @@ public override bool TryDefineVar(DMCompiler compiler, int pass) {
compiler.GlobalInitProc.DebugSource(value.Location);
value.EmitPushValue(new(compiler, dmObject, compiler.GlobalInitProc));
compiler.GlobalInitProc.Assign(DMReference.CreateGlobal(globalId));
compiler.GlobalInitProc.Pop();
}

return true;
Expand Down
1 change: 1 addition & 0 deletions DMCompiler/DM/DMObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public void CreateInitializationProc() {
foreach (var assignment in InitializationProcAssignments) {
init.DebugSource(assignment.Assignment.Location);
assignment.Assignment.EmitPushValue(new(compiler, this, init));
init.Pop();
}
}

Expand Down
2 changes: 0 additions & 2 deletions DMCompiler/DMStandard/Types/Datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
var/tag

proc/New()
//SAFETY: If you redefine this to anything except empty, please revisit how DreamObject handles Del() or it will
// attempt to run DM on a GC thread, potentially causing problems.
proc/Del()

proc/Topic(href, href_list)
Expand Down
7 changes: 1 addition & 6 deletions DMCompiler/DMStandard/_Standard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ proc/rand(L, H) as num
proc/rand_seed(Seed) as null
proc/range(Dist, Center) as /list|null // NOTE: Not sure if return types have BYOND parity
proc/ref(Object) as text
proc/refcount(var/Object) as num
proc/replacetext(Haystack, Needle, Replacement, Start = 1, End = 0) as text|null
proc/replacetext_char(Haystack, Needle, Replacement, Start = 1, End = 0) as text|null
proc/replacetextEx(Haystack, Needle, Replacement, Start = 1, End = 0) as text|null
Expand Down Expand Up @@ -227,9 +228,3 @@ proc/lentext(T) as num

proc/winshow(player, window, show=1)
winset(player, window, "is-visible=[show ? "true" : "false"]")

proc/refcount(var/Object) as num
// woah that's a lot of refs
// i wonder if it's true??
return 100
// (it's not)
31 changes: 31 additions & 0 deletions OpenDreamRuntime/AtomManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using JetBrains.Annotations;
using OpenDreamRuntime.Map;
using OpenDreamRuntime.Objects;
using OpenDreamRuntime.Objects.Types;
Expand Down Expand Up @@ -344,10 +345,12 @@ public void SetAppearanceVar(MutableAppearance appearance, string varName, Dream
}

//TODO THIS IS A SUPER NASTY HACK
[MustDisposeResource]
public DreamValue GetAppearanceVar(MutableAppearance appearance, string varName) {
return GetAppearanceVar(new ImmutableAppearance(appearance, null), varName);
}

[MustDisposeResource]
public DreamValue GetAppearanceVar(ImmutableAppearance appearance, string varName) {
switch (varName) {
case "name":
Expand Down Expand Up @@ -692,6 +695,34 @@ public MutableAppearance GetAppearanceFromDefinition(DreamObjectDefinition def)
}

_definitionAppearanceCache.Add(def, appearance);
nameVar.Dispose();
descVar.Dispose();
iconVar.Dispose();
stateVar.Dispose();
colorVar.Dispose();
alphaVar.Dispose();
glideSizeVar.Dispose();
dirVar.Dispose();
invisibilityVar.Dispose();
opacityVar.Dispose();
mouseVar.Dispose();
xVar.Dispose();
yVar.Dispose();
layerVar.Dispose();
planeVar.Dispose();
renderSourceVar.Dispose();
renderTargetVar.Dispose();
blendModeVar.Dispose();
appearanceFlagsVar.Dispose();
maptextVar.Dispose();
maptextWidthVar.Dispose();
maptextHeightVar.Dispose();
maptextXVar.Dispose();
maptextYVar.Dispose();
mouseOverPointer.Dispose();
mouseDragPointer.Dispose();
mouseDropPointer.Dispose();
mouseDropZone.Dispose();
return appearance;
}

Expand Down
Loading
Loading