Skip to content

Commit

Permalink
reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
Goredell committed Feb 18, 2025
1 parent 93ae382 commit 1e94ee3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/player_activity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ void player_activity::find_best_bench( const tripoint &pos )
}
}

bench = &best_bench;
bench = best_bench;
}

void player_activity::start_or_resume( Character &who, bool resuming )
Expand Down
19 changes: 9 additions & 10 deletions src/player_activity.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ struct simple_task {
/* The number of moves remaining for this target/task to complete */
int moves_left = 0;

simple_task( const std::string &name_, int moves_total_ )
: target_name( name_ ), moves_total( moves_total_ ), moves_left( moves_total_ ) {
}
simple_task( const std::string &name_, int moves_total_, int moves_left_ )
: target_name( name_ ), moves_total( moves_total_ ), moves_left( moves_left_ ) {
}

inline const bool complete() const {

Check warning on line 42 in src/player_activity.h

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Curses

type qualifiers ignored on function return type [-Wignored-qualifiers]

Check warning on line 42 in src/player_activity.h

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages

type qualifiers ignored on function return type [-Wignored-qualifiers]

Check warning on line 42 in src/player_activity.h

View workflow job for this annotation

GitHub Actions / GCC 12, Ubuntu, Tiles, Sound, Lua

type qualifiers ignored on function return type [-Wignored-qualifiers]
return moves_left <= 0;
}
Expand Down Expand Up @@ -88,13 +81,19 @@ class progress_counter
inline void emplace( std::string name, int moves_total_ ) {
moves_total += moves_total_;
moves_left += moves_total_;
targets.emplace_back( name, moves_total_ );
targets.emplace_back( simple_task{
.target_name = name,
.moves_total = moves_total_,
.moves_left = moves_total_ } );
total_tasks++;
}
inline void emplace( std::string name, int moves_total_, int moves_left_ ) {
moves_total += moves_total_;
moves_left += moves_left_;
targets.emplace_back( name, moves_total_, moves_left_ );
targets.emplace_back( simple_task{
.target_name = name,
.moves_total = moves_total_,
.moves_left = moves_left_ } );
total_tasks++;
}
inline void pop() {
Expand Down Expand Up @@ -212,7 +211,7 @@ class player_activity
bool interruptable_with_kb = true;

activity_speed speed = activity_speed();
bench_l *bench = nullptr;
std::optional<bench_l> bench;
std::vector<safe_reference<item>> tools;

// The members in the following block are deprecated, prefer creating a new
Expand Down
7 changes: 4 additions & 3 deletions src/savegame_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,10 @@ void progress_counter::deserialize( JsonIn &jsin )
data.read( "total_tasks", total_tasks );
auto arr = data.get_array( "targets" );
for( JsonObject target : arr ) {
targets.emplace_back( target.get_string( "target_name" ),
target.get_int( "moves_total" ),
target.get_int( "moves_left" ) );
targets.emplace_back( simple_task{
.target_name = target.get_string( "target_name" ),
.moves_total = target.get_int( "moves_total" ),
.moves_left = target.get_int( "moves_left" ) } );
}
}

Expand Down

0 comments on commit 1e94ee3

Please sign in to comment.