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]); } }
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 ) ); }
void ResourceReference::addPathElement(Resources::Type type, uint16 index) { _path.push_back(PathElement(type, index)); }