CS students looking to fix issue #23440

We’re a group of CS students looking to make a contribution to an open source project. We’ve come across issue #23440, labeled “Good First Issue”, on the GitHub repo and we’re going to try to tackle it. We were hoping to use this forum to get guidance and feedback as we try to make a contribution.


My first suggestion is to provide a link to the issue rather than just giving the name:

#23440-Unloading magazines leading to move starvation

1 Like

Thank you for including the link :smile: . I am one of the students and I apologise on his behalf, we are new to this community and the open source world in general, so we greatly appreciate your support.

As outlined in the issue, the action needs to be adjusted to be interruptable. Dda supports this kind of thing via a framework we call “activity handlers”.

Basically at the callsite where the action currently happens, create an activity object and enqueue it, then exit to the main game loop.

Then hoist the meat of the action into some functions in https://github.com/CleverRaven/Cataclysm-DDA/blob/3765602255a903c7668f404c86280ec4608d2e6d/src/activity_handlers.cpp

This PR is a simple example of this process


Thanks so much, Kevin. We have seen you around the repo quite a bit and we appreciate your guidance on it. We will keep you updated as we dig into the code.

The activity_handlers have parameter of (player_activity *act, player *p). The unloading function takes in a ‘item’ class, not a ‘player’ class. That means I will need to somehow find the item in ‘player’. I currently cannot find the ‘inventory’ in player class. Are you able to give us some insight on the order of things that happens, or its framework.