Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test some world vars against bad const folding, fix world.system_type #2096

Merged
merged 7 commits into from
Nov 16, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

/proc/RunTest()
ASSERT(isnum(world.opendream_topic_port))
3 changes: 3 additions & 0 deletions Content.Tests/DMProject/Tests/Builtins/world_system_type.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

/proc/RunTest()
ASSERT(istext(world.system_type) && length(world.system_type))
4 changes: 2 additions & 2 deletions DMCompiler/DMStandard/Defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
#define SYNC_STEPS 3

//world.system_type
#define UNIX 0
#define MS_WINDOWS 1
#define UNIX "UNIX"
#define MS_WINDOWS "MS_WINDOWS"

//Icon blending functions
#define ICON_ADD 0
Expand Down
4 changes: 2 additions & 2 deletions OpenDreamRuntime/Objects/Types/DreamObjectWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ protected override bool TryGetVar(string varName, out DreamValue value) {
case "system_type":
//system_type value should match the defines in Defines.dm
if (Environment.OSVersion.Platform is PlatformID.Unix or PlatformID.MacOSX or PlatformID.Other)
value = new DreamValue(0);
value = new DreamValue("UNIX");
else
value = new DreamValue(1); //Windows
value = new DreamValue("MS_WINDOWS"); //Windows

return true;

Expand Down
Loading