From 63cf199322773f779f14350d0733f5789c83016c Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 7 Sep 2010 18:28:09 +0000 Subject: [PATCH] - more memory cleanup --- source/glest_game/type_instances/unit.cpp | 1 + source/shared_lib/include/graphics/vec.h | 30 ++++++++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 40955afd..8a5c18b6 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -175,6 +175,7 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos, const UnitType this->lastRenderFrame = 0; this->visible = true; this->retryCurrCommandCount=0; + this->screenPos = Vec3f(0.0); level= NULL; loadType= NULL; diff --git a/source/shared_lib/include/graphics/vec.h b/source/shared_lib/include/graphics/vec.h index 1c51e19f..6435457b 100644 --- a/source/shared_lib/include/graphics/vec.h +++ b/source/shared_lib/include/graphics/vec.h @@ -146,9 +146,12 @@ public: } std::string getString() const { - std::ostringstream streamOut(std::ostringstream::out); - streamOut << "x [" << x << "] y [" << y << "]"; - return streamOut.str(); + std::ostringstream streamOut; + streamOut << "x [" << x; + streamOut << "] y [" << y << "]"; + std::string result = streamOut.str(); + streamOut.str(std::string()); + return result; } }; @@ -330,9 +333,13 @@ public: } std::string getString() const { - std::ostringstream streamOut(std::ostringstream::out); - streamOut << "x [" << x << "] y [" << y << "] z [" << z << "]"; - return streamOut.str(); + std::ostringstream streamOut; + streamOut << "x [" << x; + streamOut << "] y [" << y; + streamOut << "] z [" << z << "]"; + std::string result = streamOut.str(); + streamOut.str(std::string()); + return result; } }; @@ -473,9 +480,14 @@ public: } std::string getString() const { - std::ostringstream streamOut(std::ostringstream::out); - streamOut << "x [" << x << "] y [" << y << "] z [" << z << "] w [" << w << "]"; - return streamOut.str(); + std::ostringstream streamOut; + streamOut << "x [" << x; + streamOut << "] y [" << y; + streamOut << "] z [" << z; + streamOut << "] w [" << w << "]"; + std::string result = streamOut.str(); + streamOut.str(std::string()); + return result; } };