From c38774eb23527f0e99a3d90e023ade6074100144 Mon Sep 17 00:00:00 2001 From: Arvid Norlander Date: Thu, 18 Jan 2007 20:20:20 +0000 Subject: [PATCH] Reverted change of src/Jamfile in 4471 as it prevented miniswig from updating src/scripting/wrapper.?pp. SVN-Revision: 4595 --- src/Jamfile | 4 +--- src/scripting/wrapper.cpp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/Jamfile b/src/Jamfile index 320b28f72..6d29ef0bf 100644 --- a/src/Jamfile +++ b/src/Jamfile @@ -20,13 +20,11 @@ sources = [ Wildcard trigger : *.cpp *.hpp ] [ Wildcard video : *.cpp *.hpp ] [ Wildcard worldmap : *.cpp *.hpp ] - [ Wildcard scripting : *.cpp *.hpp ] ; TRANSLATABLE_SOURCES += [ SearchSource $(sources) ] ; #Application supertux : $(sources) $(wrapper_objects) ; -#Application supertux : $(sources) $(wrapper_objects) : linkerfile ; -Application supertux : $(sources) : linkerfile ; +Application supertux : $(sources) $(wrapper_objects) : linkerfile ; C++Flags supertux : -DAPPDATADIR=\'\"$(appdatadir)\"\' ; LinkWith supertux : squirrel ; ExternalLibs supertux : SDL SDLIMAGE GL OPENAL VORBIS VORBISFILE OGG ICONV PHYSFS BINRELOC ; diff --git a/src/scripting/wrapper.cpp b/src/scripting/wrapper.cpp index 0a0e47358..6ee9ab6f8 100644 --- a/src/scripting/wrapper.cpp +++ b/src/scripting/wrapper.cpp @@ -1467,6 +1467,35 @@ static SQInteger Player_do_jump_wrapper(HSQUIRRELVM vm) } +static SQInteger Player_trigger_sequence_wrapper(HSQUIRRELVM vm) +{ + SQUserPointer data; + if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) { + sq_throwerror(vm, _SC("'trigger_sequence' called without instance")); + return SQ_ERROR; + } + Scripting::Player* _this = reinterpret_cast (data); + const SQChar* arg0; + if(SQ_FAILED(sq_getstring(vm, 2, &arg0))) { + sq_throwerror(vm, _SC("Argument 1 not a string")); + return SQ_ERROR; + } + + try { + _this->trigger_sequence(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 'trigger_sequence'")); + return SQ_ERROR; + } + +} + static SQInteger FloatingImage_release_hook(SQUserPointer ptr, SQInteger ) { Scripting::FloatingImage* _this = reinterpret_cast (ptr); @@ -4190,6 +4219,12 @@ void register_supertux_wrapper(HSQUIRRELVM v) throw SquirrelError(v, "Couldn't register function 'do_jump'"); } + sq_pushstring(v, "trigger_sequence", -1); + sq_newclosure(v, &Player_trigger_sequence_wrapper, 0); + if(SQ_FAILED(sq_createslot(v, -3))) { + throw SquirrelError(v, "Couldn't register function 'trigger_sequence'"); + } + if(SQ_FAILED(sq_createslot(v, -3))) { throw SquirrelError(v, "Couldn't register class 'Player'"); } -- 2.11.0