}
-static int add_key_wrapper(HSQUIRRELVM vm)
-{
- int arg0;
- if(SQ_FAILED(sq_getinteger(vm, 2, &arg0))) {
- sq_throwerror(vm, _SC("Argument 1 not an integer"));
- return SQ_ERROR;
- }
-
- try {
- Scripting::add_key(arg0);
-
- return 0;
-
- } catch(std::exception& e) {
- sq_throwerror(vm, e.what());
- return SQ_ERROR;
- } catch(...) {
- sq_throwerror(vm, _SC("Unexpected exception while executing function 'add_key'"));
- return SQ_ERROR;
- }
-
-}
-
static int debug_collrects_wrapper(HSQUIRRELVM vm)
{
SQBool arg0;
{
using namespace Wrapper;
- sq_pushstring(v, "KEY_BRASS", -1);
- sq_pushinteger(v, 1);
- if(SQ_FAILED(sq_createslot(v, -3))) {
- throw SquirrelError(v, "Couldn't register constant 'KEY_BRASS'");
- }
-
- sq_pushstring(v, "KEY_IRON", -1);
- sq_pushinteger(v, 2);
- if(SQ_FAILED(sq_createslot(v, -3))) {
- throw SquirrelError(v, "Couldn't register constant 'KEY_IRON'");
- }
-
- sq_pushstring(v, "KEY_BRONZE", -1);
- sq_pushinteger(v, 4);
- if(SQ_FAILED(sq_createslot(v, -3))) {
- throw SquirrelError(v, "Couldn't register constant 'KEY_BRONZE'");
- }
-
- sq_pushstring(v, "KEY_SILVER", -1);
- sq_pushinteger(v, 8);
- if(SQ_FAILED(sq_createslot(v, -3))) {
- throw SquirrelError(v, "Couldn't register constant 'KEY_SILVER'");
- }
-
- sq_pushstring(v, "KEY_GOLD", -1);
- sq_pushinteger(v, 16);
- if(SQ_FAILED(sq_createslot(v, -3))) {
- throw SquirrelError(v, "Couldn't register constant 'KEY_GOLD'");
- }
-
sq_pushstring(v, "ANCHOR_TOP", -1);
sq_pushinteger(v, 16);
if(SQ_FAILED(sq_createslot(v, -3))) {
throw SquirrelError(v, "Couldn't register function 'save_state'");
}
- sq_pushstring(v, "add_key", -1);
- sq_newclosure(v, &add_key_wrapper, 0);
- if(SQ_FAILED(sq_createslot(v, -3))) {
- throw SquirrelError(v, "Couldn't register function 'add_key'");
- }
-
sq_pushstring(v, "debug_collrects", -1);
sq_newclosure(v, &debug_collrects_wrapper, 0);
if(SQ_FAILED(sq_createslot(v, -3))) {