mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-16 21:08:28 +00:00
handle situation when definition already exists
This commit is contained in:
parent
fdc42b1946
commit
b065f68b51
1 changed files with 9 additions and 1 deletions
|
@ -3,6 +3,7 @@ using SanAndreasUnity.Importing.Items.Placements;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SanAndreasUnity.Importing.Items
|
||||
{
|
||||
|
@ -63,7 +64,14 @@ namespace SanAndreasUnity.Importing.Items
|
|||
var file = new ItemFile<Definition>(path);
|
||||
foreach (var obj in file.GetItems<Definition>().OfType<IObjectDefinition>())
|
||||
{
|
||||
_definitions.Add(obj.Id, obj);
|
||||
if (_definitions.ContainsKey(obj.Id))
|
||||
{
|
||||
Debug.LogWarning($"Definition with id {obj.Id} already exists, skipping it");
|
||||
}
|
||||
else
|
||||
{
|
||||
_definitions.Add(obj.Id, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue