Revert "Update console.h"

This reverts commit f10080489995570036e2e5ba762357559a0abd34.
This commit is contained in:
marauder2k7 2025-05-11 15:53:59 +01:00
parent 2b14e5448e
commit 0df6e99a75

View file

@ -154,18 +154,37 @@ class ConsoleValue
TORQUE_FORCEINLINE bool hasAllocatedData() const TORQUE_FORCEINLINE bool hasAllocatedData() const
{ {
return (type == ConsoleValueType::cvString || isConsoleType()) && data != NULL; return (isConsoleType() && data != NULL);
} }
const char* getConsoleData() const; const char* getConsoleData() const;
TORQUE_FORCEINLINE void cleanupData() TORQUE_FORCEINLINE void cleanupData()
{ {
if (hasAllocatedData()) switch (type)
{
case ConsoleValueType::cvConsoleValueType:
if (ct)
{
delete ct;
ct = nullptr;
}
break;
case ConsoleValueType::cvString:
if (s && s != StringTable->EmptyString())
dFree(s);
break;
default:
break;
}
if (data != NULL)
{ {
dFree(data); dFree(data);
data = NULL; data = NULL;
} }
type = ConsoleValueType::cvNULL;
} }
public: public: