Fixed crashes and errors when loading into world.

This commit is contained in:
hondacrx
2022-06-21 14:56:22 -04:00
parent be8e18450e
commit 63cbd18350
12 changed files with 79 additions and 31 deletions
@@ -3559,7 +3559,7 @@ namespace Game.Entities
uint _stateChangeProgress;
List<uint> _stopFrames = new();
bool _autoCycleBetweenStopFrames;
TimeTracker _positionUpdateTimer;
TimeTracker _positionUpdateTimer = new();
List<WorldObject> _passengers = new();
static TimeSpan PositionUpdateInterval = TimeSpan.FromMilliseconds(50);
@@ -382,7 +382,7 @@ namespace Game.Entities
public void ClearChangesMask<U>(OptionalUpdateField<U> updateField) where U : new()
{
if (typeof(IHasChangesMask).IsAssignableFrom(typeof(U)))
if (typeof(IHasChangesMask).IsAssignableFrom(typeof(U)) && updateField.HasValue())
((IHasChangesMask)updateField._value).ClearChangesMask();
}
+2 -2
View File
@@ -2981,9 +2981,9 @@ namespace Game.Entities
public bool IsPermanentWorldObject() { return m_isWorldObject; }
public ITransport GetTransport() { return m_transport; }
public T GetTransport<T>() where T : ITransport
public T GetTransport<T>() where T : class, ITransport
{
return (T)m_transport;
return m_transport as T;
}
public float GetTransOffsetX() { return m_movementInfo.transport.pos.GetPositionX(); }
public float GetTransOffsetY() { return m_movementInfo.transport.pos.GetPositionY(); }
@@ -33,6 +33,8 @@ namespace Game.Entities
public void InitTaxiNodesForLevel(Race race, Class chrClass, uint level)
{
m_taximask = new byte[((CliDB.TaxiNodesStorage.GetNumRows() - 1) / 8) + 1];
// class specific initial known nodes
if (chrClass == Class.Deathknight)
{
@@ -105,6 +107,8 @@ namespace Game.Entities
public void LoadTaxiMask(string data)
{
m_taximask = new byte[((CliDB.TaxiNodesStorage.GetNumRows() - 1) / 8) + 1];
var split = new StringArray(data, ' ');
int index = 0;