mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-06 03:12:01 +00:00
fix memory errors realted to cache
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#include <iostream>
|
||||
#include "Model/ModelAnimation.hpp"
|
||||
|
||||
RAY::ModelAnimation::ModelAnimation(::ModelAnimation *animation):
|
||||
RAY::ModelAnimation::ModelAnimation(::ModelAnimation animation):
|
||||
_animation(animation), _frameCounter(0)
|
||||
{
|
||||
}
|
||||
@@ -20,26 +20,23 @@ size_t RAY::ModelAnimation::getFrameCounter() const
|
||||
|
||||
size_t RAY::ModelAnimation::getFrameCount() const
|
||||
{
|
||||
return this->_animation->frameCount;
|
||||
return this->_animation.frameCount;
|
||||
}
|
||||
|
||||
RAY::ModelAnimation &RAY::ModelAnimation::setFrameCounter(size_t frameCounter)
|
||||
{
|
||||
std::cout << this << std::endl;
|
||||
std::cout << this->_animation << std::endl;
|
||||
std::cout << this->_animation->frameCount << std::endl;
|
||||
this->_frameCounter = frameCounter % this->_animation->frameCount;
|
||||
this->_frameCounter = frameCounter % this->_animation.frameCount;
|
||||
return *this;
|
||||
}
|
||||
|
||||
RAY::ModelAnimation &RAY::ModelAnimation::incrementFrameCounter()
|
||||
{
|
||||
this->_frameCounter = (this->_frameCounter + 1) % this->_animation->frameCount;
|
||||
this->_frameCounter = (this->_frameCounter + 1) % this->_animation.frameCount;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
RAY::ModelAnimation::operator ::ModelAnimation() const
|
||||
{
|
||||
return *this->_animation;
|
||||
return this->_animation;
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace RAY {
|
||||
public:
|
||||
//! @brief A Model animation constructor
|
||||
//! @param animationPtr an animation pointer, returned by the nimation-loading function
|
||||
explicit ModelAnimation(::ModelAnimation *animationPtr);
|
||||
explicit ModelAnimation(::ModelAnimation animation);
|
||||
|
||||
//! @brief A default copy-constructor
|
||||
ModelAnimation(const ModelAnimation &) = default;
|
||||
@@ -41,7 +41,7 @@ namespace RAY {
|
||||
~ModelAnimation() = default;
|
||||
|
||||
private:
|
||||
::ModelAnimation *_animation;
|
||||
::ModelAnimation _animation;
|
||||
|
||||
size_t _frameCounter;
|
||||
INTERNAL:
|
||||
|
||||
@@ -16,7 +16,7 @@ RAY::ModelAnimations::ModelAnimations(const std::string &filePath):
|
||||
::ModelAnimation *ptr = this->_animationsPtr.get();
|
||||
|
||||
for (int i = 0; i < this->_animationCount; i++)
|
||||
this->_animations.emplace_back(ptr + i);
|
||||
this->_animations.emplace_back(ptr[i]);
|
||||
}
|
||||
|
||||
RAY::ModelAnimation &RAY::ModelAnimations::operator[](int index)
|
||||
|
||||
Reference in New Issue
Block a user