From: <ken...@us...> - 2009-04-26 20:48:38
|
Revision: 3566 http://planeshift.svn.sourceforge.net/planeshift/?rev=3566&view=rev Author: kennygraunke Date: 2009-04-26 20:48:35 +0000 (Sun, 26 Apr 2009) Log Message: ----------- - Fixed MathEnvironment::DumpAllVars to print names; cleaned up MathVar cruft. Modified Paths: -------------- trunk/docs/history.txt trunk/src/common/util/mathscript.cpp trunk/src/common/util/mathscript.h Modified: trunk/docs/history.txt =================================================================== --- trunk/docs/history.txt 2009-04-26 20:47:21 UTC (rev 3565) +++ trunk/docs/history.txt 2009-04-26 20:48:35 UTC (rev 3566) @@ -2,6 +2,7 @@ - Made ActiveSpells cancel on death by default, unless set otherwise (for example, for equipment effects). Should fix PS#173. - Also cancel them on defeat - should fix PS#1605. +- Fixed MathEnvironment::DumpAllVars to print names; cleaned up MathVar cruft. *** 2009-04-25 by Stefano Angeleri - Made the ending quality determination of the item a math script and Modified: trunk/src/common/util/mathscript.cpp =================================================================== --- trunk/src/common/util/mathscript.cpp 2009-04-26 20:47:21 UTC (rev 3565) +++ trunk/src/common/util/mathscript.cpp 2009-04-26 20:48:35 UTC (rev 3566) @@ -54,21 +54,16 @@ csString MathVar::Dump() const { csString str; - str.Append(name); - str.Append("("); switch (type) { case VARTYPE_VALUE: - str.Append("VAL) = "); - str.Append(value); + str.Format("%1.4f", value); break; case VARTYPE_STR: - str.Append("STR) = "); - str.Append(MathScriptEngine::GetString(value)); + str = MathScriptEngine::GetString(value); break; case VARTYPE_OBJ: - str.Append("OBJ) = "); - str.Append("PTR"); + str.Format("%p", obj); break; } return str; @@ -124,11 +119,12 @@ void MathEnvironment::DumpAllVars() const { + csString name; csHash<MathVar*, csString>::ConstGlobalIterator it(variables.GetIterator()); while (it.HasNext()) { - MathVar *var = it.Next(); - CPrintf(CON_DEBUG, "%25s=%1.4f\n", var->name.GetData(), var->GetValue()); + MathVar *var = it.Next(name); + CPrintf(CON_DEBUG, "%25s = %s\n", name.GetData(), var->Dump().GetData()); } } Modified: trunk/src/common/util/mathscript.h =================================================================== --- trunk/src/common/util/mathscript.h 2009-04-26 20:47:21 UTC (rev 3565) +++ trunk/src/common/util/mathscript.h 2009-04-26 20:48:35 UTC (rev 3566) @@ -43,7 +43,6 @@ protected: double value; iScriptableVar *obj; - MathVar *var; typedef void (*MathScriptVarCallback)(void * arg); MathScriptVarCallback changedVarCallback; @@ -52,8 +51,6 @@ public: MathType type; - csString name; - MathVar() { type = VARTYPE_VALUE; @@ -106,7 +103,6 @@ type = v->type; value = v->value; obj = v->obj; - name = v->name; } csString ToString() const; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |