fix miniswig using wrong stack numbers in functions with HSQUIRRELVM arguments
[supertux.git] / tools / miniswig / create_wrapper.cpp
index 6956ced..7ac2e92 100644 (file)
@@ -1,9 +1,9 @@
-#include "tree.h"
+#include "tree.hpp"
 #include <iostream>
 #include <sstream>
 #include <stdexcept>
-#include "create_wrapper.h"
-#include "globals.h"
+#include "create_wrapper.hpp"
+#include "globals.hpp"
 
 void
 WrapperCreator::create_wrapper(Namespace* ns)
@@ -20,7 +20,7 @@ WrapperCreator::create_wrapper(Namespace* ns)
         << "#ifndef __" << modulename << "_WRAPPER_H__\n"
         << "#define __" << modulename << "_WRAPPER_H__\n"
         << "\n"
-        << "#include \"wrapper_util.h\"\n"
+        << "#include \"wrapper_util.hpp\"\n"
         << "\n"
         << "extern WrappedFunction " << modulename << "_global_functions[];\n"
         << "extern WrappedClass " << modulename << "_classes[];\n"
@@ -40,8 +40,8 @@ WrapperCreator::create_wrapper(Namespace* ns)
         << "#include <assert.h>\n"
         << "#include <string>\n"
         << "#include <squirrel.h>\n"
-        << "#include \"wrapper_util.h\"\n"
-        << "#include \"wrapper.interface.h\"\n"
+        << "#include \"wrapper_util.hpp\"\n"
+        << "#include \"wrapper.interface.hpp\"\n"
         << "\n";
     if(selected_namespace != "") {
         out << "using namespace " << selected_namespace << ";\n";
@@ -148,7 +148,7 @@ WrapperCreator::create_function_wrapper(Class* _class, Function* function)
             p != function->parameters.end(); ++p) {
         if(i == 0 && p->type.atomic_type == HSQUIRRELVMType::instance()) {
             out << ind << "HSQUIRRELVM arg0 = v;\n";
-            arg_offset++;
+            arg_offset--;
         } else {
             char argname[64];
             snprintf(argname, sizeof(argname), "arg%d", i);