GL - Call by reference instead

This commit is contained in:
dean11 2014-02-18 11:44:02 +01:00
parent 06ddb86b17
commit 484b055338
3 changed files with 5 additions and 9 deletions

View File

@ -61,7 +61,7 @@ namespace GameLogic
ObjectSpecialType GetObjectType() const override;
int getNrOfDynamicObj()const override;
IObjectData* GetObjectAt(int ID) const override;
Utility::DynamicMemory::DynamicArray<IObjectData*> GetAllDynamicObjects() const override;
void GetAllDynamicObjects(Utility::DynamicMemory::DynamicArray<IObjectData*>& mem) const override;
Level *level;
};

View File

@ -108,7 +108,7 @@ namespace GameLogic
public:
virtual int getNrOfDynamicObj()const = 0;
virtual IObjectData* GetObjectAt(int ID) const = 0;
virtual Utility::DynamicMemory::DynamicArray<IObjectData*> GetAllDynamicObjects() const = 0;
virtual void GetAllDynamicObjects(Utility::DynamicMemory::DynamicArray<IObjectData*>& destMem) const = 0;
};
class DANBIAS_GAMELOGIC_DLL GameAPI

View File

@ -52,14 +52,10 @@ IObjectData* Game::LevelData::GetObjectAt(int ID) const
return this->level->GetObj(ID);
}
Utility::DynamicMemory::DynamicArray<IObjectData*> Game::LevelData::GetAllDynamicObjects() const
void Game::LevelData::GetAllDynamicObjects(Utility::DynamicMemory::DynamicArray<IObjectData*>& mem) const
{
Utility::DynamicMemory::DynamicArray<IObjectData*> objects(level->dynamicObjects.Size());
for(int i = 0; i < level->dynamicObjects.Size(); i++)
{
objects[i] = level->dynamicObjects[i];
mem[i] = level->dynamicObjects[i];
}
return objects;
}