Skip to content

Commit 976359f

Browse files
fix: editor crashes on specifics variable mods (AscensionGameDev#2264)
1 parent e79252a commit 976359f

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

Intersect.Editor/Forms/Editors/Events/Event Commands/EventCommand_Variable.cs

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.Windows.Forms;
34

45
using Intersect.Editor.Localization;
@@ -266,16 +267,26 @@ private void TryLoadNumericMod(GameObjects.Events.VariableMod variableMod)
266267
return;
267268
}
268269

269-
if (integerMod.DuplicateVariableId == Guid.Empty && integerMod.ModType < VariableMod.DupPlayerVar)
270-
{
271-
nudNumericValue.Value = integerMod.Value;
272-
ResetSettingVariableSelection();
273-
}
274-
else
275-
{
276-
rdoVariableValue.Checked = true;
277-
mSettingVariableId = integerMod.DuplicateVariableId;
278-
mSettingVariableType = integerMod.ModType.GetRelatedVariableType();
270+
switch (integerMod.ModType)
271+
{
272+
case VariableMod.Set:
273+
case VariableMod.Add:
274+
case VariableMod.Subtract:
275+
case VariableMod.Multiply:
276+
case VariableMod.Divide:
277+
case VariableMod.LeftShift:
278+
case VariableMod.RightShift:
279+
case VariableMod.Random:
280+
case VariableMod.SystemTime:
281+
nudNumericValue.Value = integerMod.Value;
282+
ResetSettingVariableSelection();
283+
break;
284+
285+
default:
286+
rdoVariableValue.Checked = true;
287+
mSettingVariableId = integerMod.DuplicateVariableId;
288+
mSettingVariableType = integerMod.ModType.GetRelatedVariableType();
289+
break;
279290
}
280291

281292
optNumericSet.Checked = VariableModUtils.SetMods.Contains(integerMod.ModType);
@@ -383,6 +394,10 @@ private IntegerVariableMod GetNumericVariableMod()
383394
{
384395
mod.ModType = VariableMod.LeftShift;
385396
}
397+
else if (optNumericRightShift.Checked && optNumericStaticVal.Checked)
398+
{
399+
mod.ModType = VariableMod.RightShift;
400+
}
386401
else if (optNumericRandom.Checked)
387402
{
388403
mod.ModType = VariableMod.Random;

0 commit comments

Comments
 (0)