Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upOption to yell sentences #21495
Conversation
BrettDong
reviewed
Jul 27, 2017
| available[nmenu.ret]->talk_to_u(); | ||
| } else { | ||
| return; |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I can see this being amusing. |
Leland
reviewed
Jul 27, 2017
| @@ -10872,24 +10872,45 @@ void game::chat() | |||
| } | |||
|
|
|||
| uimenu nmenu; | |||
| nmenu.text = std::string( _("Who do you want to talk to?") ); | |||
|
|
|||
| nmenu.text = std::string( _( "Who do you want to talk to or yell?" ) ); | |||
This comment has been minimized.
This comment has been minimized.
Leland
Jul 27, 2017
Contributor
Should be: "Who do you want to talk to or yell at?"
Otherwise, this reads (without the first clause): "Who do you want to yell?"
This comment has been minimized.
This comment has been minimized.
Leland
Jul 27, 2017
Contributor
I haven't checked what the actual UI looks like, but you may not even need to add the "Yell" clause to this.
This comment has been minimized.
This comment has been minimized.
AlecWhite
Jul 27, 2017
Author
Contributor
That text is displayed whether there are NPCs or not, we could add a check to it, but it would automagically tell the player if there are NPCs around.
codemime
reviewed
Aug 2, 2017
|
|
||
| nmenu.addentry( yell = i++, true, 'a', _( "Yell" ) ); | ||
| nmenu.addentry( yell_sentence = i++, true, 'b', _( "Yell a sentence" ) ); | ||
| nmenu.addentry( cancel = i++, true, 'q', _( "Cancel" ) ); |
This comment has been minimized.
This comment has been minimized.
codemime
Aug 2, 2017
Member
Since you've touched this line, could you remove it and update the condition below (see #12112)?
This comment has been minimized.
This comment has been minimized.
AlecWhite
Aug 3, 2017
Author
Contributor
I'm sorry, but I don't know exactly what you want me to do, mind explaining it please?
This comment has been minimized.
This comment has been minimized.
codemime
Aug 3, 2017
Member
Most of our menus are escapable i.e. they can be closed using Esc button, which makes options like "Cancel" redundant. You can simply remove it to make this particular menu more consistent with the others.
codemime
reviewed
Aug 2, 2017
|
|
||
| int yell, yell_sentence, cancel; | ||
|
|
||
| nmenu.addentry( yell = i++, true, 'a', _( "Yell" ) ); |
This comment has been minimized.
This comment has been minimized.
codemime
Aug 2, 2017
Member
This kind of assignment is ugly and confusing. An enum could have been used here.
This comment has been minimized.
This comment has been minimized.
AlecWhite
Aug 3, 2017
Author
Contributor
I googled around if you can assign an enum's value can be assigned when called, and it seems that they are constant expression. So I don't know how enums can be used in this case.
I could comment more all the code, to it is at least less confusing, but between that I'm a noob at programming and that this method didn't have much comments, I don't really know when to comment and how much to comment.
This comment has been minimized.
This comment has been minimized.
codemime
Aug 3, 2017
Member
and it seems that they are constant expression.
They certainly are. I meant getting rid of any assignments entirely. See this function as a good example of what I'm talking about. You can use negative values to avoid overlapping with indexes of NPCs:
enum class choices {
just_yell = INT_MIN,
yell_something,
...
};
This comment has been minimized.
This comment has been minimized.
AlecWhite
Aug 4, 2017
Author
Contributor
Using enum class doesn't seems to work (had to I cast it to int for ui.addentry() to accept it) which for some reason it takes it as zero and one. Using non-class enums works only for the first enum but not for the second as it is taken as 1.
I'm manually assigning them both to -2 and -1 respectively. And it seems that the addentry() and query() both seems to support negative integers.
Any advise?
This comment has been minimized.
This comment has been minimized.
BevapDin
Aug 6, 2017
Contributor
Are negative numbers sorted after non-negative by the game's engine? If no, what you propose won't work.
There is no sorting done by the "game engine" (what do you actually mean with that?) at all. The menu displays the options in the order they have been added (actually: the order in which they appear in uimenu::entries).
AlecWhite commentedJul 27, 2017
•
edited
Asked around in the IRC channel and Discord server if people would like to be able to yell sentence for the role-playing flavour, and they liked it so I decided to make this.
Now you can yell whatever you want at the moose.
Had to re-made the if/else which I don't know if I did it right, so I could use some help reviewing that part please.
Also I couldn't decided on how to display the yelled sentence, if either after colon, if forced upper case or between quotation marks. So I left it without any kind of fancy styling.