Exemplo n.º 1
0
void CIwGameXmlParser::ShowError(eXMLParserError error, int pos) const
{
#ifdef SHOW_ERRORS
	s3eDebugOutputString(GetErrorString(error));
	s3eDebugOutputString(" at line ");
	CIwGameString num = CIwGameString(m_pDataInput->GetLineNumber(pos));
	s3eDebugOutputString(num.c_str());
#endif
}
Exemplo n.º 2
0
void CIwGameXmlNode::UpdateAttribute(CIwGameString& name, const char* value)
{
	CIwGameXmlAttribute* old_attribute = GetAttribute(name.c_str());

	if (old_attribute == NULL)
	{
		// Attribute was not present so add
		CIwGameXmlAttribute* attribute = CIwGameXmlParser::AllocAttribute();
		attribute->setName((char*)name.c_str(), name.GetLength());
		attribute->setValue((char*)value, strlen(value));
		Attributes.push_back(attribute);
	}
	else
	{
		// Attribute was present so update it
		old_attribute->setName((char*)name.c_str(), name.GetLength());
		old_attribute->setValue((char*)value, strlen(value));
	}
}
Exemplo n.º 3
0
CIwGameString::CIwGameString(const CIwGameString &string)
{
	FindIndex = 0;
	Data = NULL;
	AutoHash = true;
	if (string.c_str() == NULL)
	{
		Length = 0;
		Size = 0;
	}
	else
	{
		int len = (int)strlen(string.c_str());
		allocString(len);
		Length = len;
		strcpy(Data, string.c_str());

		if (AutoHash)
			DataHash = IwHashString(Data);
	}
}
Exemplo n.º 4
0
//
// 
// 
//
// CIwGameCommandIfVar Implementation
// 
// 
// 
//
bool CIwGameCommandIfVar::Execute(float dt)
{
	if (!IIwGameCommandExecutor::Execute(dt))
		return false;

	CIwGame* game = NULL;
	CIwGameScene* scene = NULL;
	CIwGameActor* actor = NULL;
	unsigned int class_hash = Program->getManager()->getParent()->getClassTypeHash();
	if (class_hash == CIwGameXomlNames::Game_Hash)
		game = (CIwGame*)Program->getManager()->getParent();
	else
	if (class_hash == CIwGameXomlNames::Scene_Hash)
		scene = (CIwGameScene*)Program->getManager()->getParent();

	if (game != NULL)
		scene = game->findScene(Params[3].getHash());

	IIwGameXomlResource* cont = (actor != NULL) ? (IIwGameXomlResource*)actor : (IIwGameXomlResource*)scene;
	CIwGameXomlVariable* var = CIwGameXomlVariable::GetVariable(Params[0], scene);
	if (var != NULL)
	{
		CIwGameString op = getParameter2(cont);
		op.ToLower();
		if (op == "==")
			ReturnValue = (int)var->checkCondition(CO_Equal, getParameter3(cont));
		else
		if (op == "!=")
			ReturnValue = (int)var->checkCondition(CO_NotEqual, getParameter3(cont));
		else
		if (op == "gt")
			ReturnValue = (int)var->checkCondition(CO_Greater, getParameter3(cont));
		else
		if (op == "lt")
			ReturnValue = (int)var->checkCondition(CO_Less, getParameter3(cont));
		else
		if (op == "gte")
			ReturnValue = (int)var->checkCondition(CO_GreaterEqual, getParameter3(cont));
		else
		if (op == "lte")
			ReturnValue = (int)var->checkCondition(CO_LessEqual, getParameter3(cont));
		else
		if (op == "and")
			ReturnValue = (int)var->checkCondition(CO_And, getParameter3(cont));
		else
			CIwGameError::LogError("Warning: IfVar command - operator invalid - ", op.c_str());
	}
	else
		CIwGameError::LogError("Warning: IfVar command - variable not found - ", Params[0].c_str());

	return false;
}
Exemplo n.º 5
0
bool CIwGameUITextView::InitView(bool native_res, float min_scale, float max_scale)
{
	TextActor->setTappable(false);
#if defined(_DEBUG)
	CIwGameString name = Name;
	name += "text";
	TextActor->setName(name.c_str());
#endif	// _DEBUG

	Area = TextActor->getSize();

	MinZoom = min_scale;
	MaxZoom = max_scale;

	return true;
}
Exemplo n.º 6
0
bool CIwGameString::operator==	(const CIwGameString &op)
{
	if (Data == NULL)
		return false;

	if (AutoHash && op.isAutohash())
	{
		if (DataHash == op.getHash())
			return true;
	}
	else
	{
		if (strcmp(op.c_str(), Data) == 0)
			return true;
	}
	return false;
}
Exemplo n.º 7
0
//
//
//
//	MobFox specific implementation
//
//
//
bool CIwGameAds::RequestAdMobFox()
{
	// Build request URI string
	RequestURI = "http://my.mobfox.com/request.php";

	CIwGameString body;
	CIwGameString urlencoded;

	body = "rt=api";
	body += "&u=";
	urlencoded.URLEncode(UserAgent.c_str());
	body += urlencoded;
	body += "&i=";
	body += IW_GAME_HTTP_MANAGER->getIPAddress();
	body += "&o=";
	body += CIwGameString(UDID);
	body += "&m=live";
	body += "&s=";
	body += ApplicationID;
	if (!ExtraInfo.IsEmpty())
	{
		body += ExtraInfo;
	}

	AdRequest.setPOST();
	AdRequest.setURI(RequestURI.c_str());
	AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
	AdRequest.SetHeader("User-Agent", UserAgent.c_str());
	AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
	AdRequest.SetHeader("Content-Length", CIwGameString(body.GetLength()).c_str());
	AdRequest.setBody(body.c_str());
	IW_GAME_HTTP_MANAGER->AddRequest(&AdRequest);
	BusyTimer.setDuration(IW_GAME_ADS_TIMEOUT);

	return true;
}
Exemplo n.º 8
0
bool CIwGameImage::LoadFromXoml(IIwGameXomlResource* parent, bool load_children, CIwGameXmlNode* node)
{
	// Process image attributes
	CIwGameString* name = NULL;
	CIwGameString* location = NULL;
	bool preload = true;
	bool blocking = false;
	CIwGameString* condition = NULL;

	CIwGameScene* scene = NULL;
	if (parent != NULL && parent->getClassTypeHash() == CIwGameXomlNames::Actor_Hash)
		scene = ((CIwGameActor*)parent)->getScene();
	else
	if (parent != NULL && parent->getClassTypeHash() == CIwGameXomlNames::Scene_Hash)
		scene = (CIwGameScene*)parent;

	for (CIwGameXmlNode::_AttribIterator it = node->attribs_begin(); it != node->attribs_end(); it++)
	{
		unsigned int name_hash = (*it)->getName().getHash();

		if (name_hash == CIwGameXomlNames::Name_Hash)
		{
			name = &(*it)->GetValue();
			setName(name->c_str());
		}
		else
		if (name_hash == CIwGameXomlNames::Tag_Hash)
			setTag((*it)->GetValue().c_str());
		else
		if (name_hash == CIwGameXomlNames::Location_Hash)
			location = &(*it)->GetValue();
		else
 		if (name_hash == CIwGameXomlNames::Preload_Hash)
			preload = (*it)->GetValueAsBool();
		else
 		if (name_hash == CIwGameXomlNames::Blocking_Hash)
			blocking = (*it)->GetValueAsBool();
		else
		if (name_hash == CIwGameXomlNames::Condition_Hash)
			condition = &(*it)->GetValue();
		else
		if (name_hash == CIwGameXomlNames::Format_Hash)
		{
			FormatSet = true;
			unsigned int format_hash = (*it)->GetValue().getHash();
			if (format_hash == IW_GAME_HASH("RGB_565"))
				Format = CIwImage::RGB_565;
			else
			if (format_hash == IW_GAME_HASH("RGBA_4444"))
				Format = CIwImage::RGBA_4444;
			else
			if (format_hash == IW_GAME_HASH("RGBA_5551"))
				Format = CIwImage::RGBA_5551;
			else
			if (format_hash == IW_GAME_HASH("RGB_888"))
				Format = CIwImage::RGB_888;
			else
			if (format_hash == IW_GAME_HASH("RGBA_6666"))
				Format = CIwImage::RGBA_6666;
			else
			if (format_hash == IW_GAME_HASH("RGB_332"))
				Format = CIwImage::RGB_332;
			else
			if (format_hash == IW_GAME_HASH("RGBA_8888"))
				Format = CIwImage::RGBA_8888;
			else
			{
				FormatSet = false;
				CIwGameError::LogError("Warning: Invalid texture format set - ", (*it)->GetValue().c_str());
			}
		}
		else
 		if (name_hash == CIwGameXomlNames::Filter_Hash)
			setFilter((*it)->GetValueAsBool());
	}

	if (location == NULL || name == NULL)
		CIwGameError::LogError("Warning: An Image requires a location and a name to be specified");

	if (condition != NULL)
	{
		// Find the condition variable
		bool condition_not = false;
		CIwGameXomlVariable* var = NULL;
		if (*(condition->c_str()) == '!')
		{
			condition_not = true;
			CIwGameString cond = condition->c_str() + 1;
			var = CIwGameXomlVariable::GetVariable(cond, scene);
		}
		else
			var = CIwGameXomlVariable::GetVariable(*condition, scene);
		if (var != NULL)
		{
			bool res = var->isTrue();
			if (condition_not)
				res = !res;
			if (!res)
			{
				IW_GAME_XOML->setExitOnError(false);
				return false;
			}
		}
#if defined (_DEBUG)
		else
			CIwGameError::LogError("Warning: condition variable not found - ", condition->c_str());
#endif // _DEBUG
	}

	if (location != NULL)
	{
		// Check to see if image is located externally
		if (CIwGameFile::isHttp(location->c_str(), location->GetLength()))
		{
			Init(location->c_str());
		}
		else
		if (CIwGameFile::isFile(location->c_str(), location->GetLength()))
		{
			Init(location->c_str());
		}
		else
		{
			// Find resource group
			CIwGameResourceGroup* group = NULL;
			if (parent != NULL && parent->getClassTypeHash() == CIwGameXomlNames::Scene_Hash)
				group = (CIwGameResourceGroup*)scene->getResourceManager()->findResource(location->c_str(), CIwGameXomlNames::ResourceGroup_Hash);
			else
				group = (CIwGameResourceGroup*)IW_GAME_GLOBAL_RESOURCES->getResourceManager()->findResource(location->c_str(), CIwGameXomlNames::ResourceGroup_Hash);

			if (group != NULL)
				Init(name->c_str(), group->getResourceGroup());
			else
			{
				CIwGameError::LogError("Error: XOML - Invalid image resource group name - ", location->c_str());
				return false;
			}
		}
		if (preload)
		{
			Load(blocking);
		}
	}

	// If we are declared inside a scene then image is local to the scene
	if (scene != NULL)
		return scene->getResourceManager()->addResource(this);
	else
		return IW_GAME_GLOBAL_RESOURCES->getResourceManager()->addResource(this);

	return true;
}
Exemplo n.º 9
0
//
// 
// 
//
// CIwGameCommandSetVariable Implementation
// 
// 
// 
//
bool CIwGameCommandSetVariable::Execute(float dt)
{
	if (!IIwGameCommandExecutor::Execute(dt))
		return false;

	CIwGame* game = NULL;
	CIwGameScene* scene = NULL;
	unsigned int class_hash = Program->getManager()->getParent()->getClassTypeHash();
	if (class_hash == CIwGameXomlNames::Game_Hash)
		game = (CIwGame*)Program->getManager()->getParent();
	else
	if (class_hash == CIwGameXomlNames::Scene_Hash)
		scene = (CIwGameScene*)Program->getManager()->getParent();

	if (game != NULL)
		scene = game->findScene(Params[2].getHash());

	IIwGameXomlResource* cont = (IIwGameXomlResource*)scene;
	// Set the variables value
	CIwGameXomlVariable* var = CIwGameXomlVariable::GetVariable(Params[0], scene);
	if (var != NULL)
	{
		unsigned int hash = getParameter2(cont).getHash();
		if (hash == CIwGameXomlNames::Rand_Hash || hash == CIwGameXomlNames::RandChar_Hash)
		{
			CIwGameString rnd;
			rnd.setAutoHash(false);
			float min, max;

			if (hash == CIwGameXomlNames::Rand_Hash)
			{
				min = getParameter4(cont).GetAsFloat();
				max = getParameter5(cont).GetAsFloat();
			}
			else
			{
				min = (float)getParameter4(cont)[0];
				max = (float)getParameter5(cont)[0];
			}

			if (var->isArray())
			{
				CIwGameXomlVariableArray* arr = (CIwGameXomlVariableArray*)var;
				for (int t = 0; t < arr->getSize(); t++)
				{
					CIwGameXomlVariable* var2 = arr->getElement(t);
					float num = min + (((float)rand() * (max - min)) / RAND_MAX);

					if (hash == CIwGameXomlNames::Rand_Hash)
					{
						if (var2->Type == VT_Bool)
							rnd = (bool)(num > 0.5f);
						else
						if (var2->Type == VT_Int)
							rnd = (int)num;
						else
							rnd = num;
					}
					else
						rnd = (char)num;
					var2->setValue(rnd.c_str());
				}
			}
			else
			{
				float num = min + (((float)rand() * (max - min)) / RAND_MAX);
				if (hash == CIwGameXomlNames::Rand_Hash)
				{
					if (var->Type == VT_Bool)
						rnd = (bool)(num > 0.5f);
					else
					if (var->Type == VT_Int)
						rnd = (int)num;
					else
						rnd = num;
				}
				else
					rnd = (char)num;
				var->setValue(rnd.c_str());
			}
		}
		else
			var->setValue(getParameter2(cont).c_str());
	}

	return false;
}
Exemplo n.º 10
0
bool IIwGameBrush::LoadFromXoml(IIwGameXomlResource* parent, bool load_children, CIwGameXmlNode* node)
{
	// Get brush data
	eIwGameBrushType	type = BT_Solid;
	CIwFVec4			colour;
	CIwGameString*		name = NULL;
	CIwGameString*		image_name = NULL;
	CIwRect				rect = CIwRect(0, 0, 0, 0);
	CIwRect				scale_area = CIwRect(0, 0, 0, 0);
	CIwGameString*		condition = NULL;

	CIwGameScene* scene = NULL;
	if (parent != NULL && parent->getClassTypeHash() == CIwGameXomlNames::Actor_Hash)
		scene = ((CIwGameActor*)parent)->getScene();
	else
	if (parent != NULL && parent->getClassTypeHash() == CIwGameXomlNames::Scene_Hash)
		scene = (CIwGameScene*)parent;

	for (CIwGameXmlNode::_AttribIterator it = node->attribs_begin(); it != node->attribs_end(); ++it)
	{
		unsigned int attrib_hash = (*it)->getName().getHash();

		if (attrib_hash == CIwGameXomlNames::Name_Hash)
		{
			name = &(*it)->GetValue();
		}
		else
		if (attrib_hash == CIwGameXomlNames::Type_Hash)
		{
			unsigned int type_hash = (*it)->GetValue().getHash();
			if (type_hash == CIwGameXomlNames::Solid_Hash)
				type = BT_Solid;
			else
			if (type_hash == CIwGameXomlNames::Gradient_Hash)
				type = BT_Gradient;
			else
			if (type_hash == CIwGameXomlNames::Image_Hash)
				type = BT_Image;
			else
			if (type_hash == CIwGameXomlNames::Patch9_Hash)
				type = BT_9Patch;
			else
			{
				CIwGameError::LogError("Error: XOML - Invalid brush type - ", (*it)->GetValue().c_str());
				return false;
			}
		}
		else
		if (attrib_hash == CIwGameXomlNames::Colour_Hash)
		{
			if (!(*it)->GetValueAsPoint4(colour))
				CIwGameError::LogError("Warning: XOML - Brush Colour should be a vec4");
		}
		else
		if (attrib_hash == CIwGameXomlNames::Image_Hash)
		{
			image_name = &(*it)->GetValue();
			type = BT_Image;
		}
		else
		if (attrib_hash == CIwGameXomlNames::SrcRect_Hash)
		{
			if (!(*it)->GetValueAsRect(rect))
				CIwGameError::LogError("Warning: XOML - Brush SrcRect should be a rect");
		}
		else
		if (attrib_hash == CIwGameXomlNames::Tag_Hash)
		{
			setTag((*it)->GetValue().c_str());
		}
		else
		if (attrib_hash == CIwGameXomlNames::ScaleArea_Hash)
		{
			if (!(*it)->GetValueAsRect(scale_area))
				CIwGameError::LogError("Warning: XOML - Brush ScaleArea should be a rect");
		}
		else
		if (attrib_hash == CIwGameXomlNames::Condition_Hash)
		{
			condition = &(*it)->GetValue();
		}
	}

	if (condition != NULL)
	{
		// Find the condition variable
		bool condition_not = false;
		CIwGameXomlVariable* var = NULL;
		if (*(condition->c_str()) == '!')
		{
			condition_not = true;
			CIwGameString cond = condition->c_str() + 1;
			var = CIwGameXomlVariable::GetVariable(cond, scene);
		}
		else
			var = CIwGameXomlVariable::GetVariable(*condition, scene);
		if (var != NULL)
		{
			bool res = var->isTrue();
			if (condition_not)
				res = !res;
			if (!res)
			{
				IW_GAME_XOML->setExitOnError(false);
				return false;
			}
		}
#if defined (_DEBUG)
		else
			CIwGameError::LogError("Warning: condition variable not found - ", condition->c_str());
#endif // _DEBUG
	}

	IIwGameBrush* brush = NULL;
	switch (type)
	{
	case BT_Solid:
		{
			CIwGameBrushSolid* b = new CIwGameBrushSolid();
			b->setColour((uint8)colour.x, (uint8)colour.y, (uint8)colour.z, (uint8)colour.w);
			brush = b;
		}
		break;
	case BT_Gradient:
		{
		}
		break;
	case BT_Image:
	case BT_9Patch:
		{
			CIwGameImage* image = NULL;

			if (image_name == NULL)
			{
				CIwGameError::LogError("Error: An image / patch9 brush requires an image to be specified");
				return false;
			}
	
			if (scene != NULL)
			{
				image = (CIwGameImage*)scene->getResourceManager()->findResource(image_name->getHash(), CIwGameXomlNames::Image_Hash);
				if (image == NULL)
					CIwGameError::LogError("Warning: XOML - Brush - Could not find brush image - ", image_name->c_str());
			}
			else
			{
				image = (CIwGameImage*)IW_GAME_GLOBAL_RESOURCES->getResourceManager()->findResource(image_name->getHash(), CIwGameXomlNames::Image_Hash);
				if (image == NULL)
					CIwGameError::LogError("Warning: XOML - Brush - Could not find brush image - ", image_name->c_str());
			}

			if (image != NULL)
			{
				if (type == BT_Image)
				{
					CIwGameBrushImage* b = new CIwGameBrushImage();
					b->setImage(image);
					b->setSrcRect(rect);
					brush = b;
				}
				else
				if (type == BT_9Patch)
				{
					CIwGameBrushImage9* b = new CIwGameBrushImage9();
					b->setImage(image);
					b->setSrcRect(rect);
					b->setScalableArea(scale_area);
					brush = b;
				}
			}
		}
		break;
	}

	if (brush != NULL)
	{
		brush->setName(name->c_str());
		brush->setBrushType(type);

		// If we are declared inside a scene then material is local to the scene
		if (scene != NULL)
			scene->getResourceManager()->addResource(brush);
		else
			IW_GAME_GLOBAL_RESOURCES->getResourceManager()->addResource(brush);
	}

	IW_GAME_XOML->setExitOnError(false);
	return false;
}
Exemplo n.º 11
0
//
//
//
//	ImMobi specific implementation
//
//
//
bool CIwGameAds::RequestAdInMobi()
{
	// Build M2M request URI string
	RequestURI = "http://w.inmobi.com/showad.asm";				// Live
//	RequestURI = "http://i.w.sandbox.inmobi.com/showad.asm";	// Test
    
    int slotSize = (int)SlotSize;

	CIwGameString body;
	CIwGameString urlencoded;

	body = "mk-siteid=";
	body += ApplicationID;
	body += "&mk-carrier=";
	body += IW_GAME_HTTP_MANAGER->getIPAddress();
	body += "&h-user-agent=";
	urlencoded.URLEncode(UserAgent.c_str());
	urlencoded.ToLower();
	body += urlencoded;
	body += "&u-id=";
	body += CIwGameString(UDID);
	body += "&d-localization=";
	urlencoded.URLEncode(s3eDeviceGetString(S3E_DEVICE_LOCALE));
	urlencoded.ToLower();
	body += urlencoded;
//	body += "&d-netType=wifi";
	body += "&d-netType=carrier";
    body += "&mk-ad-slot=";
    body += CIwGameString(slotSize);
	body += "&mk-version=pr-SPEC-CTATA-20130111";
	if (UserAge != 0)
	{
		body += "&u-age=";
		body += CIwGameString(UserAge);
	}
	if (UserGender != GenderInvalid)
	{
		if (UserGender == GenderFemale)
			body += "&u-gender=f";
		else
			body += "&u-gender=m";
	}
	if (!UserGPSLocation.IsEmpty())
	{
		body += "&u-latlong=";
		body += UserGPSLocation;
	}
	if (!UserKeywords.IsEmpty())
	{
		body += "&u-interests=";
		body += UserKeywords;
	}
	if (!ExtraInfo.IsEmpty())
	{
		body += ExtraInfo;
	}
//	body.ToLower();

	AdRequest.setPOST();
	AdRequest.setURI(RequestURI.c_str());
	AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
	AdRequest.SetHeader("User-Agent", UserAgent.c_str());
	AdRequest.SetHeader("X-Mkhoj-SiteID", ApplicationID.c_str());
	AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
	AdRequest.SetHeader("Content-Length", CIwGameString(body.GetLength()).c_str());
	AdRequest.setBody(body.c_str());
	IW_GAME_HTTP_MANAGER->AddRequest(&AdRequest);
	BusyTimer.setDuration(IW_GAME_ADS_TIMEOUT);

	return true;
}
Exemplo n.º 12
0
bool CIwGameAds::RequestAdMadvertise()
{
	// Build M2M request URI string
	RequestURI = "http://ad.madvertise.de/site/";
	RequestURI += ApplicationID;

	CIwGameString body;
	CIwGameString urlencoded;

	body += "ua=";
	urlencoded.URLEncode(UserAgent.c_str());
	body += urlencoded;
//	body += "&ip=";
//	body += IW_GAME_HTTP_MANAGER->getIPAddress();
	body += "&requester=madvertise_api";
	body += "&version=api_2.1";
	body += "&unique_device_id=";
	body += CIwGameString(UDID);
	if (!ExtraInfo.IsEmpty())
	{
		body += ExtraInfo;
	}

/*	CIwGameString local = s3eDeviceGetString(S3E_DEVICE_LOCALE);
	int pos = local.Contains('_');
	if (pos >= 0)
	{
		// Strip language and underscore
		local.setString(local.c_str() + pos + 1, 2);
		local.ToUpper();
		body += "&country=";
		body += local;
	}*/

	if (UserAge != 0)
	{
		body += "&age=";
		body += CIwGameString(UserAge);
	}
	if (UserGender != GenderInvalid)
	{
		if (UserGender == GenderFemale)
			body += "&gender=F";
		else
			body += "&gender=M";
	}
	if (!UserKeywords.IsEmpty())
	{
		body += "&keywords=";
		body += UserKeywords;
	}

	AdRequest.setPOST();
	AdRequest.setURI(RequestURI.c_str());
	AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
	AdRequest.SetHeader("User-Agent", UserAgent.c_str());
	AdRequest.SetHeader("Accept", "application/xml");
	AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
	AdRequest.SetHeader("Content-Length", CIwGameString(body.GetLength()).c_str());
	AdRequest.setBody(body.c_str());
	IW_GAME_HTTP_MANAGER->AddRequest(&AdRequest);
	BusyTimer.setDuration(IW_GAME_ADS_TIMEOUT);

	return true;
}
Exemplo n.º 13
0
void CIwGameString::Copy(CIwGameString& string)
{
	Copy((char *)string.c_str(), 0, string.GetLength());
}
Exemplo n.º 14
0
bool CIwGameModifierManager::LoadFromXoml(IIwGameXomlResource* parent, bool load_children, CIwGameXmlNode* node)
{
	if (parent->getClassTypeHash() != CIwGameXomlNames::Actor_Hash && parent->getClassTypeHash() != CIwGameXomlNames::Scene_Hash)
	{
		CIwGameError::LogError("Error: XOML - Modifiers list needs to be declared inside an actor or scene");
		return false;
	}
	
	if (parent->getClassTypeHash() == CIwGameXomlNames::Actor_Hash)
	{
		CIwGameActor* actor = (CIwGameActor*)parent;
		actor->setModifiers(this);
	}
	else
	if (parent->getClassTypeHash() == CIwGameXomlNames::Scene_Hash)
	{
		CIwGameScene* scene = (CIwGameScene*)parent;
		scene->setModifiers(this);
	}

	// Process modifiers list attributes
	for (CIwGameXmlNode::_AttribIterator it = node->attribs_begin(); it != node->attribs_end(); it++)
	{
		unsigned int name_hash = (*it)->getName().getHash();

		if (name_hash == CIwGameXomlNames::Name_Hash)
		{
			setName((*it)->GetValue().c_str());
		}
	}

	// Prrocess modifiers
	for (CIwGameXmlNode::_Iterator it2 = node->begin(); it2 != node->end(); ++it2)
	{
		unsigned int name_hash = (*it2)->GetName().getHash();
		if (name_hash == CIwGameXomlNames::Modifier_Hash)
		{
			CIwGameString	name;
			CIwGameString	params[4];
			bool			active = true;

			for (CIwGameXmlNode::_AttribIterator it = (*it2)->attribs_begin(); it != (*it2)->attribs_end(); ++it)
			{
				unsigned int attrib_hash = (*it)->getName().getHash();

				if (attrib_hash == CIwGameXomlNames::Name_Hash)
					name = (*it)->GetValue();
				else
				if (attrib_hash == CIwGameXomlNames::Active_Hash)
					active = (*it)->GetValueAsBool();
				else
				if (attrib_hash == CIwGameXomlNames::Param1_Hash)
					params[0] = (*it)->GetValue();
				else
				if (attrib_hash == CIwGameXomlNames::Param2_Hash)
					params[1] = (*it)->GetValue();
				else
				if (attrib_hash == CIwGameXomlNames::Param3_Hash)
					params[2] = (*it)->GetValue();
				else
				if (attrib_hash == CIwGameXomlNames::Param4_Hash)
					params[3] = (*it)->GetValue();
			}

			// Find the modifiers creator
			IIwGameModifierCreator* creator = IW_GAME_MODS->findCreator(name.getHash());
			if (creator != NULL)
			{
				IIwGameModifier* mod = creator->CreateInstance();
				if (mod != NULL)
				{
					mod->setName(name.c_str());
					mod->setActive(active);
					for (int t = 0; t < 4; t++)
						mod->setParameter(t, params[t]);
					addModifier(mod);
				}
			}
			else
				CIwGameError::LogError("Warning: XOML - Modifier not found - ", name.c_str());

		}
	}

	return true;
}