Skip to content

Commit

Permalink
Fix deck loading bug
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmfinol committed Jul 8, 2024
1 parent aeb8988 commit cc7ff5c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Assets/Scripts/FinolDigital.Cgs.CardGameDef.Unity/UnityDeck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,16 @@ private void LoadTxt(string line)
tokens.RemoveAt(0);
}

if (tokens.Count > 0 && tokens[^1].StartsWith("(") &&
tokens[^1].EndsWith(")"))
if (tokens.Count > 0 && line.Contains("(") && line.EndsWith(")"))
{
var inParens = tokens[^1].Substring(1, tokens[^1].Length - 2);
var indexOfParens = line.LastIndexOf("(", StringComparison.Ordinal);
var inParens = line.Substring(indexOfParens + 1, line.Length - (indexOfParens + 2));
if (((UnityCardGame) SourceGame).Sets.ContainsKey(inParens))
{
cardSet = inParens;
tokens.RemoveAt(tokens.Count - 1);
var cardSetTokenCount = cardSet.Count(f => f == ' ') + 1;
for (var i = 0; i < cardSetTokenCount; i++)
tokens.RemoveAt(tokens.Count - 1);
}
}

Expand Down

0 comments on commit cc7ff5c

Please sign in to comment.