SQBool sq_instanceof(HSQUIRRELVM v) { SQObjectPtr &inst = stack_get(v,-1); SQObjectPtr &cl = stack_get(v,-2); if(type(inst) != OT_INSTANCE || type(cl) != OT_CLASS) return sq_throwerror(v,_SC("invalid param type")); return _instance(inst)->InstanceOf(_class(cl))?SQTrue:SQFalse; }
SQRESULT sq_newclass(HSQUIRRELVM v,SQBool hasbase) { SQClass *baseclass = NULL; if(hasbase) { SQObjectPtr &base = stack_get(v,-1); if(type(base) != OT_CLASS) return sq_throwerror(v,_SC("invalid base type")); baseclass = _class(base); } SQClass *newclass = SQClass::Create(_ss(v), baseclass); if(baseclass) v->Pop(); v->Push(newclass); return SQ_OK; }
void SQSharedState::MarkObject(SQObjectPtr &o,SQCollectable **chain) { switch(type(o)){ case OT_TABLE:_table(o)->Mark(chain);break; case OT_ARRAY:_array(o)->Mark(chain);break; case OT_USERDATA:_userdata(o)->Mark(chain);break; case OT_CLOSURE:_closure(o)->Mark(chain);break; case OT_NATIVECLOSURE:_nativeclosure(o)->Mark(chain);break; case OT_GENERATOR:_generator(o)->Mark(chain);break; case OT_THREAD:_thread(o)->Mark(chain);break; case OT_CLASS:_class(o)->Mark(chain);break; case OT_INSTANCE:_instance(o)->Mark(chain);break; case OT_OUTER:_outer(o)->Mark(chain);break; default: break; //shutup compiler } }
/** HasClasses **/ Class& Namespace::addClass(string name) { Class _class(name, *this); this->_classes.insert( pair<string, Class>(name, _class) ); return this->getClass(name); }
CharacterData() : ObjectInformation(_class("PEDS")) { }
ObjectData() : ObjectInformation(_class("OBJS")) { }
CutsceneObjectData() : ObjectInformation(_class("HIER")) { }
VehicleData() : ObjectInformation(_class("CARS")) { }