Merge branch 'development' into issue_2115

This commit is contained in:
Areloch 2018-02-14 01:43:34 -06:00 committed by GitHub
commit 0d2705d815
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 807 additions and 416 deletions

View file

@ -37,6 +37,7 @@
#include "console/engineTypes.h"
#include "console/engineAPI.h"
#include "sim/netObject.h"
IMPLEMENT_SCOPE( ConsoleAPI, Console,,
"Functionality related to the legacy TorqueScript console system." );
@ -372,6 +373,7 @@ void ConsoleObject::addGroup(const char* in_pGroupname, const char* in_pGroupDoc
f.setDataFn = &defaultProtectedSetFn;
f.getDataFn = &defaultProtectedGetFn;
f.writeDataFn = &defaultProtectedWriteFn;
f.networkMask = 0;
// Add to field list.
sg_tempFieldList.push_back(f);
@ -396,6 +398,7 @@ void ConsoleObject::endGroup(const char* in_pGroupname)
f.getDataFn = &defaultProtectedGetFn;
f.writeDataFn = &defaultProtectedWriteFn;
f.elementCount = 0;
f.networkMask = 0;
// Add to field list.
sg_tempFieldList.push_back(f);
@ -418,6 +421,7 @@ void ConsoleObject::addArray( const char *arrayName, S32 count )
f.setDataFn = &defaultProtectedSetFn;
f.getDataFn = &defaultProtectedGetFn;
f.writeDataFn = &defaultProtectedWriteFn;
f.networkMask = 0;
// Add to field list.
sg_tempFieldList.push_back(f);
@ -439,6 +443,7 @@ void ConsoleObject::endArray( const char *arrayName )
f.getDataFn = &defaultProtectedGetFn;
f.writeDataFn = &defaultProtectedWriteFn;
f.elementCount = 0;
f.networkMask = 0;
// Add to field list.
sg_tempFieldList.push_back(f);
@ -515,6 +520,7 @@ void ConsoleObject::addField(const char* in_pFieldname,
f.setDataFn = &defaultProtectedSetFn;
f.getDataFn = &defaultProtectedGetFn;
f.writeDataFn = in_writeDataFn;
f.networkMask = 0;
ConsoleBaseType* conType = ConsoleBaseType::getType(in_fieldType);
AssertFatal(conType, "ConsoleObject::addField - invalid console type");
@ -609,6 +615,7 @@ void ConsoleObject::addProtectedField(const char* in_pFieldname,
f.setDataFn = in_setDataFn;
f.getDataFn = in_getDataFn;
f.writeDataFn = in_writeDataFn;
f.networkMask = 0;
ConsoleBaseType* conType = ConsoleBaseType::getType(in_fieldType);
AssertFatal(conType, "ConsoleObject::addProtectedField - invalid console type");
@ -635,6 +642,7 @@ void ConsoleObject::addFieldV(const char* in_pFieldname,
f.getDataFn = &defaultProtectedGetFn;
f.writeDataFn = &defaultProtectedWriteFn;
f.validator = v;
f.networkMask = 0;
v->fieldIndex = sg_tempFieldList.size();
sg_tempFieldList.push_back(f);
@ -652,11 +660,12 @@ void ConsoleObject::addDeprecatedField(const char *fieldName)
f.setDataFn = &defaultProtectedSetFn;
f.getDataFn = &defaultProtectedGetFn;
f.writeDataFn = &defaultProtectedWriteFn;
f.networkMask = 0;
sg_tempFieldList.push_back(f);
}
//------------------------------------------------------------------
bool ConsoleObject::removeField(const char* in_pFieldname)
{
for (U32 i = 0; i < sg_tempFieldList.size(); i++) {

View file

@ -495,7 +495,8 @@ public:
table( NULL ),
validator( NULL ),
setDataFn( NULL ),
getDataFn( NULL )
getDataFn( NULL ),
networkMask(0)
{
doNotSubstitute = keepClearSubsOnly = false;
}
@ -515,9 +516,11 @@ public:
TypeValidator *validator; ///< Validator, if any.
SetDataNotify setDataFn; ///< Set data notify Fn
GetDataNotify getDataFn; ///< Get data notify Fn
WriteDataNotify writeDataFn; ///< Function to determine whether data should be written or not.
WriteDataNotify writeDataFn; ///< Function to determine whether data should be written or not.
bool doNotSubstitute;
bool keepClearSubsOnly;
U32 networkMask;
};
typedef Vector<Field> FieldList;
@ -1263,10 +1266,6 @@ inline bool& ConsoleObject::getDynamicGroupExpand()
EnginePropertyTable _propTable( sizeof( _props ) / sizeof( _props[ 0 ] ) - 1, _props ); \
} }
/// Add an auto-doc for a class.
#define ConsoleDocClass( className, docString ) \
CLASSDOC( className, docString )
/// @}
//------------------------------------------------------------------------------

View file

@ -576,7 +576,7 @@ namespace _Private {
uintptr_t( ( ( const char* ) &( ( ( ThisType* ) 16 )->fieldName ) ) - 16 ) // Artificial offset to avoid compiler warnings.
///
#define CLASSDOC( className, doc ) \
#define ConsoleDocClass( className, doc ) \
template<> const char* EngineClassTypeInfo< className, className::_ClassBase >::smDocString = doc;

View file

@ -41,6 +41,8 @@
#include "core/fileObject.h"
#include "persistence/taml/tamlCustom.h"
#include "sim/netObject.h"
IMPLEMENT_CONOBJECT( SimObject );
// See full description in the new CHM manual
@ -912,6 +914,12 @@ void SimObject::assignFieldsFrom(SimObject *parent)
if((*f->setDataFn)( this, NULL, bufferSecure ) )
Con::setData(f->type, (void *) (((const char *)this) + f->offset), j, 1, &fieldVal, f->table);
if (f->networkMask != 0)
{
NetObject* netObj = static_cast<NetObject*>(this);
netObj->setMaskBits(f->networkMask);
}
}
}
}
@ -988,6 +996,12 @@ void SimObject::setDataField(StringTableEntry slotName, const char *array, const
if(fld->validator)
fld->validator->validateType(this, (void *) (((const char *)this) + fld->offset));
if (fld->networkMask != 0)
{
NetObject* netObj = static_cast<NetObject*>(this);
netObj->setMaskBits(fld->networkMask);
}
onStaticModified( slotName, value );
return;

View file

@ -53,6 +53,8 @@ public:
maxV = maxValue;
}
void validateType(SimObject *object, void *typePtr);
F32 getMin() { return minV; };
F32 getMax() { return maxV; };
};
/// Signed integer min/max range validator
@ -66,6 +68,8 @@ public:
maxV = maxValue;
}
void validateType(SimObject *object, void *typePtr);
F32 getMin() { return minV; };
F32 getMax() { return maxV; };
};
/// Scaled integer field validator
@ -93,6 +97,7 @@ class Point3NormalizeValidator : public TypeValidator
public:
Point3NormalizeValidator(F32 normalizeLength = 1.0f) : length(normalizeLength) { }
void validateType(SimObject *object, void *typePtr);
F32 getLength() { return length; };
};
namespace CommonValidators