//=========================================== // PhysicalSprite::PhysicalSprite //=========================================== PhysicalSprite(long name, long type, pTexture_t texture, std::unique_ptr<Shape> shape, const EntityPhysics::options_t& options) : Asset(internString("PhysicalSprite")), Entity(name, type), Sprite(name, type, texture), T_PHYSICS(this, options) { setSilent(true); setShape(std::move(shape)); setSilent(false); }
//=========================================== // PhysicalSprite::PhysicalSprite //=========================================== PhysicalSprite(long type, pTexture_t texture, std::unique_ptr<Shape> shape) : Asset(internString("PhysicalSprite")), Entity(type), Sprite(type, texture), T_PHYSICS(this) { setSilent(true); setShape(std::move(shape)); setSilent(false); }
QtlMovieTeletextSearch::QtlMovieTeletextSearch(const QString& fileName, const QtlMovieSettings* settings, QtlLogger* log, QObject* parent) : QtlMovieTsDemux(fileName, settings, log, parent), _demux(this) { // No need to report in search phase. setSilent(true); // Set the demux to collect the PAT. _demux.addPid(QTS_PID_PAT); }
ATTRIBUTE_NORETURN void raise_fatal_error(const char* msg, const Array& bt /* = null_array */, bool recoverable /* = false */, bool silent /* = false */, bool throws /* = true */) { if (RuntimeOption::PHP7_EngineExceptions && throws) { VMRegAnchor _; SystemLib::throwErrorObject(Variant(msg)); } auto ex = bt.isNull() && !recoverable ? FatalErrorException(msg) : FatalErrorException(msg, bt, recoverable); ex.setSilent(silent); throw ex; }
//=========================================== // Entity::Entity //=========================================== Entity::Entity(const XmlNode data) : Asset(internString("Entity")), m_silent(false), m_parent(NULL) { AssetManager assetManager; ShapeFactory shapeFactory; try { setSilent(true); XML_NODE_CHECK(data, Entity); XmlAttribute attr = data.firstAttribute(); XML_ATTR_CHECK(attr, type); m_type = internString(attr.getString()); attr = attr.nextAttribute(); XML_ATTR_CHECK(attr, name); m_name = internString(attr.getString()); attr = attr.nextAttribute(); XML_ATTR_CHECK(attr, x); m_transl.x = attr.getFloat(); attr = attr.nextAttribute(); XML_ATTR_CHECK(attr, y); m_transl.y = attr.getFloat(); attr = attr.nextAttribute(); XML_ATTR_CHECK(attr, z); m_z = attr.getFloat(); // So that no Z values are 'exactly' equal m_z += 0.1f * static_cast<float32_t>(rand()) / static_cast<float32_t>(RAND_MAX); attr = attr.nextAttribute(); XML_ATTR_CHECK(attr, rot); float32_t rot = attr.getFloat(); XmlNode node = data.firstChild(); if (!node.isNull() && node.name() == "shape") { m_shape = unique_ptr<Shape>(shapeFactory.create(node.firstChild())); node = node.nextSibling(); } m_rot = 0; setRotation(rot); XML_NODE_CHECK(node, scale); m_scale = Vec2f(1.f, 1.f); setScale(Vec2f(node.firstChild())); node = node.nextSibling(); XML_NODE_CHECK(node, fillColour); m_fillColour = Colour(node.firstChild()); node = node.nextSibling(); XML_NODE_CHECK(node, lineColour); m_lineColour = Colour(node.firstChild()); node = node.nextSibling(); XML_NODE_CHECK(node, lineWidth); m_lineWidth = node.getInt(); node = node.nextSibling(); XML_NODE_CHECK(node, children); XmlNode node_ = node.firstChild(); while (!node_.isNull() && node_.name() == "child") { XmlAttribute attr = node_.firstAttribute(); if (!attr.isNull() && attr.name() == "ptr") { long id = attr.getLong(); pEntity_t child = boost::dynamic_pointer_cast<Entity>(assetManager.getAssetPointer(id)); if (!child) throw XmlException("Bad entity asset id", __FILE__, __LINE__); addChild(child); } node_ = node_.nextSibling(); } setSilent(false); ++m_count; } catch (XmlException& e) { e.prepend("Error parsing XML for instance of class Entity; "); throw; } recomputeBoundary(); }
//=========================================== // Entity::assignData //=========================================== void Entity::assignData(const XmlNode data) { if (data.isNull() || data.name() != "Entity") return; AssetManager assetManager; ShapeFactory shapeFactory; try { bool silent = isSilent(); setSilent(true); XmlAttribute attr = data.firstAttribute(); if (!attr.isNull() && attr.name() == "type") { m_type = internString(attr.getString()); attr = attr.nextAttribute(); } if (!attr.isNull() && attr.name() == "name") { m_name = internString(attr.getString()); attr = attr.nextAttribute(); } Vec2f transl = m_transl; if (!attr.isNull() && attr.name() == "x") { transl.x = attr.getFloat(); attr = attr.nextAttribute(); } if (!attr.isNull() && attr.name() == "y") { transl.y = attr.getFloat(); attr = attr.nextAttribute(); } setTranslation(transl); if (!attr.isNull() && attr.name() == "z") { m_z = attr.getFloat(); // So that no Z values are 'exactly' equal m_z += 0.1f * static_cast<float32_t>(rand()) / static_cast<float32_t>(RAND_MAX); attr = attr.nextAttribute(); } XmlNode node = data.firstChild(); if (!node.isNull() && node.name() == "shape") { m_shape = unique_ptr<Shape>(shapeFactory.create(node.firstChild())); node = node.nextSibling(); } if (!node.isNull() && node.name() == "scale") { setScale(Vec2f(node.firstChild())); node = node.nextSibling(); } if (!attr.isNull() && attr.name() == "rot") { setRotation(attr.getFloat()); } if (!node.isNull() && node.name() == "fillColour") { m_fillColour = Colour(node.firstChild()); node = node.nextSibling(); } if (!node.isNull() && node.name() == "lineColour") { m_lineColour = Colour(node.firstChild()); node = node.nextSibling(); } if (!node.isNull() && node.name() == "lineWidth") { m_lineWidth = node.getInt(); node = node.nextSibling(); } if (!node.isNull() && node.name() == "children") { XmlNode node_ = node.firstChild(); while (!node_.isNull() && node_.name() == "child") { XmlAttribute attr = node_.firstAttribute(); if (!attr.isNull() && attr.name() == "ptr") { long id = attr.getLong(); pEntity_t child = boost::dynamic_pointer_cast<Entity>(assetManager.getAssetPointer(id)); if (!child) throw XmlException("Bad entity asset id", __FILE__, __LINE__); addChild(child); } node_ = node_.nextSibling(); } } setSilent(silent); } catch (XmlException& e) { e.prepend("Error parsing XML for instance of class Entity; "); throw; } recomputeBoundary(); }