Fixed: Clang warnings

This commit is contained in:
kervala 2015-12-13 15:25:28 +01:00
parent ae5457d717
commit 542c29ded7
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.
virtual NLMISC::CRGBA getDrawnHeaderColor () const{ return NLMISC::CRGBA(); };
uint8 getCurrentContainerAlpha() const{ return _CurrentContainerAlpha; }
uint8 getCurrentContentAlpha() const{ return _CurrentContentAlpha; }
uint8 getCurrentContainerAlpha() const { return _CurrentContainerAlpha; }
uint8 getCurrentContentAlpha() const { return _CurrentContentAlpha; }
virtual bool isGrayed() const{ return false; }
virtual bool getTouchFlag(bool clearFlag) const{ return false; }
virtual void backupPosition(){}
virtual void restorePosition(){}
virtual bool isGrayed() const { return false; }
virtual bool getTouchFlag(bool /* clearFlag */) const { return false; }
virtual void backupPosition() {}
virtual void restorePosition() {}
protected:
void triggerAlphaSettingsChangedAH();

View file

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

View file

@ -370,7 +370,7 @@ inline void aligned_free(void *ptr) { _aligned_free(ptr); }
#elif defined(NL_OS_MAC)
#include <stdlib.h>
// 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); }
#else
#include <malloc.h>

View file

