Oolite
Loading...
Searching...
No Matches
OOJSPlayer.h File Reference
import "PlayerEntity.h"
import <Foundation/Foundation.h>
#include <quickjs.h>
Include dependency graph for OOJSPlayer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void InitOOJSPlayer (JSContext *context, JSValueConst global)
JSClassID JSPlayerClassID (void)
JSValue JSPlayerObject (void)
PlayerEntity * OOPlayerForScripting (void)

Function Documentation

◆ InitOOJSPlayer()

void InitOOJSPlayer ( JSContext * context,
JSValueConst global )

Definition at line 138 of file OOJSPlayer.m.

139{
141 OOJSInitClass(context, global, sPlayerClassID, JS_UNDEFINED, OOJSUnconstructableConstruct, 0,
144
145 /* Create player object as a property of the global object. As before, it
146 has no private data. The global object owns the only reference; the
147 property is read-only and permanent, so JSPlayerObject() can look it
148 up there rather than keeping a reference that must be dropped on
149 reset.
150 */
151 JSValue playerObject = JS_NewObjectClass(context, (int)sPlayerClassID);
152 JS_DefinePropertyValueStr(context, global, "player", playerObject, OOJS_PROP_READONLY);
153}
static JSClass sPlayerClass
Definition OOJSPlayer.m:63
static JSPropertySpec sPlayerProperties[]
Definition OOJSPlayer.m:104
static JSFunctionSpec sPlayerMethods[]
Definition OOJSPlayer.m:131
void OOJSRegisterObjectConverter(JSClass *theClass, OOJSClassConverterCallback converter)
JSBool OOJSUnconstructableConstruct(JSContext *context, uintN argc, jsval *vp)
#define OOJS_PROP_READONLY
id OOJSBasicPrivateObjectConverter(JSContext *context, JSObject *object)
static JSClassID sPlayerClassID
Definition OOJSPlayer.m:41
JSClassID OOJSRegisterClass(JSClassID *ioClassID, const JSClassDef *classDef)
Definition OOJSClasses.m:61
JSValueConst OOJSInitClass(JSContext *context, JSValueConst global, JSClassID classID, JSValueConst parentPrototype, JSCFunction *constructor, int constructorArgCount, const JSCFunctionListEntry *properties, size_t propertyCount, const JSCFunctionListEntry *methods, size_t methodCount, const JSCFunctionListEntry *staticMethods, size_t staticMethodCount)
#define OOJS_COUNT(array)

References OOJS_COUNT, OOJS_PROP_READONLY, OOJSBasicPrivateObjectConverter(), OOJSInitClass(), OOJSRegisterClass(), OOJSRegisterObjectConverter(), OOJSUnconstructableConstruct(), sPlayerClass, sPlayerClassID, sPlayerMethods, and sPlayerProperties.

Here is the call graph for this function:

◆ JSPlayerClassID()

JSClassID JSPlayerClassID ( void )

Definition at line 155 of file OOJSPlayer.m.

156{
157 return sPlayerClassID;
158}

References sPlayerClassID.

◆ JSPlayerObject()

JSValue JSPlayerObject ( void )

Definition at line 170 of file OOJSPlayer.m.

171{
172 return sPlayerObject;
173}
static JSObject * sPlayerObject
Definition OOJSPlayer.m:42

References OOJSAcquireContext(), and OOJSRelinquishContext().

Here is the call graph for this function:

◆ OOPlayerForScripting()

PlayerEntity * OOPlayerForScripting ( void )

Definition at line 175 of file OOJSPlayer.m.

176{
177 PlayerEntity* player = PLAYER;
178 [player setScriptTarget:player];
179
180 return player;
181}
#define PLAYER

References PLAYER, and PlayerEntity::setScriptTarget:.

Referenced by PlayerAddMessageToArrivalReport(), PlayerAddMessageToArrivalReport(), PlayerAudioMessage(), PlayerAudioMessage(), PlayerGetProperty(), PlayerGetProperty(), PlayerReplaceShip(), PlayerReplaceShip(), PlayerSetEscapePodDestination(), PlayerSetEscapePodDestination(), PlayerSetPlayerRole(), PlayerSetPlayerRole(), PlayerSetProperty(), and PlayerSetProperty().

Here is the call graph for this function:
Here is the caller graph for this function: