I once again went into the issue, only to find out that i don't remember anything and don't understand something that was for me obvious once.
void AddNextCSG(TCSGInfo * first, TCSGInfo * to_add)
{
TCSGInfo * p = first;
if (p == 0)
{
ALOG("ADDING AS FIRST CSG");
first = to_add;
}
else
{
ALOG("ADDING AS NEXT CSG");
p = GetLastCSG(first);
p->next = to_add;
}
}
TCSGInfo * GetLastCSG(TCSGInfo * first)
{
TCSGInfo * p = first;
while (p!=0)
{
if (p->next == 0) return p;
p = p->next;
}
return 0;
}
Take a look at AddNextCSG function the phrpose was just to add another element to a linked list, however instead of adding nothing happens, but wheb i pass the first object as pointer to a reference it gets modified, but actually why i cant just use such simple some_pointer->value = something; type
TCSGInfo * csg_output = 0;
for (int i=0; i < model->FaceLength; i++)
{
TCSGInfo * csgout = new TCSGInfo();
AddNextCSG(csg_output, csgout);
}
I get ADDING AS FIRST CSG" all the time
Do i have to dereference a pointer?
TCSGInfo * p = first;
if (p == 0)
{
ALOG("ADDING AS FIRST CSG");
(* first) =(* to_add);
}
This is exactly what im trying to avoid.
Thia code above has no sense when first is null anyway even if it wasnt null it has no sense i dont need to copy values from one to another but want that first points on newely created pointer that points on a newely created structure !!!
Maybe this is because TCSGInfo holds three structures with overloaded = operator, but still TCSGInfo has no overloaded operators at all and when i point one onto another the one should become another