Skip to content

Conversation

@kamronbatman
Copy link
Contributor

No description provided.

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 PR introduces a new distance-based enumeration system for finding mobiles within a specified range, optimized for tracking skill improvements. The implementation provides efficient spatial querying by using sector-based enumeration with ring traversal patterns.

Key changes:

  • Adds GetMobilesInRangeByDistance methods with multiple overloads for different coordinate input types
  • Implements a custom enumerator that returns mobiles sorted by proximity using sector-based ring traversal
  • Provides minimum distance calculation for optimal performance in skill tracking scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


public ref struct MobileDistanceEnumerator<T> where T : Mobile
{
private Map _map;
Copy link

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

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

The ref readonly field _linkList is not initialized in the constructor and will cause a compilation error. Ref fields must be assigned in constructors or field initializers.

Copilot uses AI. Check for mistakes.
Comment on lines +134 to +136

Mobile current = _current;

Copy link

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

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

Assignment to a ref readonly field is not allowed outside of the constructor. This line will cause a compilation error.

Suggested change
Mobile current = _current;
var linkList = map.GetRealSector(_currentSectorX, _currentSectorY).Mobiles;
_currentVersion = linkList.Version;
current = linkList._first;

Copilot uses AI. Check for mistakes.
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