Example #1
0
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;
}
Example #2
0
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;
}
Example #3
0
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
	}
}
Example #4
0
/** HasClasses **/
Class& Namespace::addClass(string name) {
	Class _class(name, *this);
	this->_classes.insert( pair<string, Class>(name, _class) );
	return this->getClass(name);
}
Example #5
0
	CharacterData()
		: ObjectInformation(_class("PEDS")) { }
Example #6
0
	ObjectData()
		: ObjectInformation(_class("OBJS")) { }
Example #7
0
	CutsceneObjectData()
		: ObjectInformation(_class("HIER")) { }
Example #8
0
	VehicleData()
		: ObjectInformation(_class("CARS")) { }