}//end of addRoom /*this method was to find the current location of the player and return it. * it will take two arguements, the players location node as well as the list. It will start from the head and traverse * throught the list until the location matches the node in the list which it will return. * created by Caleb Mathomes on 17/12/14*/ public GameNode findLocation(GameNode location, GameList list) { GameNode current = list.head; while (location != current) { current = current.next; } return current; }//end of findLocation
}//end of findLocation /*this method is set to link the tail of the list to the head. It takes in the list as an arguement which will set * a local not to its head, traverse to the tail and set the other local node to the tail which will then set * that end node to the head linking the tail to the head. * this bit of code was created jointly Martin McCaslin and ammended on 25/11/14 by Caleb Mathomes*/ public void findLast(GameList newList) { GameNode node = newList.head; GameNode tail = null; while (node.getNode() != null) { node = node.getNode(); } tail = node; node.next = head; }//end findLast