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

More string consts into single file (CleverRaven#38189) #89

Merged
merged 26 commits into from
Feb 21, 2020
Merged
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
aeaff85
Create lore.md
KorGgenT Feb 20, 2020
ad087d4
Don't penalize strong characters for dragging
wapcaplet Feb 20, 2020
e6cb983
Move string consts/rename string consts
Ramza13 Feb 20, 2020
256c539
Merge pull request #38177 from wapcaplet/drag-while-strong
ZhilkinSerg Feb 20, 2020
07995cd
Move more string consts into single file (#38169)
Ramza13 Feb 20, 2020
9c9835f
Merge pull request #38176 from Ramza13/string_consts_and_more
ZhilkinSerg Feb 20, 2020
571efb2
Move more string consts into single file (#38175)
Ramza13 Feb 20, 2020
f5babd6
Merge pull request #38174 from KorGgenT/magic-lore-text
Rivet-the-Zombie Feb 20, 2020
f3fbeb8
Prevent monsters from leaping to their death in water (#38150)
jkraybill Feb 20, 2020
55cabb7
Move string consts into single file (#38181)
Ramza13 Feb 20, 2020
fc61e64
Magazine name to object
snipercup Feb 20, 2020
6169bce
Added "Trap Back button" option to Android prelaunch menu
ZhilkinSerg Feb 20, 2020
b4fcb44
Updated Android build process
ZhilkinSerg Feb 20, 2020
4851348
Merge pull request #38187 from CleverRaven/android-2020-02-21
ZhilkinSerg Feb 20, 2020
b8cd4c0
Merge pull request #36870 from ZhilkinSerg/android-2019-12-29
ZhilkinSerg Feb 20, 2020
123f1b6
Merge pull request #38186 from snipercup/Magazine-name-to-object-2
ZhilkinSerg Feb 20, 2020
19c5698
Move string consts into single file (#38184)
Ramza13 Feb 20, 2020
05940bf
More string consts into single file (#38183)
Ramza13 Feb 20, 2020
f304837
Bionic name to object
snipercup Feb 20, 2020
34ac021
Magazine name to object
snipercup Feb 20, 2020
471a2d3
Alphabetize the debug skill wishlist
wapcaplet Feb 21, 2020
d73a8b9
Merge pull request #38191 from snipercup/Magazine-name-to-object
ZhilkinSerg Feb 21, 2020
feb8e6b
Merge pull request #38188 from snipercup/Bionic-name-to-object
ZhilkinSerg Feb 21, 2020
eda55f9
Merge pull request #38194 from wapcaplet/debug-sort-skills
ZhilkinSerg Feb 21, 2020
4fffd96
More string consts into single file (#38189)
Ramza13 Feb 21, 2020
b1b48ba
Move string consts into single file (#38195)
Ramza13 Feb 21, 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
26 changes: 15 additions & 11 deletions src/wish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,13 +594,17 @@ void debug_menu::wishskill( player *p )
skmenu.allow_anykey = true;
skmenu.addentry( 0, true, '1', _( "Modify all skills…" ) );

auto sorted_skills = Skill::get_skills_sorted_by( []( const Skill & a, const Skill & b ) {
return a.name() < b.name();
} );

std::vector<int> origskills;
origskills.reserve( Skill::skills.size() );
origskills.reserve( sorted_skills.size() );

for( const auto &s : Skill::skills ) {
const int level = p->get_skill_level( s.ident() );
for( const auto &s : sorted_skills ) {
const int level = p->get_skill_level( s->ident() );
skmenu.addentry( origskills.size() + skoffset, true, -2, _( "@ %d: %s " ), level,
s.name() );
s->name() );
origskills.push_back( level );
}

Expand All @@ -611,15 +615,15 @@ void debug_menu::wishskill( player *p )
const int sksel = skmenu.selected - skoffset;
if( skmenu.ret == UILIST_UNBOUND && ( skmenu.keypress == KEY_LEFT ||
skmenu.keypress == KEY_RIGHT ) ) {
if( sksel >= 0 && sksel < static_cast<int>( Skill::skills.size() ) ) {
if( sksel >= 0 && sksel < static_cast<int>( sorted_skills.size() ) ) {
skill_id = sksel;
skset = p->get_skill_level( Skill::skills[skill_id].ident() ) +
skset = p->get_skill_level( sorted_skills[skill_id]->ident() ) +
( skmenu.keypress == KEY_LEFT ? -1 : 1 );
}
} else if( skmenu.ret >= 0 && sksel >= 0 &&
sksel < static_cast<int>( Skill::skills.size() ) ) {
sksel < static_cast<int>( sorted_skills.size() ) ) {
skill_id = sksel;
const Skill &skill = Skill::skills[skill_id];
const Skill &skill = *sorted_skills[skill_id];
const int NUM_SKILL_LVL = 21;
uilist sksetmenu;
sksetmenu.w_height = NUM_SKILL_LVL + 4;
Expand All @@ -639,7 +643,7 @@ void debug_menu::wishskill( player *p )
}

if( skill_id >= 0 && skset >= 0 ) {
const Skill &skill = Skill::skills[skill_id];
const Skill &skill = *sorted_skills[skill_id];
p->set_skill_level( skill.ident(), skset );
skmenu.textformatted[0] = string_format( _( "%s set to %d " ),
skill.name(),
Expand All @@ -664,8 +668,8 @@ void debug_menu::wishskill( player *p )
} else if( ret < 7 ) {
skset = ( ret - 4 ) * 5;
}
for( size_t skill_id = 0; skill_id < Skill::skills.size(); skill_id++ ) {
const Skill &skill = Skill::skills[skill_id];
for( size_t skill_id = 0; skill_id < sorted_skills.size(); skill_id++ ) {
const Skill &skill = *sorted_skills[skill_id];
int changeto = skmod != 0 ? p->get_skill_level( skill.ident() ) + skmod :
skset != -1 ? skset : origskills[skill_id];
p->set_skill_level( skill.ident(), std::max( 0, changeto ) );
Expand Down