Fix SimAntics unit test

This commit is contained in:
Ammar Askar 2024-10-18 11:44:36 -04:00
parent 5611766d11
commit cabc1f12e3
2 changed files with 8 additions and 1 deletions

View file

@ -74,6 +74,11 @@ namespace OpenTS2.SimAntics
}
catch(Exception e)
{
// If we don't have an exception handler just re-throw to avoid swallowing errors.
if (ExceptionHandler == null)
{
throw;
}
ExceptionHandler?.Invoke(e, entity);
}
}

View file

@ -113,12 +113,14 @@ namespace OpenTS2.SimAntics
public BHAVAsset GetBHAV(ushort treeID)
{
// 0x0XXX is global scope, 0x1XXX is private scope and 0x2XXX is semiglobal scope.
var groupid = SemiGlobalGroupID;
uint groupid;
if (treeID < 0x1000)
groupid = GroupIDs.Global;
else if (treeID < 0x2000)
groupid = PrivateGroupID;
else
groupid = SemiGlobalGroupID;
return VM.GetBHAV(treeID, groupid);
}