mcrfpy.Vector - support more convenience #109

Closed
opened 2025-07-11 15:36:08 +00:00 by john · 0 comments
Owner

Some refactoring caused mcrfpy functions to return mcrfpy.Vector objects; this broke a lot of Crypt of Sokoban, which was relying on tuples being returned. Instantiating vectors shouldn't be required to do these convenient tasks:

vector.int - return an integer vector (floor) - should compare with int tuples for convenience; much better than mcrfpy.Vector(int(vector.x), int(vector.y))

  • this is the sf::vector2f vs sf::vector2i problem; can we create a lightweight solution that permits

vector[0], vector[1] - indexes for .x, .y

vector == (5, 6) - tuple value comparison

do (0, 0) or (0.0f, 0.0f) compare as falsey?

Some refactoring caused `mcrfpy` functions to return `mcrfpy.Vector` objects; this broke a lot of Crypt of Sokoban, which was relying on tuples being returned. Instantiating vectors shouldn't be required to do these convenient tasks: `vector.int` - return an integer vector (floor) - should compare with int tuples for convenience; much better than `mcrfpy.Vector(int(vector.x), int(vector.y))` - this is the `sf::vector2f` vs `sf::vector2i` problem; can we create a lightweight solution that permits `vector[0]`, `vector[1]` - indexes for `.x`, `.y` `vector == (5, 6)` - tuple value comparison do `(0, 0)` or `(0.0f, 0.0f)` compare as falsey?
john closed this issue 2025-11-26 16:16:34 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
john/McRogueFace#109
No description provided.