Skip to content

adding hero button to wagon and other recruit objects#5507

Open
shprotru wants to merge 12 commits intoihhub:masterfrom
shprotru:wagon_army_join
Open

adding hero button to wagon and other recruit objects#5507
shprotru wants to merge 12 commits intoihhub:masterfrom
shprotru:wagon_army_join

Conversation

@shprotru
Copy link
Contributor

@shprotru shprotru commented Jun 6, 2022

fheroes2 brings enhancement to dismiss troops while someone is recruiting, but it doesn't work everywhere.

before:
Снимок экрана от 2022-06-06 10-59-34

after:
Снимок экрана от 2022-06-06 13-16-16

related issue: #5249

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ clang-tidy found issue(s) with the introduced code (1/1)

@oleg-derevenetz oleg-derevenetz added improvement New feature, request or improvement ui UI/GUI related stuff labels Jun 6, 2022
@oleg-derevenetz oleg-derevenetz added this to the 0.9.16 milestone Jun 6, 2022
@zenseii
Copy link
Collaborator

zenseii commented Jun 9, 2022

Hi @shprotru!

The warnings have to do with the fact that you need to use the fheroes2::Text specific functions/methods now that you are using that instead of class Text.

Take this example from the warnings:

text.Blit( pos.x + 320 - text.w() / 2, pos.y + 64 );

fheroes2::Text doesn't have a Blit member function so you need to call its respective draw function. In addition that function takes the additional parameter Image &. You'll also notice that fheroes2::Text has its width function named as width instead of just w. The same goes for h and height. Last but not least, the new fheroes2::Text shifts the text up by 2 pixels compared to the old Text which means we need to move down two pixels and therefore add 2 pixels in the Y position parameter. In the above example this gives us this change:

text.draw( pos.x + 320 - text.width() / 2, pos.y + 66, display );

@shprotru shprotru requested a review from zenseii June 9, 2022 22:14
Copy link
Collaborator

@zenseii zenseii left a comment

Choose a reason for hiding this comment

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

Hi @shprotru !

I just tested this and would it be possible to add this for dwellings that give you creatures for free too? Like the Peasant hut, fearie trees etc. ?
image

Also we have a slightly similar issue regarding creatures that join you due to alliances like dwarves and dragons. This would require a bit more work though since some extra dialog logic needs to be added if you read the discussion in that issue #5249 .

If you want to go ahead and add that too but need some clarification then don't hesitate to ask either me or the other members that contributed to that issue's discussion.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ clang-tidy found issue(s) with the introduced code (1/1)

Copy link
Collaborator

@zenseii zenseii left a comment

Choose a reason for hiding this comment

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

Hi @shprotru ! I left one comment. Please take a look when you should have the time 😊

if ( Dialog::YES == Dialog::Message( title, message, Font::BIG, Dialog::YES | Dialog::NO ) ) {
if ( Dialog::YES == Dialog::ArmyJoinFree( title, message, troop, hero ) ) {
if ( !hero.GetArmy().CanJoinTroop( troop ) )
Dialog::Message( troop.GetName(), _( "You are unable to recruit at this time, your ranks are full." ), Font::BIG, Dialog::OK );
Copy link
Collaborator

Choose a reason for hiding this comment

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

Right now there is no way to make this message about ranks being full appear since you cannot press "Yes":
image.

I suggest to remove this message and make the else statement further down the default action for this dialog. What do you think?

AudioManager::PlaySound( M82::EXPERNCE );

if ( Dialog::YES == Dialog::ArmyJoinFree( title, message, troop, hero ) ) {
if ( Dialog::YES == Dialog::Message( title, message, Font::BIG, Dialog::YES | Dialog::NO ) ) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I didn't ask if you could revert this change, but the logic needs to reflect that the message will not appear anymore.
The code I'm asking for would be something like this.

if ( Dialog::YES == Dialog::ArmyJoinFree( title, message, troop, hero ) ) {
                tile.MonsterSetCount( 0 );
                hero.GetArmy().JoinTroop( troop );
                hero.MovePointsScaleFixed();
                Interface::Basic::Get().GetStatusWindow().SetRedraw();
}

What do you think?

@ihhub ihhub modified the milestones: 0.9.16, 0.9.17 Jun 12, 2022
@ihhub
Copy link
Owner

ihhub commented Jun 14, 2022

Hi @shprotru , before proceeding with the review could you please explain why we need this feature if a player can easily hit a Space button one more time? I think we have similar discussion here.

Enhancements are good but we need to be cautious about them and not overuse them. I would say that in cases when a hero cannot repeat the same action they might help to improve user experience.

Let's do this way: we listen the opinion of @oleg-derevenetz , @Branikolog , @oleg-derevenetz , @zenseii and @idshibanov about this enhancement and then decide what we want to do.

Remember: look at this enhancement with closed eyes on similar buttons in other dialogs and question whether it is useful to have it.

@zenseii
Copy link
Collaborator

zenseii commented Jun 14, 2022

Hi @ everyone in this PR 😅

I've been thinking a bit about this PR after @oleg-derevenetz's point that he made in another issue about adding the marketplace button. To summarize I believe we should only introduce such buttons to the dialogs if these dialogs cannot be exited and reentered again. Existing examples of these are level up, creature joining/"followers" etc.

That's why when it comes to the dialogs covered by this PR, which are the dwelling dialogs, I do not think we need the added button because the player can simply exit and reenter with the space bar after having made necessary changes (or just make them before entering).

@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Jun 14, 2022

Let's do this way: we listen the opinion of @oleg-derevenetz , @Branikolog , @oleg-derevenetz , @zenseii and @idshibanov about this enhancement and then decide what we want to do.

I believe that if the same action can be repeated later using spacebar, then there is no need to add a shortcut for it - it just clutters up the UI.

@Branikolog
Copy link
Collaborator

Hi, everyone.

In my personal point of view, we can add here this button, since this window 99% is the same to common joining window:
image
We can modify text here, as @zenseii proposed.
We can use a part of text from the next window, appearing after player accepts. Something like: "Your ranks are full, so you cannot join new troops" and add it under the question. So, the next window (You are unable to recruit at this time, your ranks are full.`) will never appear anymore.

@ihhub ihhub modified the milestones: 0.9.17, 0.9.18 Jul 11, 2022
@ihhub ihhub modified the milestones: 0.9.18, 0.9.19 Aug 10, 2022
@ihhub ihhub modified the milestones: 0.9.19, 0.9.20 Sep 11, 2022
@ihhub ihhub modified the milestones: 0.9.20, 0.9.21 Oct 10, 2022
@ihhub ihhub modified the milestones: 0.9.21, 1.0 Nov 12, 2022
@ihhub ihhub modified the milestones: 1.0, 1.0.1 Dec 19, 2022
@ihhub ihhub modified the milestones: 1.0.1, 1.0.2 Feb 8, 2023
@ihhub ihhub modified the milestones: 1.0.2, Beyond 1.0 Mar 11, 2023
@AAS
Copy link

AAS commented Nov 9, 2025

Guys, could you please just merge it as is?
It is 3+ years old now :(

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

Labels

improvement New feature, request or improvement ui UI/GUI related stuff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Comments