Skip to content

Commit

Permalink
avoid copying input_events unnecessarily
Browse files Browse the repository at this point in the history
clang-tidy was concerned about it so I guess we can use references.
  • Loading branch information
Daniel Brooks committed Jul 1, 2024
1 parent 1a554c1 commit 7008778
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/npctalk_rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ void follower_rules_ui_impl::rules_transfer_popup( bool &exporting_rules, bool &

template<typename T>
void follower_rules_ui_impl::checkbox( int rule_number, const T &this_rule,
input_event assigned_hotkey, input_event pressed_key )
input_event &assigned_hotkey, const input_event &pressed_key )
{
ImGui::PushID( rule_number );
print_hotkey( assigned_hotkey );
Expand All @@ -303,7 +303,7 @@ void follower_rules_ui_impl::checkbox( int rule_number, const T &this_rule,
ImGui::SameLine();
auto label = _( "Default" );
auto x = ImGui::GetWindowWidth() - ImGui::GetStyle().ScrollbarSize -
ImGui::GetStyle().WindowPadding.x - ImGui::CalcTextSize( label, NULL, true ).x;
ImGui::GetStyle().WindowPadding.x - ImGui::CalcTextSize( label, nullptr, true ).x;
ImGui::SetCursorPosX( x );
if( ImGui::Button( label ) ) {
guy->rules.clear_flag( this_rule.rule );
Expand Down
6 changes: 3 additions & 3 deletions src/npctalk_rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ class follower_rules_ui_impl : public cataimgui::window

// makes a checkbox for the rule
template<typename T>
void checkbox( int rule_number, const T &this_rule, input_event assigned_hotkey,
input_event pressed_key );
void checkbox( int rule_number, const T &this_rule, input_event &assigned_hotkey,
const input_event &pressed_key );

// makes one radio button per option in the map
template<typename T>
void radio_group( const std::string header_id, const char *title, T *rule,
void radio_group( std::string header_id, const char *title, T *rule,
std::map<T, std::string> &values, input_event assigned_hotkey, input_event pressed_key );

// Prepares for a rule option with multiple valid selections. Advances and wraps through
Expand Down

0 comments on commit 7008778

Please sign in to comment.