1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-10-06 09:07:19 +02:00

Use ClumpPtr for clone

This commit is contained in:
Filip Gawin 2018-08-25 17:31:22 +02:00
parent 7d894b2da5
commit d4061540d0
5 changed files with 6 additions and 6 deletions

View File

@ -113,10 +113,10 @@ void Clump::recalculateMetrics() {
}
}
Clump* Clump::clone() const {
ClumpPtr Clump::clone() const {
// Clone frame hierarchy
auto newroot = rootframe_->cloneHierarchy();
auto clump = new Clump;
auto clump = std::make_shared<Clump>();
clump->setFrame(newroot);
// This isn't the most optimal implementation, but this code is likely

View File

@ -278,7 +278,7 @@ public:
/**
* @return A Copy of the frames and atomics in this clump
*/
Clump* clone() const;
ClumpPtr clone() const;
private:
float boundingRadius;

View File

@ -32,7 +32,7 @@ CharacterObject::CharacterObject(GameWorld* engine, const glm::vec3& pos,
: GameObject(engine, pos, rot, modelinfo)
, controller(controller) {
auto info = getModelInfo<PedModelInfo>();
setClump(ClumpPtr(info->getModel()->clone()));
setClump(info->getModel()->clone());
if (info->getModel()) {
setModel(info->getModel());
animator = new Animator(getClump());

View File

@ -15,7 +15,7 @@ CutsceneObject::CutsceneObject(GameWorld *engine, const glm::vec3 &pos,
else {
setModel(getModelInfo<ClumpModelInfo>()->getModel());
}
setClump(ClumpPtr(getModel()->clone()));
setClump(getModel()->clone());
animator = new Animator(getClump());
}

View File

@ -166,7 +166,7 @@ VehicleObject::VehicleObject(GameWorld* engine, const glm::vec3& pos,
}
setModel(getVehicle()->getModel());
setClump(ClumpPtr(getModelInfo<VehicleModelInfo>()->getModel()->clone()));
setClump(getModelInfo<VehicleModelInfo>()->getModel()->clone());
setupModel();
}