aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/math/vertex.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2010-08-01 08:31:50 +0000
committerEugene Sandulenko2010-10-12 22:17:11 +0000
commit53a9d2d0a1dab1119dc1cc12886321fa72743061 (patch)
tree2ffff2a8919e6b30d67f129b5fde26ac3c305e0d /engines/sword25/math/vertex.cpp
parent2f86c7a45c7c092ee294c056a9b971d2bbf64114 (diff)
downloadscummvm-rg350-53a9d2d0a1dab1119dc1cc12886321fa72743061.tar.gz
scummvm-rg350-53a9d2d0a1dab1119dc1cc12886321fa72743061.tar.bz2
scummvm-rg350-53a9d2d0a1dab1119dc1cc12886321fa72743061.zip
SWORD25: Converted the math folder files
svn-id: r53197
Diffstat (limited to 'engines/sword25/math/vertex.cpp')
-rw-r--r--engines/sword25/math/vertex.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/engines/sword25/math/vertex.cpp b/engines/sword25/math/vertex.cpp
index 5dbf99402e..61d21b58d8 100644
--- a/engines/sword25/math/vertex.cpp
+++ b/engines/sword25/math/vertex.cpp
@@ -34,31 +34,36 @@
#include "sword25/math/vertex.h"
+namespace {
+
extern "C"
{
#include "sword25/util/lua/lua.h"
#include "sword25/util/lua/lauxlib.h"
}
+}
+
// -----------------------------------------------------------------------------
-BS_Vertex & BS_Vertex::LuaVertexToVertex(lua_State * L, int StackIndex, BS_Vertex & Vertex)
-{
+namespace Sword25 {
+
+BS_Vertex &BS_Vertex::LuaVertexToVertex(lua_State *L, int StackIndex, BS_Vertex &Vertex) {
#ifdef DEBUG
int __startStackDepth = lua_gettop(L);
#endif
- // Sicherstellen, dass wir wirklich eine Tabelle betrachten
+ // Ensure that we actually consider a table
luaL_checktype(L, StackIndex, LUA_TTABLE);
- // X Komponente auslesen
+ // Read X Component
lua_pushstring(L, "X");
lua_gettable(L, StackIndex);
if (!lua_isnumber(L, -1)) luaL_argcheck(L, 0, StackIndex, "the X component has to be a number");
Vertex.X = static_cast<int>(lua_tonumber(L, -1));
lua_pop(L, 1);
- // Y Komponente auslesen
+ // Read Y Component
lua_pushstring(L, "Y");
lua_gettable(L, StackIndex);
if (!lua_isnumber(L, -1)) luaL_argcheck(L, 0, StackIndex, "the Y component has to be a number");
@@ -74,18 +79,19 @@ BS_Vertex & BS_Vertex::LuaVertexToVertex(lua_State * L, int StackIndex, BS_Verte
// -----------------------------------------------------------------------------
-void BS_Vertex::VertexToLuaVertex(lua_State * L, const BS_Vertex & Vertex)
-{
- // Neue Tabelle erstellen
+void BS_Vertex::VertexToLuaVertex(lua_State * L, const BS_Vertex &Vertex) {
+ // Create New Table
lua_newtable(L);
- // X-Wert in die Tabelle schreiben
+ // X value is written to table
lua_pushstring(L, "X");
lua_pushnumber(L, Vertex.X);
lua_settable(L, -3);
- // Y-Wert in die Tabelle schreiben
+ // Y value is written to table
lua_pushstring(L, "Y");
lua_pushnumber(L, Vertex.Y);
lua_settable(L, -3);
}
+
+} // End of namespace Sword25