summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-29 17:45:00 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-29 17:45:00 +0100
commitd023589a192004ac20c18c40a73db1142364cde1 (patch)
tree478fdcf305ea0bcf129fedd4b00f5d23b195dfd7
parentBlockArea: Finished rotation and mirroring with meta. Implemented example meta handling for vines, stairs and torches. (diff)
downloadcuberite-d023589a192004ac20c18c40a73db1142364cde1.tar
cuberite-d023589a192004ac20c18c40a73db1142364cde1.tar.gz
cuberite-d023589a192004ac20c18c40a73db1142364cde1.tar.bz2
cuberite-d023589a192004ac20c18c40a73db1142364cde1.tar.lz
cuberite-d023589a192004ac20c18c40a73db1142364cde1.tar.xz
cuberite-d023589a192004ac20c18c40a73db1142364cde1.tar.zst
cuberite-d023589a192004ac20c18c40a73db1142364cde1.zip
Diffstat (limited to '')
-rw-r--r--source/Bindings.cpp247
-rw-r--r--source/Bindings.h2
-rw-r--r--source/Cuboid.cpp15
-rw-r--r--source/Cuboid.h81
4 files changed, 232 insertions, 113 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index b3efb335d..f21cccee9 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 03/24/13 22:28:30.
+** Generated automatically by tolua++-1.0.92 on 03/29/13 17:37:21.
*/
#ifndef __cplusplus
@@ -17185,6 +17185,66 @@ static int tolua_set_Vector3i_z(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* get function: p1 of class cCuboid */
+#ifndef TOLUA_DISABLE_tolua_get_cCuboid_p1
+static int tolua_get_cCuboid_p1(lua_State* tolua_S)
+{
+ cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p1'",NULL);
+#endif
+ tolua_pushusertype(tolua_S,(void*)&self->p1,"Vector3i");
+ return 1;
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* set function: p1 of class cCuboid */
+#ifndef TOLUA_DISABLE_tolua_set_cCuboid_p1
+static int tolua_set_cCuboid_p1(lua_State* tolua_S)
+{
+ cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p1'",NULL);
+ if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3i",0,&tolua_err)))
+ tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
+#endif
+ self->p1 = *((Vector3i*) tolua_tousertype(tolua_S,2,0))
+;
+ return 0;
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* get function: p2 of class cCuboid */
+#ifndef TOLUA_DISABLE_tolua_get_cCuboid_p2
+static int tolua_get_cCuboid_p2(lua_State* tolua_S)
+{
+ cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p2'",NULL);
+#endif
+ tolua_pushusertype(tolua_S,(void*)&self->p2,"Vector3i");
+ return 1;
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* set function: p2 of class cCuboid */
+#ifndef TOLUA_DISABLE_tolua_set_cCuboid_p2
+static int tolua_set_cCuboid_p2(lua_State* tolua_S)
+{
+ cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p2'",NULL);
+ if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3i",0,&tolua_err)))
+ tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
+#endif
+ self->p2 = *((Vector3i*) tolua_tousertype(tolua_S,2,0))
+;
+ return 0;
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: new of class cCuboid */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new00
static int tolua_AllToLua_cCuboid_new00(lua_State* tolua_S)
@@ -17348,92 +17408,128 @@ tolua_lerror:
}
#endif //#ifndef TOLUA_DISABLE
-/* get function: p1 of class cCuboid */
-#ifndef TOLUA_DISABLE_tolua_get_cCuboid_p1
-static int tolua_get_cCuboid_p1(lua_State* tolua_S)
+/* method: Sort of class cCuboid */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_Sort00
+static int tolua_AllToLua_cCuboid_Sort00(lua_State* tolua_S)
{
- cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p1'",NULL);
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cCuboid",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
#endif
- tolua_pushusertype(tolua_S,(void*)&self->p1,"Vector3i");
- return 1;
-}
-#endif //#ifndef TOLUA_DISABLE
-
-/* set function: p1 of class cCuboid */
-#ifndef TOLUA_DISABLE_tolua_set_cCuboid_p1
-static int tolua_set_cCuboid_p1(lua_State* tolua_S)
-{
+ {
cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p1'",NULL);
- if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3i",0,&tolua_err)))
- tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Sort'", NULL);
#endif
- self->p1 = *((Vector3i*) tolua_tousertype(tolua_S,2,0))
-;
+ {
+ self->Sort();
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'Sort'.",&tolua_err);
return 0;
+#endif
}
#endif //#ifndef TOLUA_DISABLE
-/* get function: p2 of class cCuboid */
-#ifndef TOLUA_DISABLE_tolua_get_cCuboid_p2
-static int tolua_get_cCuboid_p2(lua_State* tolua_S)
+/* method: DifX of class cCuboid */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_DifX00
+static int tolua_AllToLua_cCuboid_DifX00(lua_State* tolua_S)
{
- cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p2'",NULL);
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
#endif
- tolua_pushusertype(tolua_S,(void*)&self->p2,"Vector3i");
+ {
+ const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DifX'", NULL);
+#endif
+ {
+ int tolua_ret = (int) self->DifX();
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
+ }
+ }
return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'DifX'.",&tolua_err);
+ return 0;
+#endif
}
#endif //#ifndef TOLUA_DISABLE
-/* set function: p2 of class cCuboid */
-#ifndef TOLUA_DISABLE_tolua_set_cCuboid_p2
-static int tolua_set_cCuboid_p2(lua_State* tolua_S)
+/* method: DifY of class cCuboid */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_DifY00
+static int tolua_AllToLua_cCuboid_DifY00(lua_State* tolua_S)
{
- cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
- tolua_Error tolua_err;
- if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p2'",NULL);
- if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3i",0,&tolua_err)))
- tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
#endif
- self->p2 = *((Vector3i*) tolua_tousertype(tolua_S,2,0))
-;
+ {
+ const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DifY'", NULL);
+#endif
+ {
+ int tolua_ret = (int) self->DifY();
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'DifY'.",&tolua_err);
return 0;
+#endif
}
#endif //#ifndef TOLUA_DISABLE
-/* method: Sort of class cCuboid */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_Sort00
-static int tolua_AllToLua_cCuboid_Sort00(lua_State* tolua_S)
+/* method: DifZ of class cCuboid */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_DifZ00
+static int tolua_AllToLua_cCuboid_DifZ00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
- !tolua_isusertype(tolua_S,1,"cCuboid",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
- cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0);
+ const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Sort'", NULL);
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DifZ'", NULL);
#endif
{
- self->Sort();
+ int tolua_ret = (int) self->DifZ();
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
}
}
- return 0;
+ return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'Sort'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'DifZ'.",&tolua_err);
return 0;
#endif
}
@@ -18853,9 +18949,9 @@ static int tolua_AllToLua_cBlockArea_RelLine00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
-/* method: RotateCW of class cBlockArea */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCW00
-static int tolua_AllToLua_cBlockArea_RotateCW00(lua_State* tolua_S)
+/* method: RotateCCW of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCCW00
+static int tolua_AllToLua_cBlockArea_RotateCCW00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
@@ -18869,24 +18965,24 @@ static int tolua_AllToLua_cBlockArea_RotateCW00(lua_State* tolua_S)
{
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCW'", NULL);
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCCW'", NULL);
#endif
{
- self->RotateCW();
+ self->RotateCCW();
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'RotateCW'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'RotateCCW'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
-/* method: RotateCCW of class cBlockArea */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCCW00
-static int tolua_AllToLua_cBlockArea_RotateCCW00(lua_State* tolua_S)
+/* method: RotateCW of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCW00
+static int tolua_AllToLua_cBlockArea_RotateCW00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
@@ -18900,16 +18996,16 @@ static int tolua_AllToLua_cBlockArea_RotateCCW00(lua_State* tolua_S)
{
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCCW'", NULL);
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCW'", NULL);
#endif
{
- self->RotateCCW();
+ self->RotateCW();
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'RotateCCW'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'RotateCW'.",&tolua_err);
return 0;
#endif
}
@@ -19008,9 +19104,9 @@ static int tolua_AllToLua_cBlockArea_MirrorYZ00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
-/* method: RotateCWNoMeta of class cBlockArea */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCWNoMeta00
-static int tolua_AllToLua_cBlockArea_RotateCWNoMeta00(lua_State* tolua_S)
+/* method: RotateCCWNoMeta of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCCWNoMeta00
+static int tolua_AllToLua_cBlockArea_RotateCCWNoMeta00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
@@ -19024,24 +19120,24 @@ static int tolua_AllToLua_cBlockArea_RotateCWNoMeta00(lua_State* tolua_S)
{
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCWNoMeta'", NULL);
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCCWNoMeta'", NULL);
#endif
{
- self->RotateCWNoMeta();
+ self->RotateCCWNoMeta();
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'RotateCWNoMeta'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'RotateCCWNoMeta'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
-/* method: RotateCCWNoMeta of class cBlockArea */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCCWNoMeta00
-static int tolua_AllToLua_cBlockArea_RotateCCWNoMeta00(lua_State* tolua_S)
+/* method: RotateCWNoMeta of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCWNoMeta00
+static int tolua_AllToLua_cBlockArea_RotateCWNoMeta00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
@@ -19055,16 +19151,16 @@ static int tolua_AllToLua_cBlockArea_RotateCCWNoMeta00(lua_State* tolua_S)
{
cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCCWNoMeta'", NULL);
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCWNoMeta'", NULL);
#endif
{
- self->RotateCCWNoMeta();
+ self->RotateCWNoMeta();
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'RotateCCWNoMeta'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'RotateCWNoMeta'.",&tolua_err);
return 0;
#endif
}
@@ -23242,6 +23338,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_cclass(tolua_S,"cCuboid","cCuboid","",NULL);
#endif
tolua_beginmodule(tolua_S,"cCuboid");
+ tolua_variable(tolua_S,"p1",tolua_get_cCuboid_p1,tolua_set_cCuboid_p1);
+ tolua_variable(tolua_S,"p2",tolua_get_cCuboid_p2,tolua_set_cCuboid_p2);
tolua_function(tolua_S,"new",tolua_AllToLua_cCuboid_new00);
tolua_function(tolua_S,"new_local",tolua_AllToLua_cCuboid_new00_local);
tolua_function(tolua_S,".call",tolua_AllToLua_cCuboid_new00_local);
@@ -23251,9 +23349,10 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"new",tolua_AllToLua_cCuboid_new02);
tolua_function(tolua_S,"new_local",tolua_AllToLua_cCuboid_new02_local);
tolua_function(tolua_S,".call",tolua_AllToLua_cCuboid_new02_local);
- tolua_variable(tolua_S,"p1",tolua_get_cCuboid_p1,tolua_set_cCuboid_p1);
- tolua_variable(tolua_S,"p2",tolua_get_cCuboid_p2,tolua_set_cCuboid_p2);
tolua_function(tolua_S,"Sort",tolua_AllToLua_cCuboid_Sort00);
+ tolua_function(tolua_S,"DifX",tolua_AllToLua_cCuboid_DifX00);
+ tolua_function(tolua_S,"DifY",tolua_AllToLua_cCuboid_DifY00);
+ tolua_function(tolua_S,"DifZ",tolua_AllToLua_cCuboid_DifZ00);
tolua_function(tolua_S,"IsInside",tolua_AllToLua_cCuboid_IsInside00);
tolua_function(tolua_S,"IsInside",tolua_AllToLua_cCuboid_IsInside01);
tolua_endmodule(tolua_S);
@@ -23321,13 +23420,13 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"Fill",tolua_AllToLua_cBlockArea_Fill00);
tolua_function(tolua_S,"FillRelCuboid",tolua_AllToLua_cBlockArea_FillRelCuboid00);
tolua_function(tolua_S,"RelLine",tolua_AllToLua_cBlockArea_RelLine00);
- tolua_function(tolua_S,"RotateCW",tolua_AllToLua_cBlockArea_RotateCW00);
tolua_function(tolua_S,"RotateCCW",tolua_AllToLua_cBlockArea_RotateCCW00);
+ tolua_function(tolua_S,"RotateCW",tolua_AllToLua_cBlockArea_RotateCW00);
tolua_function(tolua_S,"MirrorXY",tolua_AllToLua_cBlockArea_MirrorXY00);
tolua_function(tolua_S,"MirrorXZ",tolua_AllToLua_cBlockArea_MirrorXZ00);
tolua_function(tolua_S,"MirrorYZ",tolua_AllToLua_cBlockArea_MirrorYZ00);
- tolua_function(tolua_S,"RotateCWNoMeta",tolua_AllToLua_cBlockArea_RotateCWNoMeta00);
tolua_function(tolua_S,"RotateCCWNoMeta",tolua_AllToLua_cBlockArea_RotateCCWNoMeta00);
+ tolua_function(tolua_S,"RotateCWNoMeta",tolua_AllToLua_cBlockArea_RotateCWNoMeta00);
tolua_function(tolua_S,"MirrorXYNoMeta",tolua_AllToLua_cBlockArea_MirrorXYNoMeta00);
tolua_function(tolua_S,"MirrorXZNoMeta",tolua_AllToLua_cBlockArea_MirrorXZNoMeta00);
tolua_function(tolua_S,"MirrorYZNoMeta",tolua_AllToLua_cBlockArea_MirrorYZNoMeta00);
diff --git a/source/Bindings.h b/source/Bindings.h
index 68877e426..0dfcea988 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 03/24/13 22:28:31.
+** Generated automatically by tolua++-1.0.92 on 03/29/13 17:37:21.
*/
/* Exported function */
diff --git a/source/Cuboid.cpp b/source/Cuboid.cpp
index 7b3b24528..e50ea1faf 100644
--- a/source/Cuboid.cpp
+++ b/source/Cuboid.cpp
@@ -9,9 +9,18 @@
void cCuboid::Sort()
{
- if( p1.x > p2.x ) std::swap( p1.x, p2.x );
- if( p1.y > p2.y ) std::swap( p1.y, p2.y );
- if( p1.z > p2.z ) std::swap( p1.z, p2.z );
+ if (p1.x > p2.x)
+ {
+ std::swap(p1.x, p2.x);
+ }
+ if (p1.y > p2.y)
+ {
+ std::swap(p1.y, p2.y);
+ }
+ if (p1.z > p2.z)
+ {
+ std::swap(p1.z, p2.z);
+ }
}
diff --git a/source/Cuboid.h b/source/Cuboid.h
index 1002ff6b4..4032b66fb 100644
--- a/source/Cuboid.h
+++ b/source/Cuboid.h
@@ -1,40 +1,51 @@
+
#pragma once
#include "Vector3i.h"
#include "Vector3d.h"
-class cCuboid // tolua_export
-{ // tolua_export
-public: // tolua_export
- cCuboid() {} // tolua_export
- cCuboid( const cCuboid & a_Cuboid ) : p1( a_Cuboid.p1 ), p2( a_Cuboid.p2 ) {} // tolua_export
- cCuboid( const Vector3i & a_p1, const Vector3i & a_p2 ) : p1( a_p1 ), p2( a_p2 ) {} // tolua_export
-
-
- Vector3i p1, p2; // tolua_export
-
- void Sort(); // tolua_export
-
- bool IsInside( const Vector3i & v ) const // tolua_export
- { // tolua_export
- if( v.x >= p1.x && v.x <= p2.x
- && v.y >= p1.y && v.y <= p2.y
- && v.z >= p1.z && v.z <= p2.z )
- {
- return true;
- }
- return false;
- } // tolua_export
-
- bool IsInside( const Vector3d & v ) const // tolua_export
- { // tolua_export
- if( v.x >= p1.x && v.x <= p2.x
- && v.y >= p1.y && v.y <= p2.y
- && v.z >= p1.z && v.z <= p2.z )
- {
- return true;
- }
- return false;
- } // tolua_export
-
-}; // tolua_export
+
+
+
+
+// tolua_begin
+class cCuboid
+{
+public:
+ // p1 is expected to have the smaller of the coords; Sort() swaps coords to match this
+ Vector3i p1, p2;
+
+ cCuboid(void) {}
+ cCuboid(const cCuboid & a_Cuboid ) : p1(a_Cuboid.p1), p2(a_Cuboid.p2) {}
+ cCuboid(const Vector3i & a_p1, const Vector3i & a_p2) : p1(a_p1), p2(a_p2) {}
+
+ void Sort(void);
+
+ int DifX(void) const { return p2.x - p1.x; }
+ int DifY(void) const { return p2.y - p1.y; }
+ int DifZ(void) const { return p2.z - p1.z; }
+
+ bool IsInside(const Vector3i & v) const
+ {
+ return (
+ (v.x >= p1.x) && (v.x <= p2.x) &&
+ (v.y >= p1.y) && (v.y <= p2.y) &&
+ (v.z >= p1.z) && (v.z <= p2.z)
+ );
+ }
+
+ bool IsInside( const Vector3d & v ) const
+ {
+ return (
+ (v.x >= p1.x) && (v.x <= p2.x) &&
+ (v.y >= p1.y) && (v.y <= p2.y) &&
+ (v.z >= p1.z) && (v.z <= p2.z)
+ );
+ }
+
+} ;
+// tolua_end
+
+
+
+