#include "Base.h"

namespace gorgon {

	using namespace gge::utils;

	void Base::Prepare(gge::GGEMain &main, File &file) {
		this->file=&file;
		for(auto resource=Subitems.First();resource.IsValid(); resource.Next()) {
				
			resource->Prepare(main, file);
		}
	}

	void Base::Resolve(File &file) {
		this->file=&file;
		for(auto resource=Subitems.First();resource.IsValid();resource.Next()) {

			resource->Resolve(file);
		}
	}


	Base *Base::FindObject(gge::utils::SGuid guid) {
		for(auto resource=Subitems.First();
			resource.IsValid(); resource.Next()) {

				if(resource->isEqual(guid))
					return resource.CurrentPtr();

				Base *temp=resource->FindObject(guid);
				if(temp)
					return temp;
		}

		return NULL;
	}


}