diff options
| author | aleksav013 <aleksav013@gmail.com> | 2021-06-06 15:35:16 +0200 |
|---|---|---|
| committer | aleksav013 <aleksav013@gmail.com> | 2021-06-06 15:35:16 +0200 |
| commit | 3270c2bcd37d23c68f281fedc60d71106e9926e7 (patch) | |
| tree | 64b7cb8f8b6e27ce8809507797f6116d7d200340 /src/State.cpp | |
| parent | 3fdf53f3c1fbf58e67ab9570f035756469b99424 (diff) | |
Fixing memory leak
Diffstat (limited to 'src/State.cpp')
| -rw-r--r-- | src/State.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/State.cpp b/src/State.cpp index 8a74331..a404666 100644 --- a/src/State.cpp +++ b/src/State.cpp @@ -121,7 +121,11 @@ void State::loop() { prozor.draw(podloga); prozor.draw(krajtext); - if(newgame) igra=new Game(&prozor,font,tex); + if(newgame) + { + delete igra; + igra=new Game(&prozor,font,tex); + } } if(pause) { @@ -134,4 +138,14 @@ void State::loop() ischanged=0; newgame=0; } + delete igra; +} +State::~State() +{ + delete font["default"]; + delete tex["neprijatelj"]; + delete tex["health"]; + delete tex["clear"]; + delete tex["vampiric"]; + //delete tex["djule"]; } |
