Cleanup (removing unused variables & other redundancies, rethrowing exceptions instead of wrapping them in a new exception instance)

This commit is contained in:
Regalis
2017-05-20 15:35:13 +03:00
parent 89bd2b1a98
commit e3b595b9e0
40 changed files with 54 additions and 138 deletions
@@ -714,7 +714,6 @@ namespace Barotrauma.Items.Components
if (gap != null)
{
gap.Remove();
gap.linkedTo.Remove(hull);
continue;
}
+1 -3
View File
@@ -33,9 +33,7 @@ namespace Barotrauma.Items.Components
private bool isHorizontal;
private bool isStuck;
private float lastReceivedMessage;
private bool? predictedState;
private float resetPredictionTimer;
@@ -95,8 +95,6 @@ namespace Barotrauma.Items.Components
if (userPos != Vector2.Zero)
{
float torsoX = character.Position.X;
Vector2 diff = (item.WorldPosition + userPos) - character.WorldPosition;
if (character.AnimController.InWater)
@@ -148,9 +148,7 @@ namespace Barotrauma.Items.Components
radarBlips[i].FadeTimer -= (float)Timing.Step * 0.5f;
if (radarBlips[i].FadeTimer <= 0.0f) radarBlips.RemoveAt(i);
}
float radius = (GuiFrame.Rect.Height / 2 - 30);
if (IsActive)
{
float pingRadius = displayRadius * pingState;
+6 -25
View File
@@ -262,13 +262,7 @@ namespace Barotrauma
{
get { return prefab.ConfigFile; }
}
public bool Removed
{
get;
private set;
}
//which type of inventory slots (head, torso, any, etc) the item can be placed in
public List<InvSlotType> AllowedSlots
{
@@ -278,16 +272,7 @@ namespace Barotrauma
return (p==null) ? new List<InvSlotType>() { InvSlotType.Any } : p.AllowedSlots;
}
}
public int Capacity
{
get
{
ItemContainer c = GetComponent<ItemContainer>();
return (c == null) ? 0 : c.Capacity;
}
}
public List<Connection> Connections
{
get
@@ -570,11 +555,11 @@ namespace Barotrauma
{
if (parentInventory.Owner is Character)
{
CurrentHull = (parentInventory.Owner as Character).AnimController.CurrentHull;
CurrentHull = ((Character)parentInventory.Owner).AnimController.CurrentHull;
}
else if (parentInventory.Owner is Item)
{
CurrentHull = (parentInventory.Owner as Item).CurrentHull;
CurrentHull = ((Item)parentInventory.Owner).CurrentHull;
}
Submarine = parentInventory.Owner.Submarine;
@@ -2306,9 +2291,7 @@ namespace Barotrauma
public override void ShallowRemove()
{
base.ShallowRemove();
Removed = true;
foreach (ItemComponent ic in components)
{
ic.ShallowRemove();
@@ -2325,9 +2308,7 @@ namespace Barotrauma
public override void Remove()
{
base.Remove();
Removed = true;
if (parentInventory != null)
{
parentInventory.RemoveItem(this);