First, I'll post all the relevant code..
--------------------------------------------------------------------------
#include "classes.h"
vector<BluePrint> bprint;
vector<Object> object;
//================================================== =================================================
void CreateObject(int onum)
{
Object NewObject;
NewObject.ONum = onum;
NewObject.Hierarchy = GetBPrint(onum).Daughter_Amount + 1;
bprint[GetBPrintVectorPos(onum)].Daughter_Amount++;
object.push_back(NewObject);
cout << "<CreateObject>: Created new object " << onum << endl;
}
Object GetObject(int onum, int Heirarchy)
{
int X;
for(X=0;X<object.size();X++)
{
if(object[X].ONum == onum)
{
if(object[X].Hierarchy == Heirarchy)
{
return object[X];
}
}
}
cout << "<GetObject>: Error: no object found." << endl;
return object[0];
}
int GetObjectVectorPos(int ONum, int Hierarchy)
{
int VectorNum;
for(VectorNum = 0;VectorNum <= object.size();VectorNum++)
{
if(ONum == object[VectorNum].ONum)
{
if(Hierarchy == object[VectorNum].Hierarchy)
{
return VectorNum;
}
}
}
cout << "<GetObjectVectorPos>: ERROR: No objects found." << endl;
return 0;
}
void PutObjectInObject(Object Item, Object Container)
{
GetObject(100, 1).Container = 5;
Container.Item.push_back(Item.ONum);
}
---------------------------------------------------------------------
and in an included .h
-------------------------------
class Object
{
public:
int ONum;
int Hierarchy;
vector<int> Item;
int Container;
};
------------------------------------------------------------------------------
using PutObjectInObject gives me this error:
c:\vc++ projects\objhandler\objects.h(133) : error C2106: '=' : left operand must be l-value
on the line that has GetObject(100, 1).Container = 5; .
Anyone know whats wrong? Also, substituting GetObject(100, 1) for object[any number] will fix it. However, I can't do that for other reasons.