Fixed: Clang warnings

--HG--
branch : develop
This commit is contained in:
kervala 2015-12-13 15:25:28 +01:00
parent 15aed08533
commit 8aff509f0f
22 changed files with 113 additions and 94 deletions

View file

@ -82,13 +82,13 @@ namespace NLGUI
// Get the header color draw. NB: depends if grayed, and if active. // Get the header color draw. NB: depends if grayed, and if active.
virtual NLMISC::CRGBA getDrawnHeaderColor () const{ return NLMISC::CRGBA(); }; virtual NLMISC::CRGBA getDrawnHeaderColor () const{ return NLMISC::CRGBA(); };
uint8 getCurrentContainerAlpha() const{ return _CurrentContainerAlpha; } uint8 getCurrentContainerAlpha() const { return _CurrentContainerAlpha; }
uint8 getCurrentContentAlpha() const{ return _CurrentContentAlpha; } uint8 getCurrentContentAlpha() const { return _CurrentContentAlpha; }
virtual bool isGrayed() const{ return false; } virtual bool isGrayed() const { return false; }
virtual bool getTouchFlag(bool clearFlag) const{ return false; } virtual bool getTouchFlag(bool /* clearFlag */) const { return false; }
virtual void backupPosition(){} virtual void backupPosition() {}
virtual void restorePosition(){} virtual void restorePosition() {}
protected: protected:
void triggerAlphaSettingsChangedAH(); void triggerAlphaSettingsChangedAH();

View file

@ -74,9 +74,9 @@ namespace NLGUI
class IDeletionWatcher class IDeletionWatcher
{ {
public: public:
IDeletionWatcher(){} IDeletionWatcher() {}
virtual ~IDeletionWatcher(){} virtual ~IDeletionWatcher() {}
virtual void onDeleted( const std::string &name ){} virtual void onDeleted( const std::string &/* name */) {}
}; };
enum EStrech enum EStrech

View file

@ -370,7 +370,7 @@ inline void aligned_free(void *ptr) { _aligned_free(ptr); }
#elif defined(NL_OS_MAC) #elif defined(NL_OS_MAC)
#include <stdlib.h> #include <stdlib.h>
// under Mac OS X, malloc is already aligned for SSE and Altivec (16 bytes alignment) // under Mac OS X, malloc is already aligned for SSE and Altivec (16 bytes alignment)
inline void *aligned_malloc(size_t size, size_t alignment) { return malloc(size); } inline void *aligned_malloc(size_t size, size_t /* alignment */) { return malloc(size); }
inline void aligned_free(void *ptr) { free(ptr); } inline void aligned_free(void *ptr) { free(ptr); }
#else #else
#include <malloc.h> #include <malloc.h>

View file

