Skip to content

Conversation

@ranisalt
Copy link
Member

@ranisalt ranisalt commented Dec 4, 2025

Pull Request Prelude

Changes Proposed

Moves static methods that are only used once out of the header file to avoid bloating the class namespace.

@ranisalt ranisalt requested a review from Copilot December 4, 2025 00:28
Copilot finished reviewing on behalf of ranisalt December 4, 2025 00:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the Combat class by moving three static methods (DamageToConditionType, ConditionToDamageType, and isProtected) and one private static method (combatTileEffects) out of the class header and into file-local scope. The goal is to reduce header bloat and limit these functions to the translation units where they are actually used.

Key changes:

  • DamageToConditionType moved from Combat class to file-local scope in map.cpp
  • ConditionToDamageType moved from Combat class to file-local scope in condition.cpp
  • isProtected and combatTileEffects converted to file-local functions in combat.cpp

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/combat.h Removed declarations for isProtected, ConditionToDamageType, DamageToConditionType, and combatTileEffects from Combat class
src/combat.cpp Converted isProtected and combatTileEffects to file-local static functions; removed implementations of ConditionToDamageType and DamageToConditionType
src/map.cpp Added file-local DamageToConditionType function; updated call site to use function without Combat:: prefix
src/condition.cpp Added file-local ConditionToDamageType function; updated call site to use function without Combat:: prefix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return MAP_NORMALWALKCOST;
}

constexpr ConditionType_t DamageToConditionType(CombatType_t type)
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function DamageToConditionType should be placed in an anonymous namespace or be declared as static to follow the codebase's convention for file-local helper functions. The codebase uses anonymous namespaces for file-local functions (e.g., see lines 522-558 in map.cpp with checkSteepLine and checkSlightLine functions).

Copilot uses AI. Check for mistakes.
return false;
}

constexpr CombatType_t ConditionToDamageType(ConditionType_t type)
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function ConditionToDamageType should be placed in an anonymous namespace or be declared as static to follow the codebase's convention for file-local helper functions. This would prevent potential naming conflicts and clearly indicate that this function has internal linkage.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@ramon-bernardo ramon-bernardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that there are still some static methods, wouldn't it be possible to move to local namespace?

@ranisalt
Copy link
Member Author

ranisalt commented Dec 5, 2025

wouldn't it be possible to move to local namespace?

No, they are used elsewhere. Could be moved to a namespace but I would do it separately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants