Skip to content
Merged
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
5 changes: 3 additions & 2 deletions src/TSMapEditor/Models/Trigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Rampastring.Tools;
using System;
using System.Collections.Generic;
using TSMapEditor.CCEngine;
using TSMapEditor.Misc;
using TSMapEditor.Models.Enums;

Expand Down Expand Up @@ -179,12 +180,12 @@ public void ParseConditions(string data, EditorConfig editorConfig)
for (int i = 0; i < eventCount; i++)
{
int conditionIndex = Conversions.IntFromString(dataArray[startIndex], -1);
if (conditionIndex >= editorConfig.TriggerEventTypes.Count)
if (!editorConfig.TriggerEventTypes.TryGetValue(conditionIndex, out TriggerEventType triggerEventType))
{
throw new INIConfigException("The map contains a trigger event that is not defined in the editor's config. To prevent data loss, the map cannot be loaded. Event index: " + conditionIndex);
}

bool usesP3 = editorConfig.TriggerEventTypes[conditionIndex].UsesP3;
bool usesP3 = triggerEventType.UsesP3;

var triggerEvent = TriggerCondition.ParseFromArray(dataArray, startIndex, usesP3);
if (triggerEvent == null)
Expand Down
Loading