diff options
author | chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> | 2014-02-28 07:16:40 +0000 |
---|---|---|
committer | chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> | 2014-02-28 07:16:40 +0000 |
commit | aed99b27218aaf0068d04c24ba938e405c73c80f (patch) | |
tree | 07a19ef99c67454e87bea5183d7a2981c773d33a /towernbullet.h | |
parent | f473442598933c939b10dcc982f5780b903c7394 (diff) | |
download | bullet-lab-remix-aed99b27218aaf0068d04c24ba938e405c73c80f.tar.xz |
Fix memory leak in level "diffraction", rearrange levels.
There are also other small fixes, see Changelog for details.
Diffstat (limited to 'towernbullet.h')
-rw-r--r-- | towernbullet.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/towernbullet.h b/towernbullet.h index 154a729..5afb1ef 100644 --- a/towernbullet.h +++ b/towernbullet.h @@ -1903,13 +1903,15 @@ public: }; class diffCreator { -private: +protected: bool active; double range; + int cnt; vector2d center; Bullet* C; Bullet* target[200]; - int cnt; + vector2d created[200]; +private: TColors rbGetColor(int a) { switch (a) @@ -1926,7 +1928,7 @@ private: bool test(vector2d a) { for(int i=0;i<cnt;++i) - if(GetDist(a,target[i]->bulletpos)<9)return false; + if(GetDist(a,created[i])<12)return false; return true; } public: @@ -1948,6 +1950,7 @@ public: { if(test(a)) target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,0,true)], + created[cnt-1]=vector2d(a.x,a.y), target[cnt-1]->inv=true, target[cnt-1]->alterColor=red; } @@ -1957,6 +1960,7 @@ public: { if(test(a)) target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,pi,true)], + created[cnt-1]=vector2d(a.x,a.y), target[cnt-1]->inv=true, target[cnt-1]->alterColor=red; } @@ -1966,6 +1970,7 @@ public: { if(test(a)) target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,pi/2,true)], + created[cnt-1]=vector2d(a.x,a.y), target[cnt-1]->inv=true, target[cnt-1]->alterColor=red; } @@ -1975,6 +1980,7 @@ public: { if(test(a)) target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,-pi/2,true)], + created[cnt-1]=vector2d(a.x,a.y), target[cnt-1]->inv=true, target[cnt-1]->alterColor=red; } @@ -1982,6 +1988,7 @@ public: a=center; #define _bat \ target[cnt-1]->redir(center),\ + created[cnt-1]=target[cnt-1]->bulletpos,\ target[cnt-1]->bulletdir.x=-target[cnt-1]->bulletdir.x,\ target[cnt-1]->bulletdir.y=-target[cnt-1]->bulletdir.y,\ target[cnt-1]->inv=true,\ |