@ -154,10 +154,12 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f )
if (curFrame->ExtensionBlockCount > 0) if (curFrame->ExtensionBlockCount > 0)
{ {
for(uint e=0; e<curFrame->ExtensionBlockCount; e++){ for(sint e = 0; e < curFrame->ExtensionBlockCount; e++)
{
ExtensionBlock *ext = &curFrame->ExtensionBlocks[e]; ExtensionBlock *ext = &curFrame->ExtensionBlocks[e];
if (ext->Function == GRAPHICS_EXT_FUNC_CODE) { if (ext->Function == GRAPHICS_EXT_FUNC_CODE)
{
uint8 flag = ext->Bytes[0]; uint8 flag = ext->Bytes[0];
//delay = (ext.Bytes[1] << 8) | ext.Bytes[2]; //delay = (ext.Bytes[1] << 8) | ext.Bytes[2];
transparency = (flag & GIF_TRANSPARENT_MASK) ? ext->Bytes[3] : GIF_NOT_TRANSPARENT; transparency = (flag & GIF_TRANSPARENT_MASK) ? ext->Bytes[3] : GIF_NOT_TRANSPARENT;

View file

@ -120,9 +120,9 @@ CInstance *CAutoGroup::getGroupingCandidate()
{ {
CObject *obj = NULL; CObject *obj = NULL;
if(k<components->getSize()) if(k<components->getSize())
obj = components->getValue(k); obj = components->getValueAtPos(k);
else else
obj = baseComponents->getValue(k - components->getSize()); obj = baseComponents->getValueAtPos(k - components->getSize());
CInstance *inst = getEditor().getInstanceFromObject(obj); CInstance *inst = getEditor().getInstanceFromObject(obj);
if (!inst) if (!inst)
{ {
@ -148,9 +148,9 @@ CInstance *CAutoGroup::getGroupingCandidate()
{ {
CObject *obj = NULL; CObject *obj = NULL;
if(k<features->getSize()) if(k<features->getSize())
obj = features->getValue(k); obj = features->getValueAtPos(k);
else else
obj = baseFeatures->getValue(k - features->getSize()); obj = baseFeatures->getValueAtPos(k - features->getSize());
CInstance *inst = getEditor().getInstanceFromObject(obj); CInstance *inst = getEditor().getInstanceFromObject(obj);
CDisplayerVisual *dv = inst->getDisplayerVisual(); CDisplayerVisual *dv = inst->getDisplayerVisual();
if (!dv) continue; if (!dv) continue;

View file

@ -124,7 +124,7 @@ void CDisplayerVisualActivitySequence::update()
for(uint k = 0; k < activities->getSize(); ++k) for(uint k = 0; k < activities->getSize(); ++k)
{ {
// search next zone of activity // search next zone of activity
CObjectTable *activity = activities->getValue(k)->toTable(); CObjectTable *activity = activities->getValueAtPos(k)->toTable();
if (!activity) continue; if (!activity) continue;
std::string activityStr = getString(activity, "Activity"); std::string activityStr = getString(activity, "Activity");
if (activityStr == "Stand Still" || activityStr == "Inactive") continue; if (activityStr == "Stand Still" || activityStr == "Inactive") continue;
@ -369,7 +369,7 @@ void CDisplayerVisualActivitySequence::onPostRender()
for(uint k = 0; k < activities->getSize(); ++k) for(uint k = 0; k < activities->getSize(); ++k)
{ {
// search next zone of activity // search next zone of activity
CObjectTable *activity = activities->getValue(k)->toTable(); CObjectTable *activity = activities->getValueAtPos(k)->toTable();
if (!activity) continue; if (!activity) continue;
std::string zoneId = getString(activity, "ActivityZoneId"); std::string zoneId = getString(activity, "ActivityZoneId");
if (zoneId.empty()) continue; if (zoneId.empty()) continue;

View file

@ -978,7 +978,7 @@ void CDisplayerVisualEntity::updateName()
sint actNb = -1; sint actNb = -1;
for(uint i=0; i<acts->getSize(); i++) for(uint i=0; i<acts->getSize(); i++)
{ {
if(acts->getValue(i)->equal(act)) if(acts->getValueAtPos(i)->equal(act))
{ {
actNb = i; actNb = i;
break; break;

View file

@ -755,7 +755,7 @@ void CDisplayerVisualGroup::updateInstanceList() const
_Instances.resize(sons->getSize()); _Instances.resize(sons->getSize());
for(uint k = 0; k < sons->getSize(); ++k) for(uint k = 0; k < sons->getSize(); ++k)
{ {
CInstance *inst = getEditor().getInstanceFromObject(sons->getValue(k)); CInstance *inst = getEditor().getInstanceFromObject(sons->getValueAtPos(k));
if (inst) if (inst)
{ {
_Instances[k] = inst->getDisplayerVisual(); _Instances[k] = inst->getDisplayerVisual();

View file

@ -1114,7 +1114,7 @@ void CComLuaModule::setObjectToLua(lua_State* state, CObject* object)
for (first=0 ; first != last; ++first) for (first=0 ; first != last; ++first)
{ {
std::string key = object->getKey(first); std::string key = object->getKey(first);
CObject *value = object->getValue(first); CObject *value = object->getValueAtPos(first);
if (!key.empty()) if (!key.empty())
{ {
lua_pushstring(state, key.c_str()); lua_pushstring(state, key.c_str());
@ -2246,7 +2246,7 @@ sint CComLuaModule::luaUpdateScenarioAck(lua_State* state)
for(uint i = 0; i < size; ++i) for(uint i = 0; i < size; ++i)
{ {
std::string key = object->getKey(i); std::string key = object->getKey(i);
CObject* value = object->getValue(i); CObject* value = object->getValueAtPos(i);
if (value->isInteger()) if (value->isInteger())
{ {

View file

@ -3224,7 +3224,7 @@ void CEditor::initObjectProjectionMetatable()
if (ls.isInteger(2)) if (ls.isInteger(2))
{ {
// index is an integer // index is an integer
const CObject *other = obj->getValue((uint32) ls.toInteger(2)); const CObject *other = obj->getValueAtPos((uint32) ls.toInteger(2));
if (other) if (other)
{ {
pushValue(ls, other); pushValue(ls, other);
@ -3569,7 +3569,7 @@ void CEditor::initObjectProjectionMetatable()
} }
ls.pop(2); ls.pop(2);
pushKey(ls, obj, 0); pushKey(ls, obj, 0);
pushValue(ls, obj->getValue(0)); pushValue(ls, obj->getValueAtPos(0));
return 2; return 2;
} }
} }
@ -3618,7 +3618,7 @@ void CEditor::initObjectProjectionMetatable()
{ {
ls.pop(2); ls.pop(2);
pushKey(ls, obj, newIndex); pushKey(ls, obj, newIndex);
pushValue(ls, obj->getValue(newIndex)); pushValue(ls, obj->getValueAtPos(newIndex));
return 2; return 2;
} }
} }
@ -3751,7 +3751,7 @@ void CEditor::setCurrentActFromTitle(const std::string &wantedTitle)
{ {
for(uint k = 0; k < actTable->getSize(); ++k) for(uint k = 0; k < actTable->getSize(); ++k)
{ {
R2::CObject *act = actTable->getValue(k); R2::CObject *act = actTable->getValueAtPos(k);
nlassert(act); nlassert(act);
std::string actTitle; std::string actTitle;
if (act->isString("Name")) if (act->isString("Name"))
@ -4560,7 +4560,7 @@ void CEditor::updatePrimitiveContextualVisibility()
for(uint k = 0; k < activities->getSize(); ++k) for(uint k = 0; k < activities->getSize(); ++k)
{ {
// search next zone of activity // search next zone of activity
CObjectTable *activity = activities->getValue(k)->toTable(); CObjectTable *activity = activities->getValueAtPos(k)->toTable();
if (!activity) continue; if (!activity) continue;
std::string zoneId = getString(activity, "ActivityZoneId"); std::string zoneId = getString(activity, "ActivityZoneId");
CInstance *primitive = getInstanceFromId(zoneId); CInstance *primitive = getInstanceFromId(zoneId);
@ -5031,7 +5031,7 @@ void CEditor::onErase(CObject *root, bool &foundInBase, std::string &nameInParen
{ {
for(uint k = 0; k < root->getSize(); ++k) for(uint k = 0; k < root->getSize(); ++k)
{ {
CObject *obj = root->getValue(k); CObject *obj = root->getValueAtPos(k);
if (obj->isTable()) if (obj->isTable())
{ {
onErase(obj); onErase(obj);
@ -5122,7 +5122,7 @@ void CEditor::onErase(CObject *root, bool &foundInBase, std::string &nameInParen
CObjectTable *rootTable = root->toTable(); CObjectTable *rootTable = root->toTable();
for (uint32 k = 0; k < rootTable->getSize(); ++k) for (uint32 k = 0; k < rootTable->getSize(); ++k)
{ {
CObject *obj = rootTable->getValue(k); CObject *obj = rootTable->getValueAtPos(k);
CObjectRefIdClient *objRefId = dynamic_cast<CObjectRefIdClient *>(obj); CObjectRefIdClient *objRefId = dynamic_cast<CObjectRefIdClient *>(obj);
if (objRefId) if (objRefId)
{ {
@ -5547,7 +5547,7 @@ void CEditor::createNewInstanceForObjectTableInternal(const CObject *obj)
// do the same on sons // do the same on sons
for(uint k = 0; k < table->getSize(); ++k) for(uint k = 0; k < table->getSize(); ++k)
{ {
createNewInstanceForObjectTableInternal(table->getValue(k)); createNewInstanceForObjectTableInternal(table->getValueAtPos(k));
} }
} }
@ -5754,7 +5754,7 @@ void CEditor::scenarioUpdated(CObject* highLevel, bool willTP, uint32 initialAct
CObject *acts = _Scenario->getAttr("Acts"); CObject *acts = _Scenario->getAttr("Acts");
if (acts) if (acts)
{ {
CObject *baseAct = acts->getValue(0); CObject *baseAct = acts->getValueAtPos(0);
if (baseAct) if (baseAct)
{ {
_BaseAct = getInstanceFromId(baseAct->toString("InstanceId")); _BaseAct = getInstanceFromId(baseAct->toString("InstanceId"));
@ -5871,7 +5871,7 @@ CInstance *CEditor::getDefaultFeature(CInstance *act)
if (!act) return NULL; if (!act) return NULL;
CObject *defaultFeature = act->getObjectTable()->getAttr("Features"); CObject *defaultFeature = act->getObjectTable()->getAttr("Features");
if (!defaultFeature) return NULL; if (!defaultFeature) return NULL;
defaultFeature = defaultFeature->getValue(0); defaultFeature = defaultFeature->getValueAtPos(0);
if (!defaultFeature) return NULL; // 0 should be the default feature if (!defaultFeature) return NULL; // 0 should be the default feature
CInstance *result = getInstanceFromId(defaultFeature->toString("InstanceId")); CInstance *result = getInstanceFromId(defaultFeature->toString("InstanceId"));
if (!result) return NULL; if (!result) return NULL;

View file

@ -754,7 +754,7 @@ const CInstance *CInstance::getParentGroupLeader() const
{ {
return NULL; return NULL;
} }
return getEditor().getInstanceFromObject(components->getValue(0)); return getEditor().getInstanceFromObject(components->getValueAtPos(0));
} }
// ********************************************************************************************************* // *********************************************************************************************************
@ -776,7 +776,7 @@ CObject *CInstance::getGroupSelectedSequence() const
{ {
if (selectedSequence >= 0 && selectedSequence < (sint) activities->getSize()) if (selectedSequence >= 0 && selectedSequence < (sint) activities->getSize())
{ {
return activities->getValue((sint32) selectedSequence); return activities->getValueAtPos((sint32) selectedSequence);
} }
} }
} }

View file

@ -221,7 +221,7 @@ void CObjectRefIdClient::getNameInParent(std::string &name, sint32 &indexInArray
{ {
if (_IndexInParentArray == -1) if (_IndexInParentArray == -1)
{ {
if (parentInstanceTable->getValue(_IndexInParent) == static_cast<const CObject *>(this)) if (parentInstanceTable->getValueAtPos(_IndexInParent) == static_cast<const CObject *>(this))
{ {
name = parentInstanceTable->getKey(_IndexInParent); name = parentInstanceTable->getKey(_IndexInParent);
indexInArray = -1; indexInArray = -1;
@ -230,13 +230,13 @@ void CObjectRefIdClient::getNameInParent(std::string &name, sint32 &indexInArray
} }
else else
{ {
CObject *subObject = parentInstanceTable->getValue(_IndexInParent); CObject *subObject = parentInstanceTable->getValueAtPos(_IndexInParent);
if (subObject->isTable()) if (subObject->isTable())
{ {
CObjectTable *subTable = (CObjectTable *) subObject; CObjectTable *subTable = (CObjectTable *) subObject;
if (_IndexInParentArray < (sint32) subTable->getSize()) if (_IndexInParentArray < (sint32) subTable->getSize())
{ {
if (subTable->getValue(_IndexInParentArray) == static_cast<const CObject *>(this)) if (subTable->getValueAtPos(_IndexInParentArray) == static_cast<const CObject *>(this))
{ {
name = parentInstanceTable->getKey(_IndexInParent); name = parentInstanceTable->getKey(_IndexInParent);
indexInArray = _IndexInParentArray; indexInArray = _IndexInParentArray;
@ -261,7 +261,7 @@ void CObjectRefIdClient::getNameInParent(std::string &name, sint32 &indexInArray
// if instance is the direct parent (e.g object is not in an array of the parent) // if instance is the direct parent (e.g object is not in an array of the parent)
for (uint k = 0; k < parentInstanceTable->getSize(); ++k) for (uint k = 0; k < parentInstanceTable->getSize(); ++k)
{ {
if (parentInstanceTable->getValue(k) == ptrInParent) if (parentInstanceTable->getValueAtPos(k) == ptrInParent)
{ {
_IndexInParent = k; _IndexInParent = k;
if (ptrInParent == this) if (ptrInParent == this)
@ -276,7 +276,7 @@ void CObjectRefIdClient::getNameInParent(std::string &name, sint32 &indexInArray
// I'm in an array in my parent, retrieve the index // I'm in an array in my parent, retrieve the index
for (uint l = 0; l < getParent()->getSize(); ++l) for (uint l = 0; l < getParent()->getSize(); ++l)
{ {
if (getParent()->getValue(l) == static_cast<const CObject *>(this)) if (getParent()->getValueAtPos(l) == static_cast<const CObject *>(this))
{ {
name = parentInstanceTable->getKey(_IndexInParent); name = parentInstanceTable->getKey(_IndexInParent);
_IndexInParentArray = l; _IndexInParentArray = l;

View file

@ -321,11 +321,28 @@ static char *sha512crypt(const char *key, const char *setting, char *output)
p += sprintf(p, "$6$%s%.*s$", rounds, slen, salt); p += sprintf(p, "$6$%s%.*s$", rounds, slen, salt);
#if 1 #if 1
static const unsigned char perm[][3] = { static const unsigned char perm[][3] = {
0,21,42,22,43,1,44,2,23,3,24,45,25,46,4, { 0, 21, 42 },
47,5,26,6,27,48,28,49,7,50,8,29,9,30,51, { 22, 43, 1 },
31,52,10,53,11,32,12,33,54,34,55,13,56,14,35, { 44, 2, 23 },
15,36,57,37,58,16,59,17,38,18,39,60,40,61,19, { 3, 24, 45 },
62,20,41 }; { 25, 46, 4 },
{ 47, 5, 26 },
{ 6, 27, 48 },
{ 28, 49, 7 },
{ 50, 8, 29 },
{ 9, 30, 51 },
{ 31, 52, 10 },
{ 53, 11, 32 },
{ 12, 33, 54 },
{ 34, 55, 13 },
{ 56, 14, 35 },
{ 15, 36, 57 },
{ 37, 58, 16 },
{ 59, 17, 38 },
{ 18, 39, 60 },
{ 40, 61, 19 },
{ 62, 20, 41 }
};
for (i=0; i<21; i++) p = to64(p, for (i=0; i<21; i++) p = to64(p,
(md[perm[i][0]]<<16)|(md[perm[i][1]]<<8)|md[perm[i][2]], 4); (md[perm[i][0]]<<16)|(md[perm[i][1]]<<8)|md[perm[i][2]], 4);
#else #else

View file

@ -1154,8 +1154,8 @@ public:
friend iterator; // MSVC friend iterator; // MSVC
friend const_iterator; friend const_iterator;
#else #else
template <class U, class V> friend class _CMirrorPropValueListIterator; // GCC3 template <class U, class V> friend struct _CMirrorPropValueListIterator; // GCC3
template <class U, class V> friend class _CCMirrorPropValueListIterator; template <class U, class V> friend struct _CCMirrorPropValueListIterator;
#endif #endif
/// Constructor /// Constructor
@ -1241,9 +1241,9 @@ public:
friend iterator; // MSVC friend iterator; // MSVC
friend const_iterator; friend const_iterator;
#else #else
template <class U, class V> friend class _CMirrorPropValueListIterator; // GCC3 template <class U, class V> friend struct _CMirrorPropValueListIterator; // GCC3
template <class U, class V> friend class _CCMirrorPropValueListIterator; template <class U, class V> friend struct _CCMirrorPropValueListIterator;
template<class U, class V> friend class CMirrorPropValueItem; template<class U, class V> friend class CMirrorPropValueItem;
#endif #endif
/// Constructor /// Constructor

View file

@ -392,7 +392,7 @@ CObject* CObject::getAttr(const std::string & /* name */) const { return 0;}
std::string CObject::getKey(uint32 /* pos */) const{ BOMB("Try to call the function getKey() on an object that is not a table", return ""); return "";} std::string CObject::getKey(uint32 /* pos */) const{ BOMB("Try to call the function getKey() on an object that is not a table", return ""); return "";}
CObject* CObject::getValue(uint32 /* pos */) const{ BOMB("Try to call the function getValue() on an object that is not a table", return 0); return 0;} CObject* CObject::getValueAtPos(uint32 /* pos */) const{ BOMB("Try to call the function getValueAtPos() on an object that is not a table", return 0); return 0;}
uint32 CObject::getSize() const { BOMB("Try to call the function getSize() on an object that is not a table", return 0); return 0; } uint32 CObject::getSize() const { BOMB("Try to call the function getSize() on an object that is not a table", return 0); return 0; }
@ -974,7 +974,7 @@ void CObjectTable::checkIntegrity() const
{ {
for(uint k = 0; k < getSize(); ++k) for(uint k = 0; k < getSize(); ++k)
{ {
CObject *subObj = getValue(k); CObject *subObj = getValueAtPos(k);
if (subObj) if (subObj)
{ {
if (!subObj->getGhost()) if (!subObj->getGhost())
@ -1017,7 +1017,7 @@ void CObjectTable::setGhost(bool ghost)
for(uint k = 0; k < getSize(); ++k) for(uint k = 0; k < getSize(); ++k)
{ {
CObject *subObj = getValue(k); CObject *subObj = getValueAtPos(k);
if (subObj) if (subObj)
{ {
subObj->setGhost(ghost); subObj->setGhost(ghost);
@ -1031,7 +1031,7 @@ void CObjectTable::previsit(std::vector<CObject::TRefPtr> &sons)
sons.reserve(sons.size() + getSize()); sons.reserve(sons.size() + getSize());
for(uint k = 0; k < getSize(); ++k) for(uint k = 0; k < getSize(); ++k)
{ {
CObject *subObj = getValue(k); CObject *subObj = getValueAtPos(k);
if (subObj) if (subObj)
{ {
subObj->previsit(sons); subObj->previsit(sons);
@ -1068,7 +1068,7 @@ void CObjectTable::inPlaceCopy(const CObjectTable &src)
} }
else else
{ {
src.getValue(k)->inPlaceCopyTo(*dest); src.getValueAtPos(k)->inPlaceCopyTo(*dest);
} }
} }
else else
@ -1115,7 +1115,7 @@ void CObjectTable::sort()
uint32 lastKey = keys->getSize(); uint32 lastKey = keys->getSize();
for (; firstKey != lastKey ; ++firstKey) for (; firstKey != lastKey ; ++firstKey)
{ {
CObject* keyObject = keys->getValue(firstKey); CObject* keyObject = keys->getValueAtPos(firstKey);
if (! keyObject->isString()) return; if (! keyObject->isString()) return;
std::string key = keyObject->toString(); std::string key = keyObject->toString();
@ -1344,7 +1344,7 @@ std::string CObjectTable::getKey(uint32 pos) const
return _Value[pos].first; return _Value[pos].first;
} }
CObject* CObjectTable::getValue(uint32 pos) const CObject* CObjectTable::getValueAtPos(uint32 pos) const
{ {
//H_AUTO(R2_CObjectTable_getValue) //H_AUTO(R2_CObjectTable_getValue)
if (pos >= _Value.size()) if (pos >= _Value.size())
@ -1404,7 +1404,7 @@ bool CObjectTable::setObject(const std::string& key, CObject* value)
for ( ; first != last ; ++first) for ( ; first != last ; ++first)
{ {
std::string key1 = table->getKey(first); std::string key1 = table->getKey(first);
CObject* value1 = table->getValue(first); CObject* value1 = table->getValueAtPos(first);
add(key1, value1->clone()); add(key1, value1->clone());
} }
return true; return true;
@ -1577,9 +1577,9 @@ bool CObjectTable::equal(const CObject* other) const
for ( i=0; i!= size ; ++i ) for ( i=0; i!= size ; ++i )
{ {
std::string key = other->getKey(i); std::string key = other->getKey(i);
CObject* value = other->getValue(i); CObject* value = other->getValueAtPos(i);
if (key != this->getKey(i)) return false; if (key != this->getKey(i)) return false;
if ( !value->equal(this->getValue(i))) return false; if ( !value->equal(this->getValueAtPos(i))) return false;
} }
return true; return true;
} }
@ -1835,7 +1835,7 @@ void CObjectGenerator::createDefaultValues(CObjectFactory* factory)
uint32 last = prop->getSize(); uint32 last = prop->getSize();
for ( ; first != last ; ++first ) for ( ; first != last ; ++first )
{ {
CObject* found = prop->getValue(first); CObject* found = prop->getValueAtPos(first);
if (found && found->isString("DefaultValue") && found->isString("Name") ) if (found && found->isString("DefaultValue") && found->isString("Name") )
{ {
@ -1895,7 +1895,7 @@ CObject* CObjectGenerator::instanciate(CObjectFactory* factory) const
uint32 last = prop->getSize(); uint32 last = prop->getSize();
for ( ; first != last ; ++first ) for ( ; first != last ; ++first )
{ {
CObject* found = prop->getValue(first); CObject* found = prop->getValueAtPos(first);
if (found && found->isString("Type") ) if (found && found->isString("Type") )
{ {
@ -2461,7 +2461,7 @@ public:
uint8 shortKey = static_cast<uint8>(uiKey); uint8 shortKey = static_cast<uint8>(uiKey);
stream.serial(shortKey); stream.serial(shortKey);
CObject*value = data->getValue(optionalPropFoundIndex[first]); CObject*value = data->getValueAtPos(optionalPropFoundIndex[first]);
if (serializer->Log) { nldebug("R2NET: (%u) Field '%s'", serializer->Level, key.c_str());} if (serializer->Log) { nldebug("R2NET: (%u) Field '%s'", serializer->Level, key.c_str());}
onSerial(stream, key, value, serializer); onSerial(stream, key, value, serializer);
} }
@ -2483,7 +2483,7 @@ public:
stream.serial(last16); stream.serial(last16);
for (; first != last; ++first) for (; first != last; ++first)
{ {
CObject* value = data->getValue(valuePropFoundIndex[first]); CObject* value = data->getValueAtPos(valuePropFoundIndex[first]);
if (serializer->Log) { nldebug("R2NET: (%u) Field [%u]", serializer->Level, first);} if (serializer->Log) { nldebug("R2NET: (%u) Field [%u]", serializer->Level, first);}
CObjectSerializerImpl::getInstance().serialImpl(stream, value, serializer); CObjectSerializerImpl::getInstance().serialImpl(stream, value, serializer);
} }
@ -2509,7 +2509,7 @@ public:
{ {
uint32 keyIndex = otherPropFoundIndex[first]; uint32 keyIndex = otherPropFoundIndex[first];
std::string key = data->getKey(keyIndex); std::string key = data->getKey(keyIndex);
CObject* value = data->getValue(keyIndex); CObject* value = data->getValueAtPos(keyIndex);
stream.serial(key); stream.serial(key);
if (serializer->Log) { nldebug("R2NET: (%u) Field '%s'", serializer->Level, key.c_str());} if (serializer->Log) { nldebug("R2NET: (%u) Field '%s'", serializer->Level, key.c_str());}
CObjectSerializerImpl::getInstance().serialImpl(stream, value, serializer); CObjectSerializerImpl::getInstance().serialImpl(stream, value, serializer);
@ -3270,7 +3270,7 @@ void CObjectSerializerImpl::serialImpl(NLMISC::IStream& stream, CObject*& data,
for (uint first = 0; first != size; ++first) for (uint first = 0; first != size; ++first)
{ {
std::string key = data->getKey(first); std::string key = data->getKey(first);
CObject* value = data->getValue(first); CObject* value = data->getValueAtPos(first);
stream.serial(key); stream.serial(key);
++ (serializer->Level); ++ (serializer->Level);
if (serializer->Log) { nldebug("R2NET: (%u) Field '%s'", serializer->Level, key.c_str());} if (serializer->Log) { nldebug("R2NET: (%u) Field '%s'", serializer->Level, key.c_str());}

View file

@ -114,7 +114,7 @@ public:
virtual std::string getKey(uint32 pos) const; virtual std::string getKey(uint32 pos) const;
virtual CObject* getValue(uint32 pos) const; virtual CObject* getValueAtPos(uint32 pos) const;
virtual uint32 getSize() const; virtual uint32 getSize() const;
@ -385,7 +385,7 @@ public:
virtual std::string getKey(uint32 pos) const; virtual std::string getKey(uint32 pos) const;
virtual CObject* getValue(uint32 pos) const; virtual CObject* getValueAtPos(uint32 pos) const;
virtual sint32 findIndex(const CObject* child) const; virtual sint32 findIndex(const CObject* child) const;

View file

@ -421,7 +421,7 @@ bool CRingAccess::verifyRtScenario(CObject* rtScenario, const std::string& charR
for ( ;firstLocation != lastLocation; ++firstLocation) for ( ;firstLocation != lastLocation; ++firstLocation)
{ {
CObject* location = locations->getValue(firstLocation); CObject* location = locations->getValueAtPos(firstLocation);
if (!location || !location->isString("Island")) if (!location || !location->isString("Island"))
{ {
err = new CVerfiyRightRtScenarioError(CVerfiyRightRtScenarioError::InvalidData); err = new CVerfiyRightRtScenarioError(CVerfiyRightRtScenarioError::InvalidData);
@ -445,7 +445,7 @@ bool CRingAccess::verifyRtScenario(CObject* rtScenario, const std::string& charR
uint32 lastActIndex = acts->getSize(); uint32 lastActIndex = acts->getSize();
for ( ;firstActIndex != lastActIndex; ++firstActIndex) for ( ;firstActIndex != lastActIndex; ++firstActIndex)
{ {
CObject* act = acts->getValue(firstActIndex); CObject* act = acts->getValueAtPos(firstActIndex);
if (!act || !act->isTable() || !act->isTable("Npcs")) if (!act || !act->isTable() || !act->isTable("Npcs"))
{ {
err = new CVerfiyRightRtScenarioError(CVerfiyRightRtScenarioError::InvalidData); err = new CVerfiyRightRtScenarioError(CVerfiyRightRtScenarioError::InvalidData);
@ -457,7 +457,7 @@ bool CRingAccess::verifyRtScenario(CObject* rtScenario, const std::string& charR
uint32 lastNpcIndex = npcs->getSize(); uint32 lastNpcIndex = npcs->getSize();
for (; firstNpcIndex != lastNpcIndex; ++firstNpcIndex) for (; firstNpcIndex != lastNpcIndex; ++firstNpcIndex)
{ {
CObject* npc = npcs->getValue(firstNpcIndex); CObject* npc = npcs->getValueAtPos(firstNpcIndex);
if (npc && npc->isTable() && npc->isString("SheetClient") && npc->isString("Sheet")) if (npc && npc->isTable() && npc->isString("SheetClient") && npc->isString("Sheet"))
{ {
std::string botName; std::string botName;

View file

@ -122,7 +122,7 @@ CObject *CScenario::find(const std::string& instanceId, const std::string & attr
} }
if (position != -1) if (position != -1)
{ {
CObject *subObj = src->getValue(position); CObject *subObj = src->getValueAtPos(position);
if (!subObj) if (!subObj)
{ {
nlwarning("Can't find attribute %s[%d] inside object with InstanceId = %s", attrName.c_str(), (int) position, instanceId.c_str()); nlwarning("Can't find attribute %s[%d] inside object with InstanceId = %s", attrName.c_str(), (int) position, instanceId.c_str());
@ -388,7 +388,7 @@ void CInstanceMap::add(CObject* root)
sint32 first = 0; sint32 first = 0;
for (first = 0 ; first != size ; ++first) for (first = 0 ; first != size ; ++first)
{ {
CObject* value = root->getValue(first); CObject* value = root->getValueAtPos(first);
add(value); add(value);
} }
@ -416,7 +416,7 @@ void CInstanceMap::remove(CObject* root)
sint32 first = 0; sint32 first = 0;
for (first = 0 ; first != size ; ++first) for (first = 0 ; first != size ; ++first)
{ {
CObject* value = root->getValue(first); CObject* value = root->getValueAtPos(first);
remove(value); remove(value);
} }

View file

@ -691,7 +691,7 @@ void CAttributeToProperty::setPrimPath()
points->VPoints.resize(last); points->VPoints.resize(last);
for ( ; first != last ; ++first ) for ( ; first != last ; ++first )
{ {
CObject* pt = pts->getValue(first); CObject* pt = pts->getValueAtPos(first);
attr = pt->getAttr("x"); attr = pt->getAttr("x");
if (attr && attr->isNumber()) { points->VPoints[first].x = static_cast<float>(attr->toNumber()); } if (attr && attr->isNumber()) { points->VPoints[first].x = static_cast<float>(attr->toNumber()); }
@ -721,7 +721,7 @@ void CAttributeToProperty::setPrimZone()
points->VPoints.resize(last); points->VPoints.resize(last);
for ( ; first != last ; ++first ) for ( ; first != last ; ++first )
{ {
CObject* pt = pts->getValue(first); CObject* pt = pts->getValueAtPos(first);
attr = pt->getAttr("x"); attr = pt->getAttr("x");
if (attr && attr->isNumber()) { points->VPoints[first].x = static_cast<float>(attr->toNumber()); } if (attr && attr->isNumber()) { points->VPoints[first].x = static_cast<float>(attr->toNumber()); }
@ -1103,7 +1103,7 @@ IPrimitive* CServerAnimationModule::getAction(CObject* action, const std::string
uint32 nb =children->getSize(); uint32 nb =children->getSize();
for(uint32 i=0;i<nb;++i) for(uint32 i=0;i<nb;++i)
{ {
IPrimitive* tmp=getAction(children->getValue(i), prefix,scenarioId); IPrimitive* tmp=getAction(children->getValueAtPos(i), prefix,scenarioId);
if (!tmp) if (!tmp)
{ {
nlwarning("Error in action %s nb: %u", action->toString("Name").c_str(), i); nlwarning("Error in action %s nb: %u", action->toString("Name").c_str(), i);
@ -1466,7 +1466,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
for ( ; firstAiState != lastAiState ; ++firstAiState) for ( ; firstAiState != lastAiState ; ++firstAiState)
{ {
CObject* aiState = aiStates->getValue(firstAiState); CObject* aiState = aiStates->getValueAtPos(firstAiState);
std::string aiMovement = aiState->toString("AiMovement"); std::string aiMovement = aiState->toString("AiMovement");
@ -1532,7 +1532,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
uint32 firstChild(0), lastChild(children->getSize()); uint32 firstChild(0), lastChild(children->getSize());
for ( ; firstChild != lastChild ; ++firstChild) for ( ; firstChild != lastChild ; ++firstChild)
{ {
CObject* childName = children->getValue(firstChild); CObject* childName = children->getValueAtPos(firstChild);
CObject* component = components.find(childName->toString()); CObject* component = components.find(childName->toString());
@ -1597,7 +1597,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
uint32 firstNpc(0), lastNpc(npcChild->getSize()); uint32 firstNpc(0), lastNpc(npcChild->getSize());
for ( ; firstNpc != lastNpc ; ++firstNpc) for ( ; firstNpc != lastNpc ; ++firstNpc)
{ {
CObject* objectNpcId = npcChild->getValue(firstNpc); CObject* objectNpcId = npcChild->getValueAtPos(firstNpc);
std::string npcId ( objectNpcId->toString() ); std::string npcId ( objectNpcId->toString() );
CObject* objectNpc = components.find(npcId); CObject* objectNpc = components.find(npcId);
@ -1760,14 +1760,14 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
for(;firstEvent!=lastEvent;++firstEvent) for(;firstEvent!=lastEvent;++firstEvent)
{ {
//create the primitive event and its associated actions //create the primitive event and its associated actions
IPrimitive* pEvent = getEvent(events->getValue(firstEvent), components, prefix, animSession->SessionId); IPrimitive* pEvent = getEvent(events->getValueAtPos(firstEvent), components, prefix, animSession->SessionId);
if (!pEvent) if (!pEvent)
{ {
nlwarning("Error while generating primitive"); nlwarning("Error while generating primitive");
return false; return false;
} }
//insert the primitive event //insert the primitive event
CObject* eventObject = events->getValue(firstEvent); CObject* eventObject = events->getValueAtPos(firstEvent);
bool isTriggerZone = false; bool isTriggerZone = false;
if ( eventObject->isInteger("IsTriggerZone") ) if ( eventObject->isInteger("IsTriggerZone") )
@ -1806,7 +1806,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
uint32 firstnode = 0; uint32 firstnode = 0;
for (; firstnode != lastnode; ++firstnode) for (; firstnode != lastnode; ++firstnode)
{ {
CObject* node = tree->getValue(firstnode); CObject* node = tree->getValueAtPos(firstnode);
if (!node if (!node
|| !node->isTable() || !node->isTable()
|| !node->isString("Name") || !node->isString("Name")
@ -1898,7 +1898,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi
uint32 firstPlotItem = 0; uint32 firstPlotItem = 0;
for (; firstPlotItem != lastPlotItem; ++firstPlotItem) for (; firstPlotItem != lastPlotItem; ++firstPlotItem)
{ {
CObject* plotItem = plotItems->getValue(firstPlotItem); CObject* plotItem = plotItems->getValueAtPos(firstPlotItem);
if (!plotItem if (!plotItem
|| !plotItem->isTable() || !plotItem->isTable()
|| !plotItem->isInteger("SheetId") || !plotItem->isInteger("SheetId")
@ -1955,7 +1955,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi
uint32 firstLocation = 0; uint32 firstLocation = 0;
for (; firstLocation != lastLocation; ++firstLocation) for (; firstLocation != lastLocation; ++firstLocation)
{ {
CObject* location = locations->getValue(firstLocation); CObject* location = locations->getValueAtPos(firstLocation);
if (!location if (!location
|| !location->isTable() || !location->isTable()
|| !location->isInteger("Season") || !location->isInteger("Season")
@ -1991,7 +1991,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi
for (; firstAct != lastAct ; ++firstAct) for (; firstAct != lastAct ; ++firstAct)
{ {
//std::string key = acts->getKey(firstAct); //std::string key = acts->getKey(firstAct);
CObject* act= acts->getValue(firstAct); CObject* act= acts->getValueAtPos(firstAct);
if (!act) if (!act)
{ {
nlwarning("R2An: Can't make animation session, invalid RtAct"); nlwarning("R2An: Can't make animation session, invalid RtAct");
@ -3697,7 +3697,7 @@ IPrimitive* CServerAnimationModule::getEvent(CObject* event,CInstanceMap& compon
//for each action of this event //for each action of this event
for(;firstAction!=lastAction;++firstAction) for(;firstAction!=lastAction;++firstAction)
{ {
CObject * action_id = actions_id->getValue(firstAction); CObject * action_id = actions_id->getValueAtPos(firstAction);
std::string id = action_id->toString(); std::string id = action_id->toString();
CObject* action=components.find(id); // can be null? CObject* action=components.find(id); // can be null?
if (!action) if (!action)
@ -3770,7 +3770,7 @@ void CServerAnimationModule::requestLoadTable(CAnimationSession* session)
msg.serial(size); msg.serial(size);
for(uint32 i=0;i<size;++i) for(uint32 i=0;i<size;++i)
{ {
CObject* entry = textsTable->getValue(i); CObject* entry = textsTable->getValueAtPos(i);
std::string tmp = entry->getAttr("Id")->toString(); std::string tmp = entry->getAttr("Id")->toString();
msg.serial(tmp); msg.serial(tmp);
tmp = entry->getAttr("Text")->toString(); tmp = entry->getAttr("Text")->toString();

View file

@ -3645,7 +3645,7 @@ bool CServerEditionModule::checkScenario(CObject* scenario)
uint32 max = acts->getSize(); uint32 max = acts->getSize();
for(uint32 i = 0;i<max;i++) for(uint32 i = 0;i<max;i++)
{ {
CObject * act = acts->getValue(i); CObject * act = acts->getValueAtPos(i);
CObject * npcs = act->findAttr("Npcs"); CObject * npcs = act->findAttr("Npcs");
CObject * states = act->findAttr("AiStates"); CObject * states = act->findAttr("AiStates");
if (states && states->isTable()) if (states && states->isTable())
@ -4022,14 +4022,14 @@ bool CServerEditionModule::getPosition(TSessionId sessionId, double& x, double&
CObject* acts = hl->getAttr("Acts"); CObject* acts = hl->getAttr("Acts");
BOMB_IF(!acts || !acts->isTable() || actIndex >= acts->getSize(), "Invalid acts.", return false); BOMB_IF(!acts || !acts->isTable() || actIndex >= acts->getSize(), "Invalid acts.", return false);
CObject* selectedAct = acts->getValue(actIndex); CObject* selectedAct = acts->getValueAtPos(actIndex);
BOMB_IF(!selectedAct || !selectedAct->isString("LocationId"), "Invalid act.", return false); BOMB_IF(!selectedAct || !selectedAct->isString("LocationId"), "Invalid act.", return false);
std::string locationInstanceId = selectedAct->toString("LocationId"); std::string locationInstanceId = selectedAct->toString("LocationId");
uint32 firstLocationIndex = 0, lastLocationIndex = locations->getSize(); uint32 firstLocationIndex = 0, lastLocationIndex = locations->getSize();
for (; firstLocationIndex != lastLocationIndex; ++firstLocationIndex) for (; firstLocationIndex != lastLocationIndex; ++firstLocationIndex)
{ {
CObject* location = locations->getValue(firstLocationIndex); CObject* location = locations->getValueAtPos(firstLocationIndex);
if ( location && location->isString("InstanceId") && location->toString("InstanceId") == locationInstanceId ) if ( location && location->isString("InstanceId") && location->toString("InstanceId") == locationInstanceId )
{ {
locationId = firstLocationIndex; locationId = firstLocationIndex;
@ -4043,7 +4043,7 @@ bool CServerEditionModule::getPosition(TSessionId sessionId, double& x, double&
CObject* firstLocation = locations->getValue(locationId); CObject* firstLocation = locations->getValueAtPos(locationId);
BOMB_IF(!firstLocation || !firstLocation->isTable(), "Invalid location.", return false); BOMB_IF(!firstLocation || !firstLocation->isTable(), "Invalid location.", return false);
CObject* entryPointObj = firstLocation->getAttr("EntryPoint"); CObject* entryPointObj = firstLocation->getAttr("EntryPoint");

View file

@ -123,7 +123,7 @@ CSmallStringManager::CSmallStringManager(CObject* textManager)
//unused ids //unused ids
for(uint32 i=0;i<max;i++) for(uint32 i=0;i<max;i++)
{ {
uint32 id = static_cast<uint32>(unused->getValue(i)->toInteger()); uint32 id = static_cast<uint32>(unused->getValueAtPos(i)->toInteger());
_FreeIds.insert(id); _FreeIds.insert(id);
} }
@ -131,7 +131,7 @@ CSmallStringManager::CSmallStringManager(CObject* textManager)
max = texts->getSize(); max = texts->getSize();
for(uint32 i=0;i<max;i++) for(uint32 i=0;i<max;i++)
{ {
CObject* entry = texts->getValue(i); CObject* entry = texts->getValueAtPos(i);
std::string text = entry->getAttr("Text")->toString(); std::string text = entry->getAttr("Text")->toString();
uint32 textId = static_cast<uint32>(entry->getAttr("TextId")->toInteger()); uint32 textId = static_cast<uint32>(entry->getAttr("TextId")->toInteger());
uint32 textCount = static_cast<uint32>(entry->getAttr("Count")->toInteger()); uint32 textCount = static_cast<uint32>(entry->getAttr("Count")->toInteger());

View file

@ -417,7 +417,7 @@ void CStringManagerModule::registerTableRequested(TSessionId sessionId,CObject*
//for each entry of the local table //for each entry of the local table
for(uint i=0;i<max;++i) for(uint i=0;i<max;++i)
{ {
CObject* text = textsTable->getValue(i); CObject* text = textsTable->getValueAtPos(i);
CObject* tmp = text->getAttr("Id"); CObject* tmp = text->getAttr("Id");
nlassert(tmp); nlassert(tmp);
std::string localId = tmp->toString(); std::string localId = tmp->toString();