Amazing weekend work

We didn’t set any specified times for when to get down to school today but i’d say i overslept when waking up at 11:50 AM.
In any case once i actually got down to school i added a function to the creation of track segments which after they have been placed also rotates them to the correct values. With that done i felt like i was out of things to do before we actually have something drawn on the screen.
So i started working on fixing the final parts of Assignment 1. I had to do the hand in over since i didn’t have a proper destructor in the Linked List so i decided to go all the way and add proper cleanup functions to that and the Binary SearchTree.
The Linked list uses two functions, cleanup which simply check if the first node is empty, if not it calls the functions removeNodes which takes the first note’s “Next” pointer to the following node.
In removeNodes it checks if that node’s “Next” pointer is a nullpointer and if it isn’t it calls itself using the current node’s “Next” pointer. After that it removed the “Next” pointer of the current node. This way it loops through the list and removes every node.
The binary searchtree works similarly where it checks if the root node is a nullptr and if it’s not it calls a function called cleanupTraversal which takes one node pointer, starting with the root node. This function starts by taking the argument node (loopNode) and first checks the lowchild, if the lowchild is not a nullpointer it calls itself using the lowchild pointer as argument and then empties the lowchild. The same thing is then done for highchild pointers and finally if the loopnode’s parent pointer is not a nullpointer, it is set to be one.

I also realized that the only two objects in the game that require collision is the player objects and the obstacles, this makes the collision handling much easier since i only need to check the type of the objects in the handleCollision function. I might have to have the funcion take a pointer to the game state in order for it to affect things but this simple form of collision handling should be enough for this fairly simple game.