summaryrefslogtreecommitdiff
path: root/servers/physics_2d/physics_2d_server_sw.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-11-09 23:34:01 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-11-09 23:35:34 -0300
commit192a4d7de5c557bdfe83bd180cd603d7e280ebd4 (patch)
tree94ce9779b3f84fbc320ba83624e326d487ca1c04 /servers/physics_2d/physics_2d_server_sw.cpp
parent0de6cba7e7e114f71fabb3dbe02cf260f7d3e2c6 (diff)
Reworked how servers preallocate RIDs, should fix #10970
Diffstat (limited to 'servers/physics_2d/physics_2d_server_sw.cpp')
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp47
1 files changed, 39 insertions, 8 deletions
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index 5d3305c82d..475a3fe3b3 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -35,7 +35,7 @@
#include "project_settings.h"
#include "script_language.h"
-RID Physics2DServerSW::shape_create(ShapeType p_shape) {
+RID Physics2DServerSW::_shape_create(ShapeType p_shape) {
Shape2DSW *shape = NULL;
switch (p_shape) {
@@ -83,7 +83,42 @@ RID Physics2DServerSW::shape_create(ShapeType p_shape) {
shape->set_self(id);
return id;
-};
+}
+
+RID Physics2DServerSW::line_shape_create() {
+
+ return _shape_create(SHAPE_LINE);
+}
+
+RID Physics2DServerSW::ray_shape_create() {
+
+ return _shape_create(SHAPE_RAY);
+}
+RID Physics2DServerSW::segment_shape_create() {
+
+ return _shape_create(SHAPE_SEGMENT);
+}
+RID Physics2DServerSW::circle_shape_create() {
+
+ return _shape_create(SHAPE_CIRCLE);
+}
+RID Physics2DServerSW::rectangle_shape_create() {
+
+ return _shape_create(SHAPE_RECTANGLE);
+}
+RID Physics2DServerSW::capsule_shape_create() {
+
+ return _shape_create(SHAPE_CAPSULE);
+}
+
+RID Physics2DServerSW::convex_polygon_shape_create() {
+
+ return _shape_create(SHAPE_CONVEX_POLYGON);
+}
+RID Physics2DServerSW::concave_polygon_shape_create() {
+
+ return _shape_create(SHAPE_CONCAVE_POLYGON);
+}
void Physics2DServerSW::shape_set_data(RID p_shape, const Variant &p_data) {
@@ -519,17 +554,13 @@ void Physics2DServerSW::area_set_area_monitor_callback(RID p_area, Object *p_rec
/* BODY API */
-RID Physics2DServerSW::body_create(BodyMode p_mode, bool p_init_sleeping) {
+RID Physics2DServerSW::body_create() {
Body2DSW *body = memnew(Body2DSW);
- if (p_mode != BODY_MODE_RIGID)
- body->set_mode(p_mode);
- if (p_init_sleeping)
- body->set_state(BODY_STATE_SLEEPING, p_init_sleeping);
RID rid = body_owner.make_rid(body);
body->set_self(rid);
return rid;
-};
+}
void Physics2DServerSW::body_set_space(RID p_body, RID p_space) {