Add input validation and fix Entity repr

- #212: Add GRID_MAX (8192) validation to Grid, ColorLayer, TileLayer
- #213: Validate color components are in 0-255 range
- #214: Add null pointer checks before HeightMap operations
- #216: Change entities_in_radius(x, y, radius) to (pos, radius)
- #217: Fix Entity __repr__ to show actual draw_pos float values

Closes #212, closes #213, closes #214, closes #216, closes #217

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John McCardle 2026-01-16 19:18:27 -05:00
commit baa7ee354b
4 changed files with 228 additions and 13 deletions

View file

@ -1042,9 +1042,10 @@ PyObject* UIEntity::repr(PyUIEntityObject* self) {
std::ostringstream ss;
if (!self->data) ss << "<Entity (invalid internal object)>";
else {
// #176 - Use grid_x/grid_y naming to reflect tile coordinates
ss << "<Entity (grid_x=" << static_cast<int>(self->data->position.x)
<< ", grid_y=" << static_cast<int>(self->data->position.y)
// #217 - Show actual float position (draw_pos) to avoid confusion
// Position is stored in tile coordinates; use draw_pos for float values
ss << "<Entity (draw_pos=(" << self->data->position.x
<< ", " << self->data->position.y << ")"
<< ", sprite_index=" << self->data->sprite.getSpriteIndex() << ")>";
}
std::string repr_str = ss.str();