Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the advanced inventory. #9180

Merged
merged 5 commits into from Sep 23, 2014

Conversation

Projects
None yet
3 participants
@BevapDin
Copy link
Contributor

commented Sep 22, 2014

Fix the advanced inventory.

Fixes #7586 - you can still have the dragged vehicle on one side and the same spot on the other side. I don't consider this a bug, as it is a valid scenario: start with a dragged vehicle to the south, select dragged vehicle in one pane, select location to the east in the other pane. Close the AIM, move the dragged vehicle so it is now to the east of your character. Open the AIM again. Now you have the content of the dragged vehicle on both panes.

However it's not possible to move items in this case. The AIM will complain that source and destination are the same. That bug is fixed. And note that both panes are actually different: one contains the content of the dragged vehicle, the other the content of the vehicle that is to the east - it just happens to be the same in some circumstances.


Fixes #8014


Fixes #7543


Fixes #7544 - category headers on each page

About the remaining part of that issue:

So, under "Surrounding area" and "All 9 squares", maybe show "[; tools]". I'm adding in the category hotkey there, too, just 'cuz I like it.

While we're at it, it might be nice to be able to jump to a category by hitting its hotkey. Pressing ";" should result in the top line being "[; tools]", followed by the first screen of tool items. (ya ya, that's really a separate request).

Categories have no hotkey (are you referring to the default/standard item symbol?) and categories can be dynamically, one can define new ones in the json data. This does not go well with the input manager, one needed separate entries for each category.


About #7097 and #2859:
It's currently fairly easy to get items under the car:

  • kill a creature, it drops everything (items/corpse) onto the map.
  • craft /disassemble something, it goes (if possible) into the vehicle, but if there is no cargo part or if it's full, it goes onto the map.
  • examining some tile triggers the examine action which might drop stuff on the ground
  • casings dropped while firing
  • weapon dropped while picking up something and wielding it
  • taking something off that has with no space in the inventory, the item goes onto the map
  • if you search, you'll surely find more

Also we could easily close that up by having dropped items that don't go
into vehicle storage go to the nearest non-vehicle tile.

If the vehicle is fully closed (e.g. standard car, all doors closed) how should the item teleport to the outside? Is that realistic (as opposed to dropping them under the car). Imagine a big vehicle, e.g. 4 or more vehicle tiles in every direction, the item might teleport far away.


There were also two bugs in the uimenu:

  1. The initial selection was not checked. This can be seen when the adv. inv. is open and one pane is set to show all. Moving an item to that pane opens a uimenu that prompts for the actual destination. The last chosen entry is pre-selected. If nothing has been selected previously, no entry in the menu is selected (selectin index == -1). Pressing enter in this state crashes the program as it accesses the currently selected entry in the list of entries (and the current selection index is invalid).
  2. Doing the above but selecting an entry moves the item and stores the selected destination so it is the default the next time the menu appears. Now change the destination square to something that can not hold items (either move around, or use the map editor). Than open the adv. inv. again, move an item. The menu appears, the same destination as previously chosen is selected again, but that entry is actually disabled and one should not be able to select it.

I changed the default bindings for selecting the square to match the displayed numbers and the numbers on the number pad, e.g. 2 is south, 8 is north. They key bindings worked already that way, but where used from in the code: entering '2', triggered the action "ITEMS_N" (north!), but that action set the location to 2 (that's the index of the advanced_inventory::squares) and that means South, so it's correct.

BevapDin added some commits Sep 21, 2014

Move the definiton of game::advanced_inv into advanced_inv.cpp
Removes include "advanced_inv.h" in game.cpp, as it is otherwise not needed and makes compiling changes in advanced_inv.cpp faster.
Fix the advanced inventory.
Rewrote some of it and extracted the code into several functions.
Introduced some more enums instead of const values.
Make category headers on each page of the item list.
Added documentation.

@KA101 KA101 self-assigned this Sep 22, 2014

@KA101 KA101 merged commit 8e358aa into CleverRaven:master Sep 23, 2014

1 check passed

default
Details
@kevingranade

This comment has been minimized.

Copy link
Member

commented Sep 23, 2014

@BevapDin to address your perplexity about g->u.assign_activity( ACT_ADV_INVENTORY, 0 ); at adv_inventory.cpp:879.
I added a feature where the activity backlog can act like a stack instead of a single deferred activity in order to accomplish some UI shenanigans. The inventory menu activity is added, then an activity to drop is pushed on the stack, then the drop activity is repeatedly popped and pushed on the stack until all its items are processed. When the drop activity runs out, the inventory menu activity is there waiting and seamlessly returns the player to the menu.
If the activity is interrupted instead of completing, both activities are cancelled.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Sep 23, 2014

Kevin's backlog stack thingy

Came in useful testing the page-problem here. Dropping 4 pages' worth of gear into a shopping cart w/o having to be afraid of getting mauled FTW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.