Skip to content
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

Implement selective auto note preferences and a manager GUI to modify them #33560

Merged
merged 22 commits into from
Aug 31, 2019
Merged

Implement selective auto note preferences and a manager GUI to modify them #33560

merged 22 commits into from
Aug 31, 2019

Conversation

nshcat
Copy link
Contributor

@nshcat nshcat commented Aug 26, 2019

Summary

SUMMARY: Interface "Implement selective auto note preferences and a manager GUI to modify them"

Purpose of change

This adresses issue #33483. The game contains a "auto note" feature, which, if enabled, will automatically add notes to the overmap if map extras are encountered. One quality of life problem with this is, that whether a specific map extra type will receive such an auto note is determined by a JSON flag (called autonote), which requires modding to change. But it is common in a single CDDA run to want to change these preferences - i.e. a group of college kids might be interesting in the early game, but not so much in the late game.

Describe the solution

This pull request implements a configuration system which manages auto note preferences on a per-character basis and such allows players to decide for which types of map extras they want to enable auto notes - and for which they don't.

Additionally, a settings manager GUI is implemented, which allows the user to modify the current auto notes configuration state and is placed next to the auto pickup manager in the main menu:

gui

main

Describe alternatives you've considered

One could say that also allowing these settings to be stored as a global configuration would be sensitive, but as explained in the introduction it has come to my attention that the decision which auto notes to activate seems to be a very fluid decision, which depends on the particular game stage a character is in. That's why I made the decision to keep the setting on a per-character basis.

Additional context

A few implementation details:

  • The data is saved as part of the player save, in an auxiliary JSON file with the suffix .ano.json.
  • If such data is not yet present, the subsystem collects all loaded map extras that have the JSON flag autonote already set to true and uses these to build an initial configuration. This is done in order to retain the "status quo" behaviour if the user does not change the settings.
  • The autonote JSON flag is still a hard disable - map extra types with this flag set to false are completely disregared by the auto note manager GUI and are not displayed to the user. This stops "internal" extra types such as "Nothing" from being displayed.
  • If the map extra subsytem wants to create an auto note, it is first checked if the user allowed this for the particular map extra type at hand, and if not, cancels the operation.

Since this is my first major code change, I would appreciate review of this. Thanks!

@Night-Pryanik
Copy link
Contributor

While I like the idea, I feel this is a big spoiler for new players. How about adding the toggle to turn specific map extra on and off only after first encounter of this map extra? So right after the game start the list of map extras will be empty and will be filling through the course of the game.

@nshcat
Copy link
Contributor Author

nshcat commented Aug 26, 2019

I can implement that, thanks for the input :)

@ZhilkinSerg ZhilkinSerg added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. Map / Mapgen Overmap, Mapgen, Map extras, Map display [JSON] Changes (can be) made in JSON labels Aug 26, 2019
@ZhilkinSerg
Copy link
Contributor

I suggest moving ladder auto-notes to new dedicated menu out of options menu too.

@nshcat
Copy link
Contributor Author

nshcat commented Aug 26, 2019

@Night-Pryanik Thank you for your feedback. I implemented exactly what you asked for.

Here is how the GUI looks on a fresh character that has not discovered any extras yet:
2019-08-26-130414_695x422_scrot

Here is how it looks after a few extras have been discovered:
2019-08-26-130525_669x407_scrot

This PR should now be a spoiler-free experience! :D

@AMurkin
Copy link
Contributor

AMurkin commented Aug 26, 2019

You don't need all these this-> and a round braces in the ternary operator.

src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.h Outdated Show resolved Hide resolved
src/auto_note.h Outdated Show resolved Hide resolved
@nshcat
Copy link
Contributor Author

nshcat commented Aug 26, 2019

Thanks again, changes applied.

@AMurkin
Copy link
Contributor

AMurkin commented Aug 27, 2019

Use // NOLINTNEXTLINE(cata-use-named-point-constants) instead of the point_east please.
Ref #33225.

src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
src/auto_note.cpp Outdated Show resolved Hide resolved
@nshcat
Copy link
Contributor Author

nshcat commented Aug 28, 2019

All resolved, thanks for the reviews people.

@ZhilkinSerg ZhilkinSerg self-assigned this Aug 30, 2019
@ZhilkinSerg ZhilkinSerg merged commit 4b90ec9 into CleverRaven:master Aug 31, 2019
@ZhilkinSerg
Copy link
Contributor

I would like to see some improvements later, but this PR was already big, so merging it as it is:

  1. Obsolete auto-notes options completely and move them out of settings menu to auto-note manager.
  2. On savegame loading parse existing map extras known to character and fill the list of known extras accordingly.

@ZhilkinSerg ZhilkinSerg removed their assignment Aug 31, 2019
@nshcat nshcat deleted the AutoNoteManager branch August 31, 2019 05:32
@nshcat
Copy link
Contributor Author

nshcat commented Sep 1, 2019

@ZhilkinSerg Regarding the improvements you stated: Does "obsolete auto-notes options completely" mean that they should also be stored on a per-character basis, or just the removal from the option menu?

@ZhilkinSerg
Copy link
Contributor

Personally I believe they should be character based, but there are can be different approaches.

misterprimus pushed a commit to misterprimus/Cataclysm-DDA that referenced this pull request Sep 21, 2019
… them (CleverRaven#33560)

* Implemented basic auto note settings holder

* Implemented access to map extras factory, as well as member functions that use string_id<T>

* Added keybindings for actions from auto notes manager

* Part of auto notes manager implementation

* Finished auto note manager gui implementation

* Modified map extra subsystem to respect the auto note settings

* Applied astyle fixes

* Implemented spoiler-free GUI experience

* Changed to make CI clang-tidy shut up

* Removed some left-over debug messages.

* Try to shut up "unused result" warning, lets see if this works

* Second try to fix CI build§

* Applied most of code review suggestions

* More code review changes

* Fixed missing reference

* Astyle

* Disabled clang-tidy linting on two lines

* More review changes

* clang-tidy related fixes

* Apply suggestions from code review

Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>

* Changed map extras to special encounters

* Reverted replacing point with point_east
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Info / User Interface Game - player communication, menus, etc. [JSON] Changes (can be) made in JSON Map / Mapgen Overmap, Mapgen, Map extras, Map display
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants