-
Notifications
You must be signed in to change notification settings - Fork 541
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
Conversation
There was a problem hiding this 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
b4de41c
to
f621ef4
Compare
Btw I agree with @DjWarmonger that we don't want to leak maximal mana outside of battle. |
@@ -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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
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. |
Right click on hero during battle works like in original H3 now, though cursor doesn't change properly when hovering mouse over hero sprite.