From 36aa78d1916e36fb422fdb9e6cb682fdd9aeafb1 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Sat, 7 Mar 2015 16:55:40 +0100 Subject: Remove effectively dead squelch code --- src/cmd3.cc | 2 +- src/squeltch.cc | 38 ++++++++++---------------------------- src/squeltch.hpp | 2 +- 3 files changed, 12 insertions(+), 30 deletions(-) diff --git a/src/cmd3.cc b/src/cmd3.cc index d12f785a..c6ffdfda 100644 --- a/src/cmd3.cc +++ b/src/cmd3.cc @@ -677,7 +677,7 @@ void do_cmd_destroy(void) /* Create an automatizer rule */ if (automatizer_create) { - automatizer_add_rule(o_ptr, TRUE); + automatizer_add_rule(o_ptr); } /* diff --git a/src/squeltch.cc b/src/squeltch.cc index 4ed30f9a..90f6ae95 100644 --- a/src/squeltch.cc +++ b/src/squeltch.cc @@ -436,7 +436,7 @@ void do_cmd_automatizer() enum class add_rule_mode { TVAL, TSVAL, NAME }; -static void easy_add_rule(action_type action, add_rule_mode mode, bool do_status, object_type *o_ptr) +static void easy_add_rule(add_rule_mode mode, bool do_status, object_type *o_ptr) { std::shared_ptr condition; @@ -488,44 +488,26 @@ static void easy_add_rule(action_type action, add_rule_mode mode, bool do_status } // Rule name - auto rule_name = action_mapping().stringify(action); + auto rule_name = action_mapping().stringify(action_type::AUTO_DESTROY); // Append to list of rules - switch (action) - { - case action_type::AUTO_DESTROY: - automatizer->append_rule( - std::make_shared( - rule_name, game_module_idx, condition)); - break; - - case action_type::AUTO_PICKUP: - automatizer->append_rule( - std::make_shared( - rule_name, game_module_idx, condition)); - break; - - case action_type::AUTO_INSCRIBE: - assert(false); - break; - } + automatizer->append_rule( + std::make_shared( + rule_name, game_module_idx, condition)); msg_print("Rule added. Please go to the Automatizer screen (press = then T)"); msg_print("to save the modified ruleset."); } -void automatizer_add_rule(object_type *o_ptr, bool_ destroy) +void automatizer_add_rule(object_type *o_ptr) { bool do_status = false; - action_type action = destroy - ? action_type::AUTO_DESTROY - : action_type::AUTO_PICKUP; while (true) { char ch; - if (!get_com(format("%s all of the same [T]ype, [F]amily or [N]ame, also use [S]tatus (%s)? ", (destroy) ? "Destroy" : "Pickup", (do_status) ? "Yes" : "No"), &ch)) + if (!get_com(format("Destroy all of the same [T]ype, [F]amily or [N]ame, also use [S]tatus (%s)? ", (do_status) ? "Yes" : "No"), &ch)) { break; } @@ -538,19 +520,19 @@ void automatizer_add_rule(object_type *o_ptr, bool_ destroy) if (ch == 'T' || ch == 't') { - easy_add_rule(action, add_rule_mode::TSVAL, do_status, o_ptr); + easy_add_rule(add_rule_mode::TSVAL, do_status, o_ptr); break; } if (ch == 'F' || ch == 'f') { - easy_add_rule(action, add_rule_mode::TVAL, do_status, o_ptr); + easy_add_rule(add_rule_mode::TVAL, do_status, o_ptr); break; } if (ch == 'N' || ch == 'n') { - easy_add_rule(action, add_rule_mode::NAME, do_status, o_ptr); + easy_add_rule(add_rule_mode::NAME, do_status, o_ptr); break; } } diff --git a/src/squeltch.hpp b/src/squeltch.hpp index 14f5d14d..0d311d61 100644 --- a/src/squeltch.hpp +++ b/src/squeltch.hpp @@ -5,7 +5,7 @@ extern void squeltch_inventory(void); extern void squeltch_grid(void); extern void do_cmd_automatizer(void); -extern void automatizer_add_rule(object_type *o_ptr, bool_ destroy); +extern void automatizer_add_rule(object_type *o_ptr); extern bool_ automatizer_create; extern void automatizer_init(); extern void automatizer_load(cptr file_name); -- cgit v1.2.3