Waypoint List

Use a linked list structure to store a set of waypoints. Any new waypoint can be added at any point in the list.

Declare waypoints as structs.

Each waypoint will be a node in the linked list.

Ex: Waypoint 3 Attributes:
 * 1) int East
 * 2) int West
 * 3) struct waypoint Next

/* include 

struct waypoint {

int East; int West; struct waypoint * next; }

typedef struct waypoint wp; //stands for waypoint

void main {

wp * curr, * head int i;

head = null;

for (i=1;i<=10;i++) { curr = (wp *)malloc(sizeof(wp)); curr.East = 5; curr.West = 10; head = curr; }

curr = head;

while(curr) { curr = curr.next; } }



Work In Progress

This linked list is linearly traversable. Can not go backwards or tell what position you are at.

What functionality is needed?
 * Add nodes to any position
 * Function must take two paramaters (struct waypoint wp, int position)
 * avoid traversing through nodes before adding (ex Adding a waypoint after node 5 shouldnt iterate through nodes 1-4)
 * Regular function will add any new waypoints to end of list

Different cases:
 * Might want to change coordinate immediately (adds waypoint to current direction, makes that waypoint the head node)
 * Add a waypoint to go to after the boat reaches currently lined up waypoint - addNext function
 * Add a waypoint to the end of the list in sequence (regular functionality)
 * Add a waypoint to head to third -- will have to have numbered node positions, iterations through list

-Nik