mirror of
https://github.com/Relintai/rtile_map.git
synced 2024-11-09 05:12:10 +01:00
Fix compile for 3.x after recent changes.
This commit is contained in:
parent
27e175b352
commit
389070cfef
32
tile_map.cpp
32
tile_map.cpp
@ -37,6 +37,10 @@
|
||||
#include "scene/2d/collision_object_2d.h"
|
||||
#include "servers/physics_2d_server.h"
|
||||
|
||||
#if VERSION_MINOR >= 5
|
||||
#include "servers/navigation_2d_server.h"
|
||||
#endif
|
||||
|
||||
int RTileMap::_get_quadrant_size() const {
|
||||
if (y_sort_mode) {
|
||||
return 1;
|
||||
@ -79,7 +83,11 @@ void RTileMap::_notification(int p_what) {
|
||||
Quadrant &q = E->get();
|
||||
if (navigation) {
|
||||
for (Map<PosKey, Quadrant::NavPoly>::Element *F = q.navpoly_ids.front(); F; F = F->next()) {
|
||||
#if VERSION_MINOR < 5
|
||||
navigation->navpoly_remove(F->get().id);
|
||||
#else
|
||||
Navigation2DServer::get_singleton()->region_set_map(F->get().region, RID());
|
||||
#endif
|
||||
}
|
||||
q.navpoly_ids.clear();
|
||||
}
|
||||
@ -163,7 +171,11 @@ void RTileMap::_update_quadrant_transform() {
|
||||
|
||||
if (navigation) {
|
||||
for (Map<PosKey, Quadrant::NavPoly>::Element *F = q.navpoly_ids.front(); F; F = F->next()) {
|
||||
#if VERSION_MINOR < 5
|
||||
navigation->navpoly_set_transform(F->get().id, nav_rel * F->get().xform);
|
||||
#else
|
||||
Navigation2DServer::get_singleton()->region_set_transform(F->get().region, nav_rel * F->get().xform);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -390,7 +402,11 @@ void RTileMap::update_dirty_quadrants() {
|
||||
|
||||
if (navigation) {
|
||||
for (Map<PosKey, Quadrant::NavPoly>::Element *E = q.navpoly_ids.front(); E; E = E->next()) {
|
||||
#if VERSION_MINOR < 5
|
||||
navigation->navpoly_remove(E->get().id);
|
||||
#else
|
||||
Navigation2DServer::get_singleton()->region_set_map(E->get().region, RID());
|
||||
#endif
|
||||
}
|
||||
q.navpoly_ids.clear();
|
||||
}
|
||||
@ -637,10 +653,20 @@ void RTileMap::update_dirty_quadrants() {
|
||||
xform.set_origin(offset.floor() + q.pos);
|
||||
_fix_cell_transform(xform, c, npoly_ofs, s);
|
||||
|
||||
#if VERSION_MINOR < 5
|
||||
int pid = navigation->navpoly_add(navpoly, nav_rel * xform);
|
||||
|
||||
#else
|
||||
RID region = Navigation2DServer::get_singleton()->region_create();
|
||||
Navigation2DServer::get_singleton()->region_set_map(region, navigation->get_rid());
|
||||
Navigation2DServer::get_singleton()->region_set_transform(region, nav_rel * xform);
|
||||
Navigation2DServer::get_singleton()->region_set_navpoly(region, navpoly);
|
||||
#endif
|
||||
Quadrant::NavPoly np;
|
||||
#if VERSION_MINOR < 5
|
||||
np.id = pid;
|
||||
#else
|
||||
np.region = region;
|
||||
#endif
|
||||
np.xform = xform;
|
||||
q.navpoly_ids[E->key()] = np;
|
||||
|
||||
@ -834,7 +860,11 @@ void RTileMap::_erase_quadrant(Map<PosKey, Quadrant>::Element *Q) {
|
||||
|
||||
if (navigation) {
|
||||
for (Map<PosKey, Quadrant::NavPoly>::Element *E = q.navpoly_ids.front(); E; E = E->next()) {
|
||||
#if VERSION_MINOR < 5
|
||||
navigation->navpoly_remove(E->get().id);
|
||||
#else
|
||||
Navigation2DServer::get_singleton()->region_set_map(E->get().region, RID());
|
||||
#endif
|
||||
}
|
||||
q.navpoly_ids.clear();
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "scene/2d/navigation_2d.h"
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "tile_set.h"
|
||||
#include "core/version.h"
|
||||
|
||||
#include "../fastnoise/noise.h"
|
||||
|
||||
@ -146,7 +147,11 @@ private:
|
||||
SelfList<Quadrant> dirty_list;
|
||||
|
||||
struct NavPoly {
|
||||
#if VERSION_MINOR < 5
|
||||
int id;
|
||||
#else
|
||||
RID region;
|
||||
#endif
|
||||
Transform2D xform;
|
||||
};
|
||||
|
||||
|
@ -30,12 +30,13 @@
|
||||
|
||||
#include "tile_map_editor_plugin.h"
|
||||
|
||||
#include "editor/plugins/canvas_item_editor_plugin.h"
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/os/input.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/version.h"
|
||||
#include "editor/editor_scale.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/plugins/canvas_item_editor_plugin.h"
|
||||
#include "scene/gui/split_container.h"
|
||||
|
||||
void RTileMapEditor::_node_removed(Node *p_node) {
|
||||
@ -2132,10 +2133,18 @@ void RTileMapEditorPlugin::_notification(int p_what) {
|
||||
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
||||
switch ((int)EditorSettings::get_singleton()->get("editors/tile_map/editor_side")) {
|
||||
case 0: { // Left.
|
||||
#if VERSION_MINOR < 5
|
||||
CanvasItemEditor::get_singleton()->get_palette_split()->move_child(tile_map_editor, 0);
|
||||
#else
|
||||
CanvasItemEditor::get_singleton()->move_control_to_left_panel(tile_map_editor);
|
||||
#endif
|
||||
} break;
|
||||
case 1: { // Right.
|
||||
#if VERSION_MINOR < 5
|
||||
CanvasItemEditor::get_singleton()->get_palette_split()->move_child(tile_map_editor, 1);
|
||||
#else
|
||||
CanvasItemEditor::get_singleton()->move_control_to_right_panel(tile_map_editor);
|
||||
#endif
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user