From 96ddaa1201f2e39c3d98df5ebc3e41c04658ba0d Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 11 Dec 2021 19:31:07 +0100 Subject: [PATCH] Fixed the remaining methodbind issues. --- rtile_map.cpp | 12 +++++++----- rtile_map.h | 8 ++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/rtile_map.cpp b/rtile_map.cpp index d24a5ed..52ebe98 100644 --- a/rtile_map.cpp +++ b/rtile_map.cpp @@ -2444,8 +2444,8 @@ Map *RTileMap::get_quadrant_map(int p_layer) { return &layers[p_layer].quadrant_map; } -Vector2i RTileMap::get_coords_for_body_rid(RID p_physics_body) { - ERR_FAIL_COND_V_MSG(!bodies_coords.has(p_physics_body), Vector2i(), vformat("No tiles for the given body RID %d.", p_physics_body)); +Vector2 RTileMap::get_coords_for_body_rid(RID p_physics_body) { + ERR_FAIL_COND_V_MSG(!bodies_coords.has(p_physics_body), Vector2(), vformat("No tiles for the given body RID %d.", p_physics_body)); return bodies_coords[p_physics_body]; } @@ -2771,7 +2771,7 @@ void RTileMap::_get_property_list(List *p_list) const { } } -Vector2 RTileMap::map_to_world(const Vector2i &p_pos) const { +Vector2 RTileMap::map_to_world(const Vector2 &p_pos) const { // SHOULD RETURN THE CENTER OF THE TILE ERR_FAIL_COND_V(!tile_set.is_valid(), Vector2()); @@ -2848,7 +2848,7 @@ Vector2 RTileMap::map_to_world(const Vector2i &p_pos) const { return (ret + Vector2(0.5, 0.5)) * tile_set->get_tile_size(); } -Vector2i RTileMap::world_to_map(const Vector2 &p_pos) const { +Vector2 RTileMap::world_to_map(const Vector2 &p_pos) const { ERR_FAIL_COND_V(!tile_set.is_valid(), Vector2i()); Vector2 ret = p_pos; @@ -3057,7 +3057,9 @@ bool RTileMap::is_existing_neighbor(RTileSet::CellNeighbor p_cell_neighbor) cons } } -Vector2i RTileMap::get_neighbor_cell(const Vector2i &p_coords, RTileSet::CellNeighbor p_cell_neighbor) const { +Vector2 RTileMap::get_neighbor_cell(const Vector2 &p_coordsv, RTileSet::CellNeighbor p_cell_neighbor) const { + Vector2i p_coords = p_coordsv; + ERR_FAIL_COND_V(!tile_set.is_valid(), p_coords); RTileSet::TileShape shape = tile_set->get_tile_shape(); diff --git a/rtile_map.h b/rtile_map.h index c2b7a38..d4d0f96 100644 --- a/rtile_map.h +++ b/rtile_map.h @@ -349,11 +349,11 @@ public: virtual bool is_y_sort_enabled() const; virtual void set_y_sort_enabled(bool p_enable); - Vector2 map_to_world(const Vector2i &p_pos) const; - Vector2i world_to_map(const Vector2 &p_pos) const; + Vector2 map_to_world(const Vector2 &p_pos) const; + Vector2 world_to_map(const Vector2 &p_pos) const; bool is_existing_neighbor(RTileSet::CellNeighbor p_cell_neighbor) const; - Vector2i get_neighbor_cell(const Vector2i &p_coords, RTileSet::CellNeighbor p_cell_neighbor) const; + Vector2 get_neighbor_cell(const Vector2 &p_coords, RTileSet::CellNeighbor p_cell_neighbor) const; Vector get_used_cells(int p_layer) const; Rect2 get_used_rect(); // Not const because of cache @@ -366,7 +366,7 @@ public: //virtual void set_texture_repeat(CanvasItem::TextureRepeat p_texture_repeat) override; // For finding tiles from collision. - Vector2i get_coords_for_body_rid(RID p_physics_body); + Vector2 get_coords_for_body_rid(RID p_physics_body); // Fixing a nclearing methods. void fix_invalid_tiles();