MCPcopy Create free account
hub / github.com/davemoore22/sorcery / handle_toggle

Method handle_toggle

src/core/controller.cpp:524–562  ·  view source on GitHub ↗

Toggle Handling

Source from the content-addressed store, hash-verified

522
523 if (has_character("inspect")) {
524
525 const auto &who{_game->characters.at(_characters["inspect"])};
526#pragma GCC diagnostic push
527#pragma GCC diagnostic ignored "-Wsign-compare"
528 if (selection < who.inventory.items().size()) {
529 const auto item{who.inventory.items().at(selection)};
530 return item.get_equipped();
531 } else
532 return false;
533#pragma GCC diagnostic pop
534 } else
535 return false;
536 } else if (component == "use_menu") {
537
538 if (has_character("inspect")) {
539
540 const auto &who{_game->characters.at(_characters["inspect"])};
541#pragma GCC diagnostic push
542#pragma GCC diagnostic ignored "-Wsign-compare"
543 if (selection < who.inventory.items().size()) {
544 const auto item{who.inventory.items().at(selection)};
545 const auto item_type{
546 _ctx.resources->items->get_item_type(item.get_type_id())};
547 return !(item_type.has_usable() && item.get_known());
548 } else
549 return false;
550#pragma GCC diagnostic pop
551 } else
552 return false;
553 } else if (component == "invoke_menu") {
554
555 if (has_character("inspect")) {
556
557 const auto &who{_game->characters.at(_characters["inspect"])};
558#pragma GCC diagnostic push
559#pragma GCC diagnostic ignored "-Wsign-compare"
560 if (selection < who.inventory.items().size()) {
561 const auto item{who.inventory.items().at(selection)};
562 const auto item_type{
563 _ctx.resources->items->get_item_type(item.get_type_id())};
564 return !(item_type.has_invokable() && item.get_known());
565 } else

Callers 1

with_TabItemFunction · 0.80

Calls 5

get_configMethod · 0.80
set_rec_modeMethod · 0.80
set_strict_modeMethod · 0.80
is_strict_modeMethod · 0.80
is_rec_modeMethod · 0.80

Tested by

no test coverage detected