Some more logging to help diagnose #278, a potential workaround to remove items/characters that Entity.RemoveAll failed to remove for some reason.
This commit is contained in:
@@ -24,7 +24,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (limbs == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Attempted to access a potentially removed ragdoll. Character: " + character.Name + ", id: " + character.ID + ", removed: " + character.Removed);
|
||||
DebugConsole.ThrowError("Attempted to access a potentially removed ragdoll. Character: " + character.Name + ", id: " + character.ID + ", removed: " + character.Removed + ", ragdoll removed: " + !list.Contains(this));
|
||||
return new Limb[0];
|
||||
}
|
||||
return limbs;
|
||||
|
||||
@@ -133,6 +133,51 @@ namespace Barotrauma
|
||||
DebugConsole.ThrowError(" - " + e.ToString() + "(ID " + e.id + ")");
|
||||
}
|
||||
}
|
||||
if (Item.ItemList.Count > 0)
|
||||
{
|
||||
DebugConsole.ThrowError("Some items were not removed in Entity.RemoveAll:");
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
DebugConsole.ThrowError(" - " + item.Name + "(ID " + item.id + ")");
|
||||
}
|
||||
|
||||
var items = new List<Item>(Item.ItemList);
|
||||
foreach (Item item in items)
|
||||
{
|
||||
try
|
||||
{
|
||||
item.Remove();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
DebugConsole.ThrowError("Error while removing entity \"" + item.ToString() + "\"", exception);
|
||||
}
|
||||
}
|
||||
Item.ItemList.Clear();
|
||||
}
|
||||
if (Character.CharacterList.Count > 0)
|
||||
{
|
||||
DebugConsole.ThrowError("Some characters were not removed in Entity.RemoveAll:");
|
||||
foreach (Character character in Character.CharacterList)
|
||||
{
|
||||
DebugConsole.ThrowError(" - " + character.Name + "(ID " + character.id + ")");
|
||||
}
|
||||
|
||||
var characters = new List<Character>(Character.CharacterList);
|
||||
foreach (Character character in characters)
|
||||
{
|
||||
try
|
||||
{
|
||||
character.Remove();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
DebugConsole.ThrowError("Error while removing entity \"" + character.ToString() + "\"", exception);
|
||||
}
|
||||
}
|
||||
Character.CharacterList.Clear();
|
||||
}
|
||||
|
||||
dictionary.Clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -1249,7 +1249,7 @@ namespace Barotrauma
|
||||
List<Item> items = new List<Item>(Item.ItemList);
|
||||
foreach (Item item in items)
|
||||
{
|
||||
DebugConsole.ThrowError("Error while unloading submarines - item \""+item.Name+"\" not removed");
|
||||
DebugConsole.ThrowError("Error while unloading submarines - item \"" + item.Name + "\" (ID:" + item.ID + ") not removed");
|
||||
try
|
||||
{
|
||||
item.Remove();
|
||||
|
||||
Reference in New Issue
Block a user