console membervar cleanup

This commit is contained in:
Azaezel 2018-03-16 20:05:47 -05:00
parent 189595670a
commit 9b8c950701
4 changed files with 71 additions and 71 deletions

View file

@ -392,14 +392,14 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
if (size) if (size)
{ {
globalFloats = new F64[size]; globalFloats = new F64[size];
for (U32 i = 0; i < size; i++) for (i = 0; i < size; i++)
st.read(&globalFloats[i]); st.read(&globalFloats[i]);
} }
st.read(&size); st.read(&size);
if (size) if (size)
{ {
functionFloats = new F64[size]; functionFloats = new F64[size];
for (U32 i = 0; i < size; i++) for (i = 0; i < size; i++)
st.read(&functionFloats[i]); st.read(&functionFloats[i]);
} }
U32 codeLength; U32 codeLength;

View file

@ -49,7 +49,7 @@ ExprEvalState gEvalState;
StmtNode *gStatementList; StmtNode *gStatementList;
StmtNode *gAnonFunctionList; StmtNode *gAnonFunctionList;
U32 gAnonFunctionID = 0; U32 gAnonFunctionID = 0;
ConsoleConstructor *ConsoleConstructor::first = NULL; ConsoleConstructor *ConsoleConstructor::mFirst = NULL;
bool gWarnUndefinedScriptVariables; bool gWarnUndefinedScriptVariables;
static char scratchBuffer[4096]; static char scratchBuffer[4096];
@ -85,47 +85,47 @@ static const char * prependPercent ( const char * name )
//-------------------------------------- //--------------------------------------
void ConsoleConstructor::init( const char *cName, const char *fName, const char *usg, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) void ConsoleConstructor::init( const char *cName, const char *fName, const char *usg, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header )
{ {
mina = minArgs; mMina = minArgs;
maxa = maxArgs; mMaxa = maxArgs;
funcName = fName; mFuncName = fName;
usage = usg; mUsage = usg;
className = cName; mClassName = cName;
sc = 0; fc = 0; vc = 0; bc = 0; ic = 0; mSC = 0; mFC = 0; mVC = 0; mBC = 0; mIC = 0;
callback = group = false; mCallback = mGroup = false;
next = first; mNext = mFirst;
ns = false; mNS = false;
first = this; mFirst = this;
toolOnly = isToolOnly; mToolOnly = isToolOnly;
this->header = header; mHeader = header;
} }
void ConsoleConstructor::setup() void ConsoleConstructor::setup()
{ {
for(ConsoleConstructor *walk = first; walk; walk = walk->next) for(ConsoleConstructor *walk = mFirst; walk; walk = walk->mNext)
{ {
#ifdef TORQUE_DEBUG #ifdef TORQUE_DEBUG
walk->validate(); walk->validate();
#endif #endif
if( walk->sc ) if( walk->mSC )
Con::addCommand( walk->className, walk->funcName, walk->sc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); Con::addCommand( walk->mClassName, walk->mFuncName, walk->mSC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader);
else if( walk->ic ) else if( walk->mIC )
Con::addCommand( walk->className, walk->funcName, walk->ic, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); Con::addCommand( walk->mClassName, walk->mFuncName, walk->mIC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader);
else if( walk->fc ) else if( walk->mFC )
Con::addCommand( walk->className, walk->funcName, walk->fc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); Con::addCommand( walk->mClassName, walk->mFuncName, walk->mFC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader);
else if( walk->vc ) else if( walk->mVC )
Con::addCommand( walk->className, walk->funcName, walk->vc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); Con::addCommand( walk->mClassName, walk->mFuncName, walk->mVC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader);
else if( walk->bc ) else if( walk->mBC )
Con::addCommand( walk->className, walk->funcName, walk->bc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); Con::addCommand( walk->mClassName, walk->mFuncName, walk->mBC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader);
else if( walk->group ) else if( walk->mGroup )
Con::markCommandGroup( walk->className, walk->funcName, walk->usage ); Con::markCommandGroup( walk->mClassName, walk->mFuncName, walk->mUsage);
else if( walk->callback ) else if( walk->mClassName)
Con::noteScriptCallback( walk->className, walk->funcName, walk->usage, walk->header ); Con::noteScriptCallback( walk->mClassName, walk->mFuncName, walk->mUsage, walk->mHeader);
else if( walk->ns ) else if( walk->mNS )
{ {
Namespace* ns = Namespace::find( StringTable->insert( walk->className ) ); Namespace* ns = Namespace::find( StringTable->insert( walk->mClassName) );
if( ns ) if( ns )
ns->mUsage = walk->usage; ns->mUsage = walk->mUsage;
} }
else else
{ {
@ -137,38 +137,38 @@ void ConsoleConstructor::setup()
ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, StringCallback sfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, StringCallback sfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header )
{ {
init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header );
sc = sfunc; mSC = sfunc;
} }
ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, IntCallback ifunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, IntCallback ifunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header )
{ {
init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header );
ic = ifunc; mIC = ifunc;
} }
ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, FloatCallback ffunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, FloatCallback ffunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header )
{ {
init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header );
fc = ffunc; mFC = ffunc;
} }
ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, VoidCallback vfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, VoidCallback vfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header )
{ {
init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header );
vc = vfunc; mVC = vfunc;
} }
ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, BoolCallback bfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, BoolCallback bfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header )
{ {
init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header );
bc = bfunc; mBC = bfunc;
} }
ConsoleConstructor::ConsoleConstructor(const char* className, const char* groupName, const char* aUsage) ConsoleConstructor::ConsoleConstructor(const char* className, const char* groupName, const char* aUsage)
{ {
init(className, groupName, usage, -1, -2); init(className, groupName, mUsage, -1, -2);
group = true; mGroup = true;
// Somewhere, the entry list is getting flipped, partially. // Somewhere, the entry list is getting flipped, partially.
// so we have to do tricks to deal with making sure usage // so we have to do tricks to deal with making sure usage
@ -179,36 +179,36 @@ ConsoleConstructor::ConsoleConstructor(const char* className, const char* groupN
if(aUsage) if(aUsage)
lastUsage = (char *)aUsage; lastUsage = (char *)aUsage;
usage = lastUsage; mUsage = lastUsage;
} }
ConsoleConstructor::ConsoleConstructor(const char *className, const char *callbackName, const char *usage, ConsoleFunctionHeader* header ) ConsoleConstructor::ConsoleConstructor(const char *className, const char *callbackName, const char *usage, ConsoleFunctionHeader* header )
{ {
init( className, callbackName, usage, -2, -3, false, header ); init( className, callbackName, usage, -2, -3, false, header );
callback = true; mCallback = true;
ns = true; mNS = true;
} }
void ConsoleConstructor::validate() void ConsoleConstructor::validate()
{ {
#ifdef TORQUE_DEBUG #ifdef TORQUE_DEBUG
// Don't do the following check if we're not a method/func. // Don't do the following check if we're not a method/func.
if(this->group) if(mGroup)
return; return;
// In debug, walk the list and make sure this isn't a duplicate. // In debug, walk the list and make sure this isn't a duplicate.
for(ConsoleConstructor *walk = first; walk; walk = walk->next) for(ConsoleConstructor *walk = mFirst; walk; walk = walk->mNext)
{ {
// Skip mismatching func/method names. // Skip mismatching func/method names.
if(dStricmp(walk->funcName, this->funcName)) if(dStricmp(walk->mFuncName, mFuncName))
continue; continue;
// Don't compare functions with methods or vice versa. // Don't compare functions with methods or vice versa.
if(bool(this->className) != bool(walk->className)) if(bool(mClassName) != bool(walk->mClassName))
continue; continue;
// Skip mismatching classnames, if they're present. // Skip mismatching classnames, if they're present.
if(this->className && walk->className && dStricmp(walk->className, this->className)) if(mClassName && walk->mClassName && dStricmp(walk->mClassName, mClassName))
continue; continue;
// If we encounter ourselves, stop searching; this prevents duplicate // If we encounter ourselves, stop searching; this prevents duplicate
@ -218,13 +218,13 @@ void ConsoleConstructor::validate()
break; break;
// Match! // Match!
if(this->className) if(mClassName)
{ {
AssertISV(false, avar("ConsoleConstructor::setup - ConsoleMethod '%s::%s' collides with another of the same name.", this->className, this->funcName)); AssertISV(false, avar("ConsoleConstructor::setup - ConsoleMethod '%s::%s' collides with another of the same name.", mClassName, mFuncName));
} }
else else
{ {
AssertISV(false, avar("ConsoleConstructor::setup - ConsoleFunction '%s' collides with another of the same name.", this->funcName)); AssertISV(false, avar("ConsoleConstructor::setup - ConsoleFunction '%s' collides with another of the same name.", mFuncName));
} }
} }
#endif #endif

View file

@ -972,38 +972,38 @@ public:
/// @ref console_autodoc /// @ref console_autodoc
/// @{ /// @{
StringCallback sc; ///< A function/method that returns a string. StringCallback mSC; ///< A function/method that returns a string.
IntCallback ic; ///< A function/method that returns an int. IntCallback mIC; ///< A function/method that returns an int.
FloatCallback fc; ///< A function/method that returns a float. FloatCallback mFC; ///< A function/method that returns a float.
VoidCallback vc; ///< A function/method that returns nothing. VoidCallback mVC; ///< A function/method that returns nothing.
BoolCallback bc; ///< A function/method that returns a bool. BoolCallback mBC; ///< A function/method that returns a bool.
bool group; ///< Indicates that this is a group marker. bool mGroup; ///< Indicates that this is a group marker.
bool ns; ///< Indicates that this is a namespace marker. bool mNS; ///< Indicates that this is a namespace marker.
/// @deprecated Unused. /// @deprecated Unused.
bool callback; ///< Is this a callback into script? bool mCallback; ///< Is this a callback into script?
/// @} /// @}
/// Minimum number of arguments expected by the function. /// Minimum number of arguments expected by the function.
S32 mina; S32 mMina;
/// Maximum number of arguments accepted by the funtion. Zero for varargs. /// Maximum number of arguments accepted by the funtion. Zero for varargs.
S32 maxa; S32 mMaxa;
/// Name of the function/method. /// Name of the function/method.
const char* funcName; const char* mFuncName;
/// Name of the class namespace to which to add the method. /// Name of the class namespace to which to add the method.
const char* className; const char* mClassName;
/// Usage string for documentation. /// Usage string for documentation.
const char* usage; const char* mUsage;
/// Whether this is a TORQUE_TOOLS only function. /// Whether this is a TORQUE_TOOLS only function.
bool toolOnly; bool mToolOnly;
/// The extended function header. /// The extended function header.
ConsoleFunctionHeader* header; ConsoleFunctionHeader* mHeader;
/// @name ConsoleConstructor Innards /// @name ConsoleConstructor Innards
/// ///
@ -1066,8 +1066,8 @@ public:
/// @{ /// @{
/// ///
ConsoleConstructor *next; ConsoleConstructor *mNext;
static ConsoleConstructor *first; static ConsoleConstructor *mFirst;
void init(const char* cName, const char* fName, const char *usg, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); void init(const char* cName, const char* fName, const char *usg, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL);

View file

@ -668,13 +668,13 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char
U32 dstp = 0; U32 dstp = 0;
for(;;) for(;;)
{ {
const char *scan = dStrstr(source + scanp, from); const char *subScan = dStrstr(source + scanp, from);
if(!scan) if(!subScan)
{ {
dStrcpy(ret + dstp, source + scanp); dStrcpy(ret + dstp, source + scanp);
return ret; return ret;
} }
U32 len = scan - (source + scanp); U32 len = subScan - (source + scanp);
dStrncpy(ret + dstp, source + scanp, len); dStrncpy(ret + dstp, source + scanp, len);
dstp += len; dstp += len;
dStrcpy(ret + dstp, to); dStrcpy(ret + dstp, to);