mirror of
https://github.com/UOX3DevTeam/UOX3
synced 2026-08-13 12:27:04 -04:00
Fixed an issue where the JS function TriggerEvent() didn't restore the original JSContext and JSObject of the calling script after calling an event in a separate script, causing timers to be associated with the wrong script when both TriggerEvent and StartTimer were used in same script (In a previous commit) Updated KillTimers JS method to support an optional argument specifying the timerID of the timer to be killed. If no arguments are provided, it will - as previously - kill all timers for the object
51 lines
976 B
C++
51 lines
976 B
C++
#include "Prerequisites.h"
|
|
#include "typedefs.h"
|
|
enum JSEncapsObjectType
|
|
{
|
|
JSOT_INT = 0,
|
|
JSOT_DOUBLE,
|
|
JSOT_BOOL,
|
|
JSOT_STRING,
|
|
JSOT_OBJECT,
|
|
JSOT_NULL,
|
|
JSOT_VOID,
|
|
JSOT_COUNT
|
|
};
|
|
class JSEncapsulate
|
|
{
|
|
public:
|
|
|
|
JSEncapsulate( JSContext *jsCX, jsval *jsVP );
|
|
JSEncapsulate( JSContext *jsCX, JSObject *jsVP );
|
|
JSEncapsulate();
|
|
void SetContext( JSContext *jsCX, jsval *jsVP );
|
|
bool isType( JSEncapsObjectType toCheck );
|
|
SI32 toInt( void );
|
|
bool toBool( void );
|
|
R32 toFloat( void );
|
|
std::string toString( void );
|
|
void * toObject( void );
|
|
|
|
std::string ClassName( void );
|
|
private:
|
|
|
|
void InternalReset( void );
|
|
void Init( void );
|
|
bool beenParsed[JSOT_COUNT+1];
|
|
JSEncapsObjectType nativeType;
|
|
|
|
SI32 intVal;
|
|
R32 floatVal;
|
|
bool boolVal;
|
|
std::string stringVal;
|
|
void * objectVal;
|
|
|
|
JSContext * cx;
|
|
jsval * vp;
|
|
JSObject * obj;
|
|
|
|
std::string className;
|
|
bool classCached;
|
|
|
|
void Parse( JSEncapsObjectType typeConvert );
|
|
};
|