Skip to content

Pickable/included civs + a few bugs#918

Open
stavrosfa wants to merge 1 commit intoC7-Game:Developmentfrom
stavrosfa:feature/pickable-playable
Open

Pickable/included civs + a few bugs#918
stavrosfa wants to merge 1 commit intoC7-Game:Developmentfrom
stavrosfa:feature/pickable-playable

Conversation

@stavrosfa
Copy link
Contributor

This PR's details in short:

Implemented pickable and included-in-game civs
Fix bug in .biq and .sav files where we would assign barbarians to another civ.
Added barb camp tiles for .sav and .biq
Fix bug when loading a .sav to assign the correct civ color

The camps and colors could have been added separately, but trey arerather minor changes, and since I already had some tests in place to also test them, I though I might as well include them here.

These are some features/fixes that I choose to introduce at this point, because I was working on something else entirely, but my unit tests kept breaking. The main reason was the Mongols being included as a playable player in the Middle Ages scenario (which they are not), which we weren't really accounting for, causing numerous issues.

Fix bug in .biq and .sav files where we would assign barbarians to another civ.
Added barb camp tiles for .sav and .biq
Fix bug when loading a .sav to assign the correct civ color
// It's easier to do it like this, otherwise we need to manipulate the biq arrays,
// to check for playable players, offset array indexes by the difference, etc,
// as we are parsing the file, which is 10 times the hassle compared to this approach
for (int p = save.Players.Count - 1; p >= 0; --p) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SUGGESTION] There's probably a nice LINQ way to implement this loop. Modifying a collection you are iterating over is always a bit sketchy. I'd set the barbarians unpickable in a separate statement.

Copy link
Contributor

@ajhalme ajhalme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. I might have gone for 'playable' over 'pickable', but maybe the latter is more explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants