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

JSONify weariness text widget #55081

Closed
wants to merge 8 commits into from

Conversation

wapcaplet
Copy link
Contributor

@wapcaplet wapcaplet commented Feb 4, 2022

Summary

Features "JSONify weariness text widget"

Purpose of change

Contribute to #55076

Describe the solution

  • Add a get_weariness_level wrapper to the talker and talker_character classes used by conditions, and a u_val for weariness_level.
  • Add a widget using "clauses" to show weariness text based on weariness level condition.
  • Add test case for weariness level number and some clauses
  • Remove weariness_text widget variable

Describe alternatives you've considered

We'll want to remove the display::weariness_text_color functions after all the classic/legacy sidebars are replaced with widget versions in #54191 and its follow-ups, but I am leaving them in place for now.

Testing

Get a shovel and dig some holes to get tired. See the widget change.

Additional context

Don't mind the misleading branch name in this PR; I started out thinking I would do weight first, but did weariness instead and forgot to rename it.

@wapcaplet wapcaplet changed the title Convert weight_text widget to use conditional clauses Convert weariness_text widget to use conditional clauses Feb 4, 2022
@wapcaplet wapcaplet added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Info / User Interface Game - player communication, menus, etc. labels Feb 4, 2022
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Feb 4, 2022
@wapcaplet wapcaplet changed the title Convert weariness_text widget to use conditional clauses JSONify weariness_text widget Feb 5, 2022
@wapcaplet wapcaplet changed the title JSONify weariness_text widget JSONify weariness text widget Feb 5, 2022
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Feb 5, 2022
@wapcaplet wapcaplet force-pushed the w-clause-weight branch 2 times, most recently from e612837 to 847af9d Compare February 6, 2022 16:42
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Feb 6, 2022
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Feb 8, 2022
@dseguin
Copy link
Member

dseguin commented Feb 12, 2022

I just noticed the recent commits trying to fix the clang-tidy error. I think the reason for the confusion is that dig_activity_actor and activity_schedule are not string_id's, so they should probably be separated like:

diff --git a/tests/widget_test.cpp b/tests/widget_test.cpp
index 3e53ce5fc0..6e561e5231 100644
--- a/tests/widget_test.cpp
+++ b/tests/widget_test.cpp
@@ -34,8 +34,7 @@ namespace cata_curses_test
 #include "cursesport.h"
 #endif
 
-static const int move_25h = to_seconds<int>( 25_hours ) * 100;
-static const dig_activity_actor dig_actor( move_25h, tripoint_zero, "t_pit", tripoint_zero, 0, "" );
+// ------------- String IDs -------------
 
 static const activity_id ACT_PLANT_SEED( "ACT_PLANT_SEED" );
 
@@ -54,9 +53,6 @@ static const efftype_id effect_hunger_starving( "hunger_starving" );
 static const efftype_id effect_hunger_very_hungry( "hunger_very_hungry" );
 static const efftype_id effect_infected( "infected" );
 
-static const activity_schedule task_dig( dig_actor, 5_minutes );
-static const activity_schedule task_plant( ACT_PLANT_SEED, 5_minutes );
-
 static const flag_id json_flag_SPLINT( "SPLINT" );
 
 static const itype_id itype_blindfold( "blindfold" );
@@ -138,6 +134,14 @@ static const widget_id widget_test_weather_text_height5( "test_weather_text_heig
 static const widget_id widget_test_weight_clauses_fun( "test_weight_clauses_fun" );
 static const widget_id widget_test_weight_clauses_normal( "test_weight_clauses_normal" );
 
+// ------------- Not string IDs -------------
+
+static const int move_25h = to_seconds<int>( 25_hours ) * 100;
+static const dig_activity_actor dig_actor( move_25h, tripoint_zero, "t_pit", tripoint_zero, 0, "" );
+
+static const activity_schedule task_dig( dig_actor, 5_minutes );
+static const activity_schedule task_plant( ACT_PLANT_SEED, 5_minutes );
+
 // dseguin 2022 - Ugly hack to scrape content from the window object.
 // Scrapes the window w at origin, reading the number of cols and rows.
 static std::vector<std::string> scrape_win_at(

Hopefully that fixes it :P

@stale
Copy link

stale bot commented Mar 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not 'bump' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

@stale stale bot added the stale Closed for lack of activity, but still valid. label Mar 30, 2022
@stale stale bot removed the stale Closed for lack of activity, but still valid. label Apr 9, 2022
@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. Code: Tests Measurement, self-control, statistics, balancing. Mods Issues related to mods or modding <Enhancement / Feature> New features, or enhancements on existing stale Closed for lack of activity, but still valid. labels Apr 9, 2022
@Maleclypse
Copy link
Member

I noticed all the tasks are listed complete but it's still in draft. Is that correct?

@stale stale bot removed the stale Closed for lack of activity, but still valid. label Apr 28, 2022
@stale
Copy link

stale bot commented Jun 12, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not 'bump' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

@stale stale bot added the stale Closed for lack of activity, but still valid. label Jun 12, 2022
@Maleclypse Maleclypse added the (P5 - Long-term) Long-term WIP, may stay on the list for a while. label Jun 12, 2022
@github-actions github-actions bot removed the stale Closed for lack of activity, but still valid. label Dec 6, 2022
@Maleclypse Maleclypse closed this Oct 2, 2024
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 [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. <Documentation> Design documents, internal info, guides and help. <Enhancement / Feature> New features, or enhancements on existing 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 Mods Issues related to mods or modding (P5 - Long-term) Long-term WIP, may stay on the list for a while.
Projects
Status: Abandoned PRs with no one to pick them up
Development

Successfully merging this pull request may close these issues.

3 participants