# Functions in activity\_handlers::reload\_finish

**URL:** <https://discourse.cataclysmdda.org/t/functions-in-activity-handlers-reload-finish/10880>\
**Category:** The Toolbox\
**Created:** [November 17, 2015, 8:56pm UTC](https://discourse.cataclysmdda.org/t/functions-in-activity-handlers-reload-finish/10880 "2015-11-17T20:56:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![noble](https://avatars.discourse-cdn.com/v4/letter/n/e19b73/32.png) [@noble](https://discourse.cataclysmdda.org/u/noble)\
**Post date:** [November 17, 2015, 8:56pm UTC](https://discourse.cataclysmdda.org/t/functions-in-activity-handlers-reload-finish/10880/1 "2015-11-17T20:56:59Z")

</div>

`item *reloadable = nullptr;
{
    int reloadable_pos;
    std::stringstream ss(act->name);
    ss >> reloadable_pos;
    reloadable = &p->i_at(reloadable_pos);
}`  
From the code that comes after this I’m pretty sure it gets the item that you’re trying to reload and assigns it to reloadable.

What do act-\>name and &p-\>i\_at(reloadable\_pos) do?

---

<div class="post-metadata">

**Author:** ![vache](https://avatars.discourse-cdn.com/v4/letter/v/ea666f/32.png) [@vache](https://discourse.cataclysmdda.org/u/vache)\
**Post date:** [November 17, 2015, 9:00pm UTC](https://discourse.cataclysmdda.org/t/functions-in-activity-handlers-reload-finish/10880/2 "2015-11-17T21:00:11Z")

</div>

Just from a glance, it looks like act-\>name is storing the position of the item to reload (as a string for some reason), and then ss \>\> reloadable\_pos converts this string into an int, then it is picking the item at that position from the players inventory with &p-\>i\_at(reloadable\_pos).

---

<div class="post-metadata">

**Author:** ![noble](https://avatars.discourse-cdn.com/v4/letter/n/e19b73/32.png) [@noble](https://discourse.cataclysmdda.org/u/noble)\
**Post date:** [November 17, 2015, 9:52pm UTC](https://discourse.cataclysmdda.org/t/functions-in-activity-handlers-reload-finish/10880/3 "2015-11-17T21:52:27Z")

</div>

What do you mean by position?

---

<div class="post-metadata">

**Author:** ![vache](https://avatars.discourse-cdn.com/v4/letter/v/ea666f/32.png) [@vache](https://discourse.cataclysmdda.org/u/vache)\
**Post date:** [November 17, 2015, 10:45pm UTC](https://discourse.cataclysmdda.org/t/functions-in-activity-handlers-reload-finish/10880/4 "2015-11-17T22:45:49Z")

</div>

Where in the player’s internal code representing the inventory the item is located. It really should be using the position parameter according to [https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/PLAYER\_ACTIVITY.md](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/PLAYER_ACTIVITY.md).
