Skip to content

Implementing hero battle window #222

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

Merged
merged 4 commits into from
Sep 28, 2016

Conversation

dydzio0614
Copy link
Member

Right click on hero during battle works like in original H3 now, though cursor doesn't change properly when hovering mouse over hero sprite.

Copy link
Member

@ArseniyShestakov ArseniyShestakov left a comment

Choose a reason for hiding this comment

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

All good, but you accidentally include revert of changes I made in rumors code. So please rebase code without these changes.

Allow to check battle enemy hero details + adding max spell points to available data
@ArseniyShestakov
Copy link
Member

Btw I agree with @DjWarmonger that we don't want to leak maximal mana outside of battle.
As far as I understand on adventure map there is no information about that even with expert visions spell.

@@ -273,6 +273,16 @@ bool CGameInfoCallback::getHeroInfo(const CGObjectInstance * hero, InfoAboutHero

bool accessFlag = hasAccess(h->tempOwner);

if (!accessFlag && gs->curB) //if it's battle we can get enemy hero full data
Copy link
Member

@ArseniyShestakov ArseniyShestakov Sep 28, 2016

Choose a reason for hiding this comment

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

Fact that some battle is going is not enough to provide info like that.

What I think would even better is to move this check into CBattleInfoEssentials callback and name it like "CBattleInfoEssentials::playerHasAccessToHeroInfo".

Then in this case it's would be:
if (!accessFlag && gs->curB)
accessFlag = gs->curB->playerHasAccessToHeroInfo(player, h);

@@ -282,6 +292,9 @@ bool CGameInfoCallback::getHeroInfo(const CGObjectInstance * hero, InfoAboutHero

dest.initFromHero(h, accessFlag);

if (accessFlag && !gs->curB)
dest.details->manaLimit = -1; //we do not want to leak max mana info outside battle so set to meaningless value
Copy link
Member

Choose a reason for hiding this comment

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

This is of course not how something like that have to be implemented.
Instead you need extend InfoAboutHero's "detailed" bool and probably replace it with enum like:
EInfoLevel: BASIC, DETAILED, INBATTLE

This would let us extend info level if sometimes in future we'll have more things depend on it.

@dydzio0614
Copy link
Member Author

dydzio0614 commented Sep 28, 2016

Changed as requested, though now there might be some code related to getting hero info that does not have to be called during battles. Disguise spell check is an example.

@DjWarmonger DjWarmonger merged commit e77d408 into vcmi:develop Sep 28, 2016
@dydzio0614 dydzio0614 deleted the HeroBattleWindow branch September 30, 2016 11:57
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.

3 participants