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

merge from origin fork #1

Merged
merged 19 commits into from
Jun 14, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ba88f5a
Remove dependency on mapgen.h from map.h
kevingranade Jun 13, 2020
93809d7
Update game.cpp
martinrhan Jun 13, 2020
bb8074f
[WIP] Create DESIGN.md
LyleSY Jun 13, 2020
4ce6be1
Add set all health from the debug menu
CodeBandit Jun 13, 2020
e32c6b3
Document longest_side item field in JSON_INFO
wapcaplet Jun 13, 2020
0d50323
Merge pull request #41274 from kevingranade/shrink-map-h
ZhilkinSerg Jun 14, 2020
c81af61
Merge pull request #41291 from wapcaplet/longest-side-doc
ZhilkinSerg Jun 14, 2020
9033170
Overhaul lifting quality handling
kevingranade Jun 14, 2020
8ba78d6
Removed wayfarer trait from medieval peasant scenario (#40495)
enaantd Jun 14, 2020
bd9759e
Expanded Digestive System to extract more vitamins (#41204)
TobalJackson Jun 14, 2020
45228ab
New Hub 01 related sidequest (#41264)
John-Candlebury Jun 14, 2020
b99969c
Fix text style regression
ZhilkinSerg Jun 14, 2020
8c3d263
Removing Duplicate cable entry from the afs_kitchen_rig recipe
MorganTheMad Jun 14, 2020
c3abd5f
Merge pull request #41304 from rGhede/patch-1
ZhilkinSerg Jun 14, 2020
b4aae59
Merge pull request #41300 from kevingranade/lift-qual-clean
ZhilkinSerg Jun 14, 2020
4082b4c
Merge pull request #41289 from LyleSY/patch-4
ZhilkinSerg Jun 14, 2020
8aa1ba0
Add translation comments to matching entries (#41195)
CountAlex Jun 14, 2020
f3d4575
Add set all health from the debug menu (#41290)
ZhilkinSerg Jun 14, 2020
5e807d8
Merge pull request #41276 from martinrhan/branch_bugfix_wield
ZhilkinSerg Jun 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10773,6 +10773,18 @@ int Character::get_hp() const
return get_hp( num_hp_parts );
}

int Character::get_lowest_hp() const
{
// Set lowest_hp to an arbitrarily large number.
int lowest_hp = 999;
for( int cur_hp : this->hp_cur ) {
if( cur_hp < lowest_hp ) {
lowest_hp = cur_hp;
}
}
return lowest_hp;
}

int Character::get_hp( hp_part bp ) const
{
if( bp < num_hp_parts ) {
Expand Down
3 changes: 3 additions & 0 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -2222,6 +2222,9 @@ class Character : public Creature, public visitable<Character>
bool sees( const Creature &critter ) const override;
Attitude attitude_to( const Creature &other ) const override;

// used in debugging all health
int get_lowest_hp() const;

int get_hp( hp_part bp ) const override;
int get_hp() const override;
int get_hp_max( hp_part bp ) const override;
Expand Down
15 changes: 15 additions & 0 deletions src/debug_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,11 @@ void character_edit_menu()
smenu.addentry( 3, true, 's', "%s: %d", _( "Right arm" ), p.hp_cur[hp_arm_r] );
smenu.addentry( 4, true, 'z', "%s: %d", _( "Left leg" ), p.hp_cur[hp_leg_l] );
smenu.addentry( 5, true, 'x', "%s: %d", _( "Right leg" ), p.hp_cur[hp_leg_r] );
smenu.addentry( 6, true, 'e', "%s: %d", _( "All" ), p.get_lowest_hp() );
smenu.query();
int *bp_ptr = nullptr;
bool all_select = false;

switch( smenu.ret ) {
case 0:
bp_ptr = &p.hp_cur[hp_torso];
Expand All @@ -650,6 +653,9 @@ void character_edit_menu()
case 5:
bp_ptr = &p.hp_cur[hp_leg_r];
break;
case 6:
all_select = true;
break;
default:
break;
}
Expand All @@ -660,6 +666,15 @@ void character_edit_menu()
*bp_ptr = value;
p.reset_stats();
}
} else if( all_select ) {
int value;
if( query_int( value, _( "Set the hitpoints to? Currently: %d" ), p.get_lowest_hp() ) &&
value >= 0 ) {
for( int &cur_hp : p.hp_cur ) {
cur_hp = value;
}
p.reset_stats();
}
}
}
break;
Expand Down