Fixed removed (e.g. eaten) characters not appearing in the round summary, but still spawning during the next round

This commit is contained in:
Joonas Rikkonen
2017-10-05 21:18:01 +03:00
parent a740bf9a56
commit 57667b3169
6 changed files with 30 additions and 21 deletions

View File

@@ -308,10 +308,13 @@ namespace Barotrauma
continue;
}
CharacterInfo deadInfo = CharacterInfos.Find(x => c.Info == x);
if (deadInfo != null) CharacterInfos.Remove(deadInfo);
CharacterInfos.Remove(c.Info);
}
//remove characterinfos whose character doesn't exist anymore
//(i.e. character was removed during the round)
CharacterInfos.RemoveAll(c => c.Character == null);
characters.Clear();
listBox.ClearChildren();
orderListBox.ClearChildren();

View File

@@ -240,6 +240,8 @@ namespace Barotrauma
}
Submarine.Unload();
GameMain.LobbyScreen.Select();
}
private bool TryEndRound(GUIButton button, object obj)

View File

@@ -59,10 +59,10 @@ namespace Barotrauma
GUIListBox listBox = new GUIListBox(new Rectangle(0,y,0,90), null, Alignment.TopLeft, "", innerFrame, true);
int x = 0;
foreach (Character character in gameSession.CrewManager.characters)
foreach (CharacterInfo characterInfo in gameSession.CrewManager.CharacterInfos)
{
if (GameMain.GameSession.Mission is CombatMission &&
character.TeamID != GameMain.GameSession.CrewManager.WinningTeam)
if (GameMain.GameSession.Mission is CombatMission &&
characterInfo.TeamID != GameMain.GameSession.CrewManager.WinningTeam)
{
continue;
}
@@ -72,15 +72,16 @@ namespace Barotrauma
characterFrame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
characterFrame.CanBeFocused = false;
character.Info.CreateCharacterFrame(characterFrame,
character.Info.Job != null ? (character.Info.Name + '\n' + "(" + character.Info.Job.Name + ")") : character.Info.Name, null);
characterInfo.CreateCharacterFrame(characterFrame,
characterInfo.Job != null ? (characterInfo.Name + '\n' + "(" + characterInfo.Job.Name + ")") : characterInfo.Name, null);
string statusText = "OK";
Color statusColor = Color.DarkGreen;
if (character.IsDead)
Character character = characterInfo.Character;
if (character == null || character.IsDead)
{
statusText = InfoTextManager.GetInfoText("CauseOfDeath." + character.CauseOfDeath.ToString());
statusText = InfoTextManager.GetInfoText("CauseOfDeath." + characterInfo.CauseOfDeath.ToString());
statusColor = Color.DarkRed;
}
else

View File

@@ -72,7 +72,16 @@ namespace Barotrauma
private Item selectedConstruction;
private Item[] selectedItems;
public byte TeamID = 0;
private byte teamID;
public byte TeamID
{
get { return teamID; }
set
{
teamID = value;
if (info != null) info.TeamID = value;
}
}
public AnimController AnimController;
@@ -1706,6 +1715,7 @@ namespace Barotrauma
isDead = true;
this.causeOfDeath = causeOfDeath;
if (info != null) info.CauseOfDeath = causeOfDeath;
AnimController.movement = Vector2.Zero;
AnimController.TargetMovement = Vector2.Zero;

View File

@@ -34,6 +34,10 @@ namespace Barotrauma
public bool StartItemsGiven;
public CauseOfDeath CauseOfDeath;
public byte TeamID;
public List<ushort> PickedItemIDs
{
get { return pickedItems; }

View File

@@ -232,17 +232,6 @@ namespace Barotrauma
{
if (Mission != null) Mission.End();
if (GameMain.Server != null)
{
//CoroutineManager.StartCoroutine(GameMain.Server.EndGame(endMessage));
}
else if (GameMain.Client == null)
{
//Submarine.Unload();
GameMain.LobbyScreen.Select();
}
#if CLIENT
if (roundSummary != null)
{