- more memory cleanup

This commit is contained in:
Mark Vejvoda
2010-09-07 21:01:22 +00:00
parent 63cf199322
commit 958184e018
12 changed files with 118 additions and 31 deletions

View File

@@ -33,6 +33,7 @@ class Vec2{
public:
T x;
T y;
public:
Vec2(){
};
@@ -52,6 +53,11 @@ public:
this->x= v.x;
this->y= v.y;
}
template<typename S>
explicit Vec2(Vec2<S> &v){
this->x= v.x;
this->y= v.y;
}
Vec2(T x, T y){
this->x= x;
@@ -66,6 +72,12 @@ public:
return reinterpret_cast<const T*>(this);
}
Vec2<T> & operator=(const Vec2<T> &v) {
this->x= v.x;
this->y= v.y;
return *this;
}
bool operator ==(const Vec2<T> &v) const{
return x==v.x && y==v.y;
}
@@ -201,6 +213,13 @@ public:
this->z= v.z;
}
template<typename S>
explicit Vec3(Vec3<S> &v){
this->x= v.x;
this->y= v.y;
this->z= v.z;
}
Vec3(T x, T y, T z){
this->x= x;
this->y= y;
@@ -221,6 +240,13 @@ public:
return reinterpret_cast<const T*>(this);
}
Vec3<T> & operator=(const Vec3<T> &v) {
this->x= v.x;
this->y= v.y;
this->z= v.z;
return *this;
}
bool operator ==(const Vec3<T> &v) const{
return x==v.x && y==v.y && z==v.z;
}
@@ -387,6 +413,14 @@ public:
this->w= v.w;
}
template<typename S>
explicit Vec4(Vec4<S> &v){
this->x= v.x;
this->y= v.y;
this->z= v.z;
this->w= v.w;
}
Vec4(T x, T y, T z, T w){
this->x= x;
this->y= y;
@@ -416,6 +450,14 @@ public:
return reinterpret_cast<const T*>(this);
}
Vec4<T> & operator=(const Vec4<T> &v) {
this->x= v.x;
this->y= v.y;
this->z= v.z;
this->w= v.w;
return *this;
}
bool operator ==(const Vec4<T> &v) const{
return x==v.x && y==v.y && z==v.z && w==v.w;
}

View File

@@ -369,6 +369,7 @@ UnitParticleSystem::UnitParticleSystem(int particleCount): ParticleSystem(partic
fixed=false;
rotation=0.0f;
relativeDirection=true;
relative=false;
cRotation= Vec3f(1.0f,1.0f,1.0f);
fixedAddition = Vec3f(0.0f,0.0f,0.0f);
@@ -437,7 +438,7 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
p->speed= p->speed * speed;
p->accel= Vec3f(0.0f, -gravity, 0.0f);
if(!relative){
if(relative == false) {
p->pos= Vec3f(pos.x+x+offset.x, pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+offset.z);
}
else

View File

@@ -105,25 +105,25 @@ string boolToStr(bool b){
}
string intToStr(int i){
char str[strSize];
char str[strSize]="";
sprintf(str, "%d", i);
return str;
}
string intToHex(int i){
char str[strSize];
char str[strSize]="";
sprintf(str, "%x", i);
return str;
}
string floatToStr(float f,int precsion){
char str[strSize];
char str[strSize]="";
sprintf(str, "%.*f", precsion,f);
return str;
}
string doubleToStr(double d,int precsion){
char str[strSize];
char str[strSize]="";
sprintf(str, "%.*f", precsion,d);
return str;
}