diff options
author | BlockMen <nmuelll@web.de> | 2014-04-12 13:50:22 +0200 |
---|---|---|
committer | BlockMen <nmuelll@web.de> | 2014-04-12 20:04:12 +0200 |
commit | 8b02a015eb7630c25e255ffe400bb714d023609b (patch) | |
tree | 42a7d9bd217a04574767f9c202536bdebafa53c3 /src/script | |
parent | c0ab09af747fc431dfb459ede30788cb9cd1c56b (diff) | |
download | minetest-8b02a015eb7630c25e255ffe400bb714d023609b.tar.gz minetest-8b02a015eb7630c25e255ffe400bb714d023609b.tar.bz2 minetest-8b02a015eb7630c25e255ffe400bb714d023609b.zip |
Use integers instead of float values
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/common/c_converter.cpp | 13 | ||||
-rw-r--r-- | src/script/common/c_converter.h | 1 | ||||
-rw-r--r-- | src/script/lua_api/l_object.cpp | 4 |
3 files changed, 16 insertions, 2 deletions
diff --git a/src/script/common/c_converter.cpp b/src/script/common/c_converter.cpp index df86f2daf..b2ef0573c 100644 --- a/src/script/common/c_converter.cpp +++ b/src/script/common/c_converter.cpp @@ -59,6 +59,19 @@ v2s16 read_v2s16(lua_State *L, int index) return p; } +v2s32 read_v2s32(lua_State *L, int index) +{ + v2s32 p; + luaL_checktype(L, index, LUA_TTABLE); + lua_getfield(L, index, "x"); + p.X = lua_tonumber(L, -1); + lua_pop(L, 1); + lua_getfield(L, index, "y"); + p.Y = lua_tonumber(L, -1); + lua_pop(L, 1); + return p; +} + v2f read_v2f(lua_State *L, int index) { v2f p; diff --git a/src/script/common/c_converter.h b/src/script/common/c_converter.h index ab0083124..0c051a803 100644 --- a/src/script/common/c_converter.h +++ b/src/script/common/c_converter.h @@ -75,6 +75,7 @@ v3s16 check_v3s16 (lua_State *L, int index); v3f read_v3f (lua_State *L, int index); v2f read_v2f (lua_State *L, int index); v2s16 read_v2s16 (lua_State *L, int index); +v2s32 read_v2s32 (lua_State *L, int index); video::SColor readARGB8 (lua_State *L, int index); aabb3f read_aabb3f (lua_State *L, int index, f32 scale); v3s16 read_v3s16 (lua_State *L, int index); diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 8f2bde036..5e3ddd235 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -415,10 +415,10 @@ int ObjectRef::l_set_local_animation(lua_State *L) if (player == NULL) return 0; // Do it - v2f frames[4]; + v2s32 frames[4]; for (int i=0;i<4;i++) { if(!lua_isnil(L, 2+1)) - frames[i] = read_v2f(L, 2+i); + frames[i] = read_v2s32(L, 2+i); } float frame_speed = 30; if(!lua_isnil(L, 6)) |