CleverRaven / CleverRaven/Cataclysm-DDA

Refactor encumbrance

Open
#36,730 0 comments 3 reactions 0 assignees View on GitHub
(P3 - Medium) Info / User Interface Items / Item Actions / Item Qualities Mechanics: Character / Player
Dominant language
C++
Stars
13.1k
Forks
4.6k
Avg merge
2d 1h
Merged PRs (30d)
200

Description

**Is your feature request related to a problem? Please describe.**
The encumbrance handling code is disgusting. It's a mountain of hacks piled on top of a bad implementation from before DDA and its complexity is blocking improvements.

**Describe the solution you'd like**
Refactor the code handling coverage and encumbrance. It's possible this is a set of linked problems and the body part rework we need for proper injury modeling should come first. Encumbrance should be cached and recalculated whenever it may change. Calculating it every time the values are needed would be terrible for performance. The new system has to allow for the UI improvements jbtw made last time this code got major changes to work.

We may want to give `Character` a `std::set>> clothing_data` storing a list of pairs for each body part. A separate structure is a cache storing ints for encumbrance per bodypart and is updated every time `clothing_data` is modified or an item pointed to by an `item_location` in it is modified.

Contributor guide

Open the contributing guide

Research direction

Start by locating the Character implementation and the existing coverage and encumbrance handling. Review how clothing and item_location changes affect those values, including the proposed clothing_data and cache structures. Done means a coherent refactor that preserves the existing UI behavior, recalculates cached encumbrance when relevant data changes, and supports future body-part rework.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.