Skip to content

Commit

Permalink
Add the Steam Workshop ID
Browse files Browse the repository at this point in the history
  • Loading branch information
dymanoid committed Jun 24, 2018
1 parent fc3a828 commit 2b0c5c1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/RealTime/Core/RealTimeMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ namespace RealTime.Core
/// </summary>
public sealed class RealTimeMod : LoadingExtensionBase, IUserMod
{
private const long WorkshopId = 1420955187;

This comment has been minimized.

Copy link
@originalfoo

originalfoo Aug 10, 2018

Shouldn't this be a ulong instead of long?

Additional info: #153

This comment has been minimized.

Copy link
@dymanoid

dymanoid Aug 10, 2018

Author Owner

In this case, it doesn't matter. This is a compile time constant, so the compiler can easily ensure that correct comparison occurs. Regardless of which type do we use here - long, ulong, int, uint (as long as the literal fits in the type, i.e. we cannot use ushort), the generated IL code will be always the same:

ldc.i4 1420955187
conv.i8
ceq
ret

So the IL code loads an int and converts it to a long anyway. That's not straight forward, but the compiler might have its reasons to do that.


private readonly string modVersion = GitVersion.GetAssemblyVersion(typeof(RealTimeMod).Assembly);
private readonly string modPath = GetModPath();

Expand Down Expand Up @@ -119,8 +121,10 @@ public override void OnLevelUnloading()

private static string GetModPath()
{
string assemblyName = typeof(RealTimeMod).Assembly.GetName().Name;

PluginManager.PluginInfo pluginInfo = PluginManager.instance.GetPluginsInfo()
.FirstOrDefault(pi => pi.name == typeof(RealTimeMod).Assembly.GetName().Name);
.FirstOrDefault(pi => pi.name == assemblyName || pi.publishedFileID.AsUInt64 == WorkshopId);

return pluginInfo == null
? Environment.CurrentDirectory
Expand Down

0 comments on commit 2b0c5c1

Please sign in to comment.