-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Toggle between the map and look around #76433
Merged
Maleclypse
merged 3 commits into
CleverRaven:master
from
Brambor:toggle-map-look-around
Sep 16, 2024
Merged
Toggle between the map and look around #76433
Maleclypse
merged 3 commits into
CleverRaven:master
from
Brambor:toggle-map-look-around
Sep 16, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
<Documentation>
Design documents, internal info, guides and help.
Info / User Interface
Game - player communication, menus, etc.
[JSON]
Changes (can be) made in JSON
Map / Mapgen
Overmap, Mapgen, Map extras, Map display
[C++]
Changes (can be) made in C++. Previously named `Code`
[Markdown]
Markdown issues and PRs
<Bugfix>
This is a fix for a bug (or closes open issue)
astyled
astyled PR, label is assigned by github actions
json-styled
JSON lint passed, label assigned by github actions
labels
Sep 14, 2024
Brambor
force-pushed
the
toggle-map-look-around
branch
from
September 14, 2024 18:39
510b79d
to
b92134a
Compare
I decided to move I finally learned to mark it as a draft in time, because somebody would sneakily merge it otherwise. Edit: done! |
Noticed this PR was similar to a suggestion I made a while back as well, just putting this here to link it #70072. Thanks for adding this! |
Brambor
force-pushed
the
toggle-map-look-around
branch
from
September 14, 2024 23:28
b92134a
to
4396c3d
Compare
github-actions
bot
added
the
BasicBuildPassed
This PR builds correctly, label assigned by github actions
label
Sep 14, 2024
Brambor
force-pushed
the
toggle-map-look-around
branch
from
September 15, 2024 12:13
4396c3d
to
b2c8b6f
Compare
I will change the implementation a bit yet again so that AIM can use it too. |
Brambor
force-pushed
the
toggle-map-look-around
branch
from
September 15, 2024 15:19
b2c8b6f
to
e65c14e
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
astyled
astyled PR, label is assigned by github actions
BasicBuildPassed
This PR builds correctly, label assigned by github actions
<Bugfix>
This is a fix for a bug (or closes open issue)
[C++]
Changes (can be) made in C++. Previously named `Code`
<Documentation>
Design documents, internal info, guides and help.
Info / User Interface
Game - player communication, menus, etc.
[JSON]
Changes (can be) made in JSON
json-styled
JSON lint passed, label assigned by github actions
Map / Mapgen
Overmap, Mapgen, Map extras, Map display
[Markdown]
Markdown issues and PRs
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Interface "Toggle between the map and look around"
Purpose of change
Describe the solution
Add
uistate.open_menu
. It stores a function to be executed in the main loop. It is used to open a menu with arguments. Unlike ACTIONS arguments can be passed. Unlike ACTIVITY it doesn't take a turn for the player.This is utilized to remember the position of look around/map when toggling to the other one. It can be used in more places, such as:
view recipe
works only once per opened Advanced Inventory #62996, which currently takes a turn. I plan to do that next.Describe alternatives you've considered
PutDone.avatar.open_menu
somewhere else than intoavatar
. Could be in thegame
. I think of it as an ACTIVITY/ACTION, so I preferavatar
overgame
.Creature
/Character
cannot have it, onlyavatar
can. But maybe it belongs to someuistate
or how was it called.Don't use (and therefore implement)
uistate.open_menu
, but simply call the look_around from map directly (and vice versa). This approach would grow on the stack as the player would toggle from one to the other. The stack would then need to be collapsed again when the player finally closes look_around or map. The closing would require additional cleanup or maybe justaction = "QUIT"; break;
.The function calls on the stack provide no additional benefit. The variables stored there aren't needed and therefore are confusing. A stack overflow error could also occur. This is why I decided on the
uistate.open_menu
which doesn't grow the stack at all and only useful variables are passed and remembered.Opening map is forbidden (If I did it correctly) when working with zones. This is to prevent what you can see in Bug below.
Testing
Usecase from
Cataclysm_.Dark.Days.Ahead.-.0.G-12112-g67067d0465-dirty.2024-09-14.19-45-03.mp4
Bug
When long-range teleporting, the player can do
;;
(Look around, View map). This returns an invalid point to the teleport, so the teleport doesn't happen. In this case, "Look around" should be forbidden. I don't know how to do that without additional parameterbool forbid_open_map
tolook_around
. So I didn't do it.Additional context