Skip to content

Conversation

@0x1NotMe
Copy link
Contributor

@0x1NotMe 0x1NotMe commented Jul 3, 2025

Summary

  • Introduces EquipmentInfo struct to group equipment-related return values
  • Refactors equipment getter functions to use typed returns instead of multiple return values
  • Improves code readability and maintainability

Changes

  • Added EquipmentInfo struct to Types.sol containing:
    • itemIDs: Array of equipment IDs
    • itemNames: Array of equipment names
    • currentItemID: Currently equipped item ID
  • Updated _getEquippableWeapons() to return EquipmentInfo struct
  • Updated _getEquippableArmor() to return EquipmentInfo struct
  • Updated pollForFrontendData() to destructure the struct values

Benefits

  • Cleaner function signatures with single return value
  • Better code organization by grouping related data
  • Easier to extend with additional equipment metadata in the future
  • Follows similar pattern to PR fix: resolve stack too deep in pollForFrontendData #11 but with more focused scope

Test plan

  • Code compiles successfully
  • No functional changes, only refactoring return types
  • Existing tests should pass without modification

@0x1NotMe 0x1NotMe changed the base branch from main to cleanup/remove-unused-imports July 3, 2025 16:16
@0x1NotMe 0x1NotMe force-pushed the refactor/typed-return-structs branch from 694018f to 3b50e55 Compare July 3, 2025 16:18
@0x1NotMe 0x1NotMe force-pushed the cleanup/remove-unused-imports branch from 8a4b36f to a268d44 Compare July 3, 2025 16:48
@0x1NotMe 0x1NotMe force-pushed the refactor/typed-return-structs branch from 3b50e55 to d52773e Compare July 3, 2025 16:49
@0x1NotMe 0x1NotMe force-pushed the cleanup/remove-unused-imports branch from a268d44 to 209bf5e Compare July 4, 2025 02:50
@0x1NotMe 0x1NotMe changed the base branch from cleanup/remove-unused-imports to main July 4, 2025 02:54
@0x1NotMe 0x1NotMe requested a review from thogard785 July 4, 2025 02:54
- Add EquipmentInfo struct to Types.sol for grouped equipment data
- Update _getEquippableWeapons to return EquipmentInfo struct
- Update _getEquippableArmor to return EquipmentInfo struct
- Update pollForFrontendData to use the new struct return values
- Improves code readability by grouping related return values
@0x1NotMe 0x1NotMe force-pushed the refactor/typed-return-structs branch from d52773e to 07dd6e8 Compare July 4, 2025 02:55
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