Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upAllow long salvage with wielded and worn items #11562
Conversation
This comment has been minimized.
This comment has been minimized.
I'm wondering: do you need to store the tool that is used? Why not simply look it up in the inventory when it's needed (right before invoking its iuse function). It is automatically chosen anyway, whether this happens when the activity is started or when the activity is doing something shouldn't matter. |
This comment has been minimized.
This comment has been minimized.
|
Could be a bit slow with large inventories. I'm getting slowdowns when building crafting inventory with 100+ items already. |
Coolthulhu
added some commits
Mar 13, 2015
This comment has been minimized.
This comment has been minimized.
|
OK, added support for sheathed (contained in general) knives. A bit ugly (I'm casting away constness), but shouldn't cause much slowdown. |
This comment has been minimized.
This comment has been minimized.
|
No one responded for a while, so I'll ask: |
This comment has been minimized.
This comment has been minimized.
|
Which line of code? iirc as long as the original object itself is not const, there should be no issue. However if it is, undefined behaviour. |
This comment has been minimized.
This comment has been minimized.
|
In my opinion it's fine, but go ahead and duplicate that function and add the const modifier to avoid this debate. Actually no, don't do this. Instead use the value returned by const item *x = ...
const int pos = u.get_item_position( x );
item &non_const = u.i_at( pos ); |
This comment has been minimized.
This comment has been minimized.
|
In #11569 I need to access items by pointers (items in containers have no inventory slots), so if I need to stop casting away constness, I need to go with the overload. |
This comment has been minimized.
This comment has been minimized.
|
OK, no casting away the constness |
This comment has been minimized.
This comment has been minimized.
|
still clacking away at nestable containers |
Coolthulhu commentedMar 13, 2015
As in title.
Also commented out re-setting the activity on long salvage finish. Didn't see any problems in the testing.
This results in player not being asked to confirm continuing salvaging every time a monster shows up or makes a sound, only the first time (still asks every time player is attacked/hurt).
I wanted to add long salvage with sheathed items, but it's far harder than it looks. For one, items in containers don't have inventory indices, which are required by activities.