@ -154,10 +154,12 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f )
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];
if (ext->Function == GRAPHICS_EXT_FUNC_CODE) {
if (ext->Function == GRAPHICS_EXT_FUNC_CODE)
{
uint8 flag = ext->Bytes[0];
//delay = (ext.Bytes[1] << 8) | ext.Bytes[2];
transparency = (flag & GIF_TRANSPARENT_MASK) ? ext->Bytes[3] : GIF_NOT_TRANSPARENT;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -754,7 +754,7 @@ const CInstance *CInstance::getParentGroupLeader() const
{
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())
{
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 (parentInstanceTable->getValue(_IndexInParent) == static_cast<const CObject *>(this))
if (parentInstanceTable->getValueAtPos(_IndexInParent) == static_cast<const CObject *>(this))
{
name = parentInstanceTable->getKey(_IndexInParent);
indexInArray = -1;
@ -230,13 +230,13 @@ void CObjectRefIdClient::getNameInParent(std::string &name, sint32 &indexInArray
}
else
{
CObject *subObject = parentInstanceTable->getValue(_IndexInParent);
CObject *subObject = parentInstanceTable->getValueAtPos(_IndexInParent);
if (subObject->isTable())
{
CObjectTable *subTable = (CObjectTable *) subObject;
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);
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)
for (uint k = 0; k < parentInstanceTable->getSize(); ++k)
{
if (parentInstanceTable->getValue(k) == ptrInParent)
if (parentInstanceTable->getValueAtPos(k) == ptrInParent)
{
_IndexInParent = k;
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
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);
_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);
#if 1
static const unsigned char perm[][3] = {
0,21,42,22,43,1,44,2,23,3,24,45,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 };
{ 0, 21, 42 },
{ 22, 43, 1 },
{ 44, 2, 23 },
{ 3, 24, 45 },
{ 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,
(md[perm[i][0]]<<16)|(md[perm[i][1]]<<8)|md[perm[i][2]], 4);
#else

View file

@ -1154,8 +1154,8 @@ public:
friend iterator; // MSVC
friend const_iterator;
#else
template <class U, class V> friend class _CMirrorPropValueListIterator; // GCC3
template <class U, class V> friend class _CCMirrorPropValueListIterator;
template <class U, class V> friend struct _CMirrorPropValueListIterator; // GCC3
template <class U, class V> friend struct _CCMirrorPropValueListIterator;
#endif
/// Constructor
@ -1241,9 +1241,9 @@ public:
friend iterator; // MSVC
friend const_iterator;
#else
template <class U, class V> friend class _CMirrorPropValueListIterator; // GCC3
template <class U, class V> friend class _CCMirrorPropValueListIterator;
template<class U, class V> friend class CMirrorPropValueItem;
template <class U, class V> friend struct _CMirrorPropValueListIterator; // GCC3
template <class U, class V> friend struct _CCMirrorPropValueListIterator;
template<class U, class V> friend class CMirrorPropValueItem;
#endif
/// 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 "";}
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; }
@ -974,7 +974,7 @@ void CObjectTable::checkIntegrity() const
{
for(uint k = 0; k < getSize(); ++k)
{
CObject *subObj = getValue(k);
CObject *subObj = getValueAtPos(k);
if (subObj)
{
if (!subObj->getGhost())
@ -1017,7 +1017,7 @@ void CObjectTable::setGhost(bool ghost)
for(uint k = 0; k < getSize(); ++k)
{
CObject *subObj = getValue(k);
CObject *subObj = getValueAtPos(k);
if (subObj)
{
subObj->setGhost(ghost);
@ -1031,7 +1031,7 @@ void CObjectTable::previsit(std::vector<CObject::TRefPtr> &sons)
sons.reserve(sons.size() + getSize());
for(uint k = 0; k < getSize(); ++k)
{
CObject *subObj = getValue(k);
CObject *subObj = getValueAtPos(k);
if (subObj)
{
subObj->previsit(sons);
@ -1068,7 +1068,7 @@ void CObjectTable::inPlaceCopy(const CObjectTable &src)
}
else
{
src.getValue(k)->inPlaceCopyTo(*dest);
src.getValueAtPos(k)->inPlaceCopyTo(*dest);
}
}
else
@ -1115,7 +1115,7 @@ void CObjectTable::sort()
uint32 lastKey = keys->getSize();
for (; firstKey != lastKey ; ++firstKey)
{
CObject* keyObject = keys->getValue(firstKey);
CObject* keyObject = keys->getValueAtPos(firstKey);
if (! keyObject->isString()) return;
std::string key = keyObject->toString();
@ -1344,7 +1344,7 @@ std::string CObjectTable::getKey(uint32 pos) const
return _Value[pos].first;
}
CObject* CObjectTable::getValue(uint32 pos) const
CObject* CObjectTable::getValueAtPos(uint32 pos) const
{
//H_AUTO(R2_CObjectTable_getValue)
if (pos >= _Value.size())
@ -1404,7 +1404,7 @@ bool CObjectTable::setObject(const std::string& key, CObject* value)
for ( ; first != last ; ++first)
{
std::string key1 = table->getKey(first);
CObject* value1 = table->getValue(first);
CObject* value1 = table->getValueAtPos(first);
add(key1, value1->clone());
}
return true;
@ -1577,9 +1577,9 @@ bool CObjectTable::equal(const CObject* other) const
for ( i=0; i!= size ; ++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 ( !value->equal(this->getValue(i))) return false;
if ( !value->equal(this->getValueAtPos(i))) return false;
}
return true;
}
@ -1835,7 +1835,7 @@ void CObjectGenerator::createDefaultValues(CObjectFactory* factory)
uint32 last = prop->getSize();
for ( ; first != last ; ++first )
{
CObject* found = prop->getValue(first);
CObject* found = prop->getValueAtPos(first);
if (found && found->isString("DefaultValue") && found->isString("Name") )
{
@ -1895,7 +1895,7 @@ CObject* CObjectGenerator::instanciate(CObjectFactory* factory) const
uint32 last = prop->getSize();
for ( ; first != last ; ++first )
{
CObject* found = prop->getValue(first);
CObject* found = prop->getValueAtPos(first);
if (found && found->isString("Type") )
{
@ -2461,7 +2461,7 @@ public:
uint8 shortKey = static_cast<uint8>(uiKey);
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());}
onSerial(stream, key, value, serializer);
}
@ -2483,7 +2483,7 @@ public:
stream.serial(last16);
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);}
CObjectSerializerImpl::getInstance().serialImpl(stream, value, serializer);
}
@ -2509,7 +2509,7 @@ public:
{
uint32 keyIndex = otherPropFoundIndex[first];
std::string key = data->getKey(keyIndex);
CObject* value = data->getValue(keyIndex);
CObject* value = data->getValueAtPos(keyIndex);
stream.serial(key);
if (serializer->Log) { nldebug("R2NET: (%u) Field '%s'", serializer->Level, key.c_str());}
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)
{
std::string key = data->getKey(first);
CObject* value = data->getValue(first);
CObject* value = data->getValueAtPos(first);
stream.serial(key);
++ (serializer->Level);
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 CObject* getValue(uint32 pos) const;
virtual CObject* getValueAtPos(uint32 pos) const;
virtual uint32 getSize() const;
@ -385,7 +385,7 @@ public:
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;

View file

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

View file

@ -122,7 +122,7 @@ CObject *CScenario::find(const std::string& instanceId, const std::string & attr
}
if (position != -1)
{
CObject *subObj = src->getValue(position);
CObject *subObj = src->getValueAtPos(position);
if (!subObj)
{
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;
for (first = 0 ; first != size ; ++first)
{
CObject* value = root->getValue(first);
CObject* value = root->getValueAtPos(first);
add(value);
}
@ -416,7 +416,7 @@ void CInstanceMap::remove(CObject* root)
sint32 first = 0;
for (first = 0 ; first != size ; ++first)
{
CObject* value = root->getValue(first);
CObject* value = root->getValueAtPos(first);
remove(value);
}

View file

@ -691,7 +691,7 @@ void CAttributeToProperty::setPrimPath()
points->VPoints.resize(last);
for ( ; first != last ; ++first )
{
CObject* pt = pts->getValue(first);
CObject* pt = pts->getValueAtPos(first);
attr = pt->getAttr("x");
if (attr && attr->isNumber()) { points->VPoints[first].x = static_cast<float>(attr->toNumber()); }
@ -721,7 +721,7 @@ void CAttributeToProperty::setPrimZone()
points->VPoints.resize(last);
for ( ; first != last ; ++first )
{
CObject* pt = pts->getValue(first);
CObject* pt = pts->getValueAtPos(first);
attr = pt->getAttr("x");
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();
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)
{
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)
{
CObject* aiState = aiStates->getValue(firstAiState);
CObject* aiState = aiStates->getValueAtPos(firstAiState);
std::string aiMovement = aiState->toString("AiMovement");
@ -1532,7 +1532,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
uint32 firstChild(0), lastChild(children->getSize());
for ( ; firstChild != lastChild ; ++firstChild)
{
CObject* childName = children->getValue(firstChild);
CObject* childName = children->getValueAtPos(firstChild);
CObject* component = components.find(childName->toString());
@ -1597,7 +1597,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
uint32 firstNpc(0), lastNpc(npcChild->getSize());
for ( ; firstNpc != lastNpc ; ++firstNpc)
{
CObject* objectNpcId = npcChild->getValue(firstNpc);
CObject* objectNpcId = npcChild->getValueAtPos(firstNpc);
std::string npcId ( objectNpcId->toString() );
CObject* objectNpc = components.find(npcId);
@ -1760,14 +1760,14 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
for(;firstEvent!=lastEvent;++firstEvent)
{
//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)
{
nlwarning("Error while generating primitive");
return false;
}
//insert the primitive event
CObject* eventObject = events->getValue(firstEvent);
CObject* eventObject = events->getValueAtPos(firstEvent);
bool isTriggerZone = false;
if ( eventObject->isInteger("IsTriggerZone") )
@ -1806,7 +1806,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C
uint32 firstnode = 0;
for (; firstnode != lastnode; ++firstnode)
{
CObject* node = tree->getValue(firstnode);
CObject* node = tree->getValueAtPos(firstnode);
if (!node
|| !node->isTable()
|| !node->isString("Name")
@ -1898,7 +1898,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi
uint32 firstPlotItem = 0;
for (; firstPlotItem != lastPlotItem; ++firstPlotItem)
{
CObject* plotItem = plotItems->getValue(firstPlotItem);
CObject* plotItem = plotItems->getValueAtPos(firstPlotItem);
if (!plotItem
|| !plotItem->isTable()
|| !plotItem->isInteger("SheetId")
@ -1955,7 +1955,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi
uint32 firstLocation = 0;
for (; firstLocation != lastLocation; ++firstLocation)
{
CObject* location = locations->getValue(firstLocation);
CObject* location = locations->getValueAtPos(firstLocation);
if (!location
|| !location->isTable()
|| !location->isInteger("Season")
@ -1991,7 +1991,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi
for (; firstAct != lastAct ; ++firstAct)
{
//std::string key = acts->getKey(firstAct);
CObject* act= acts->getValue(firstAct);
CObject* act= acts->getValueAtPos(firstAct);
if (!act)
{
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(;firstAction!=lastAction;++firstAction)
{
CObject * action_id = actions_id->getValue(firstAction);
CObject * action_id = actions_id->getValueAtPos(firstAction);
std::string id = action_id->toString();
CObject* action=components.find(id); // can be null?
if (!action)
@ -3770,7 +3770,7 @@ void CServerAnimationModule::requestLoadTable(CAnimationSession* session)
msg.serial(size);
for(uint32 i=0;i<size;++i)
{
CObject* entry = textsTable->getValue(i);
CObject* entry = textsTable->getValueAtPos(i);
std::string tmp = entry->getAttr("Id")->toString();
msg.serial(tmp);
tmp = entry->getAttr("Text")->toString();

View file

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

View file

@ -123,7 +123,7 @@ CSmallStringManager::CSmallStringManager(CObject* textManager)
//unused ids
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);
}
@ -131,7 +131,7 @@ CSmallStringManager::CSmallStringManager(CObject* textManager)
max = texts->getSize();
for(uint32 i=0;i<max;i++)
{
CObject* entry = texts->getValue(i);
CObject* entry = texts->getValueAtPos(i);
std::string text = entry->getAttr("Text")->toString();
uint32 textId = static_cast<uint32>(entry->getAttr("TextId")->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(uint i=0;i<max;++i)
{
CObject* text = textsTable->getValue(i);
CObject* text = textsTable->getValueAtPos(i);
CObject* tmp = text->getAttr("Id");
nlassert(tmp);
std::string localId = tmp->toString();