示例#1
0
void ResourceReference::buildFromResource(Resources::Object *resource) {
	Common::Array<PathElement> reversePath;
	while (resource && resource->getType() != Resources::Type::kRoot) {
		reversePath.push_back(PathElement(resource->getType(), resource->getIndex()));

		switch (resource->getType().get()) {
			case Resources::Type::kLocation: {
				Resources::Location *location = Resources::Object::cast<Resources::Location>(resource);
				resource = StarkResourceProvider->getLevelFromLocation(location);
				break;
			}
			default:
				resource = resource->findParent<Resources::Object>();
				break;
		}
	}

	_path.clear();
	for (int i = reversePath.size() - 1; i >= 0; i--) {
		_path.push_back(reversePath[i]);
	}
}
示例#2
0
 PathElement::pointer PathElement::create ( const Glib::ustring& id, PathElementType type, double x, double y, double x1, double y1, double x2, double y2 )
 {
   PAPYRUS_CREATE ( PathElement ( id, type, x, y, x1, y1, x2, y2 ) );
 }
示例#3
0
void ResourceReference::addPathElement(Resources::Type type, uint16 index) {
	_path.push_back(PathElement(type, index));
}