o co chodzi z tym kodem:
deklaracja struktur:
class Node
{
public:
int x, y;
int halfwidth;
Node *child[4];
Node(int x,int y,int hw);
};
// Tjunc - a node from which to create linked lists pointing to game objects
class Tjunc
{
public:
int magic; // TEMP
GameObject *gameObject;
Tjunc *next;
Tjunc( GameObject *g, Tjunc *n);
};
w jakiejś tam funkcji:
Node *node;
Tjunc *ptr;
Tjunc *list;
// [...]
list = (Tjunc*) node; <font color=green>(*)</font>
// First check if the game object is already in the linked list
ptr = list;
while (ptr != NULL)
{
if(ptr->gameObject->id == gobj->id ) // found it
return; // it's already in the list, do nothing!
ptr = ptr->next;
}
// Add new item to head of the list
list = new Tjunc( gobj, list );
prev->child[SW] = (Node*)list; <font color=green>(*)</font>
Byłbym wdzięczny, gdyby ktoś wyjaśnił mi co to za rzutowanie (jak działa) oznaczone <font color="green">(*)</span> , bo przechodzi ono moje pojęcie.