| 11395 | } |
| 11396 | |
| 11397 | std::vector<ItemContextMenuPrompts> getContextTooltipOptionsForItem(const int player, Item* item, int useDropdownMenu, bool hotbarItem) |
| 11398 | { |
| 11399 | if ( (stats[player] && stats[player]->HP <= 0) || players[player]->ghost.isActive() ) |
| 11400 | { |
| 11401 | // ded, cant do anything with items |
| 11402 | return std::vector<ItemContextMenuPrompts>(); |
| 11403 | } |
| 11404 | std::vector<ItemContextMenuPrompts> options; |
| 11405 | if ( useDropdownMenu == Player::Inventory_t::GAMEPAD_DROPDOWN_FULL ) |
| 11406 | { |
| 11407 | options.push_back(ItemContextMenuPrompts::PROMPT_DROPDOWN); |
| 11408 | options.push_back(ItemContextMenuPrompts::PROMPT_GRAB); |
| 11409 | } |
| 11410 | else if ( useDropdownMenu == Player::Inventory_t::GAMEPAD_DROPDOWN_COMPACT ) |
| 11411 | { |
| 11412 | options = getContextMenuOptionsForItem(player, item); |
| 11413 | options.push_back(ItemContextMenuPrompts::PROMPT_GRAB); // additional prompt here for non-right click menu |
| 11414 | auto findAppraise = std::find(options.begin(), options.end(), ItemContextMenuPrompts::PROMPT_APPRAISE); |
| 11415 | if ( findAppraise != options.end() ) |
| 11416 | { |
| 11417 | options.erase(findAppraise); |
| 11418 | } |
| 11419 | |
| 11420 | int numPrimaryOptions = 0; |
| 11421 | for ( auto it = options.begin(); it != options.end(); ) |
| 11422 | { |
| 11423 | if ( getContextMenuOptionBindingName(player, *it) == "MenuConfirm" ) |
| 11424 | { |
| 11425 | ++numPrimaryOptions; |
| 11426 | } |
| 11427 | ++it; |
| 11428 | } |
| 11429 | if ( numPrimaryOptions >= 2 || hotbarItem ) |
| 11430 | { |
| 11431 | for ( auto it = options.begin(); it != options.end(); ) |
| 11432 | { |
| 11433 | if ( getContextMenuOptionBindingName(player, *it) == "MenuConfirm" ) |
| 11434 | { |
| 11435 | it = options.erase(it); |
| 11436 | continue; |
| 11437 | } |
| 11438 | ++it; |
| 11439 | } |
| 11440 | options.push_back(PROMPT_DROPDOWN); |
| 11441 | } |
| 11442 | } |
| 11443 | else |
| 11444 | { |
| 11445 | options = getContextMenuOptionsForItem(player, item); |
| 11446 | options.push_back(ItemContextMenuPrompts::PROMPT_GRAB); // additional prompt here for non-right click menu |
| 11447 | auto findAppraise = std::find(options.begin(), options.end(), ItemContextMenuPrompts::PROMPT_APPRAISE); |
| 11448 | if ( findAppraise != options.end() ) |
| 11449 | { |
| 11450 | options.erase(findAppraise); |
| 11451 | } |
| 11452 | } |
| 11453 | return options; |
| 11454 | } |
no test coverage detected