Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update secondary skill handling. Fix issue 2307 #219

Merged
merged 2 commits into from Sep 20, 2016

Conversation

dydzio0614
Copy link
Member

Also making secondary skill icon display behavior same as in H3 during popup message.

Also making secondary skill icon display behavior same as in H3 during popup message.
Copy link
Member

@DjWarmonger DjWarmonger left a comment

Choose a reason for hiding this comment

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

Code style could be better. auto type will make things cleaner.

@@ -68,32 +68,51 @@ void CGPandoraBox::giveContentsUpToExp(const CGHeroInstance *h) const

if(gainedExp || changesPrimSkill || abilities.size())
{
std::vector<SecondarySkill> unpossessedAbilities;
Copy link
Member

Choose a reason for hiding this comment

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

I suggest std::pair<Secondary Skill, int>

int abilitiesRequiringSlot = 0;

//filter out unnecessary secondary skills
for (int i = 0; i < abilities.size(); i++)
Copy link
Member

Choose a reason for hiding this comment

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

use auto

iw.components.push_back(Component(Component::SEC_SKILL,abilities[i],abilityLevels[i],0));

cb->showInfoDialog(&iw);
for(int i=0; i<unpossessedAbilities.size(); i++)
Copy link
Member

Choose a reason for hiding this comment

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

same - auto will give shorter code

@ArseniyShestakov
Copy link
Member

@DjWarmonger can you please clarify how exactly you expect to use auto in that case?

He actually use "i" to access multiple different vectors and this looks like reasonable approach to me if we don't want to change object serialization.

@ArseniyShestakov
Copy link
Member

Ok I got it. It's actually possible to use auto some of loops if he won't duplicate object properites structure there and just use std::pair. Agree on it.

@DjWarmonger
Copy link
Member

Thank you very much :)

@DjWarmonger DjWarmonger merged commit 8a1b22c into vcmi:develop Sep 20, 2016
@dydzio0614 dydzio0614 deleted the patch-2 branch September 20, 2016 16:21
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.

None yet

3 participants