Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type mismatches and clamping issues in colony system calculations #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexxshadow
Copy link

This pull request addresses type compatibility and clamping issues in the colony system calculations. These changes ensure compatibility and prevent compilation errors due to mismatched types.

Changes:

1. Resolved Type Mismatches:

  • Converted integer literals (e.g., 50) to floating-point literals (e.g., 50.0) in the DimensionalPosition struct initialization to ensure compatibility with f64 fields.
  • Applied .as f64 conversions to integer adjustment values used in calculations, aligning them with f64 types in calculations and preventing errors.

2. Corrected Clamping Bounds:

  • Updated .clamp() bounds from integers (0 and 100) to floating-point values (0.0 and 100.0). This ensures the bounds are compatible with f64 values in calculations, avoiding mismatched types during compilation.

Explanation:

These fixes address strict type requirements in Rust, ensuring that calculations involving f64 values operate correctly without type conflicts. Specifically:

  • Type Consistency: Rust requires operands in mathematical operations and methods to be of the same type. Converting integer values to f64 ensures smooth calculations and prevents unexpected type errors.
  • Clamping Operation: The .clamp() method now uses f64 bounds to match the f64 type of the fields being clamped, eliminating compilation issues.

This PR ensures that the code builds successfully and maintains consistent behavior across different environments, especially on systems with strict type checking.

- Converted integer literals to f64 for compatibility in clamping operations
- Updated `.clamp()` bounds to use `0.0` and `100.0` for f64 consistency
- Resolved Git remote configuration to point to correct repository URL
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.

1 participant