Skip to content

Instantly share code, notes, and snippets.

@iamjwc
Created October 8, 2009 05:16
Show Gist options
  • Save iamjwc/204771 to your computer and use it in GitHub Desktop.
Save iamjwc/204771 to your computer and use it in GitHub Desktop.
diff --git a/.LinkedList.h.swp b/.LinkedList.h.swp
deleted file mode 100644
index e442d92..0000000
Binary files a/.LinkedList.h.swp and /dev/null differ
diff --git a/.Queue.h.swp b/.Queue.h.swp
deleted file mode 100644
index 008843e..0000000
Binary files a/.Queue.h.swp and /dev/null differ
diff --git a/Behavior.h b/Behavior.h
index c3ca111..a497059 100755
--- a/Behavior.h
+++ b/Behavior.h
@@ -11,7 +11,7 @@
#ifndef BEHAVIOR_H
#define BEHAVIOR_H
#include <iostream>
-#include "glut.h"
+#include <GLUT/glut.h>
using namespace std;
// enumerated status of a behavior
diff --git a/Color.h b/Color.h
index 1c969da..d26c391 100755
--- a/Color.h
+++ b/Color.h
@@ -10,7 +10,7 @@
// preprocessor directives
#ifndef COLOR_H
#define COLOR_H
-#include "glut.h"
+#include <GLUT/glut.h>
using namespace std;
// predefined colors
diff --git a/Makefile b/Makefile
index 568038e..b880dd1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,7 @@
all: main
-main: Simulator.o Environment.o Behavior.o Cell.o Circle.o Formation.o Robot.o Vector.o Neighborhood.o
- g++ -framework OpenGL -framework GLUT -framework Cocoa Simulator.o
- Behavior.o Cell.o Circle.o Environment.o Formation.o Robot.o Vector.o Neighborhood.o -o Simulator
-
-Simulator.o: Simulator.cpp
- g++ -c Simulator.cpp
+main: Environment.o Behavior.o Cell.o Circle.o Formation.o Robot.o Vector.o Neighborhood.o
+ g++ Simulator.cpp -framework OpenGL -framework GLUT -framework Cocoa Behavior.o Cell.o Circle.o Environment.o Formation.o Robot.o Vector.o Neighborhood.o -o Simulator
Behavior.o: Behavior.cpp
g++ -c Behavior.cpp
@@ -32,4 +28,4 @@ Neighborhood.o: Neighborhood.cpp
g++ -c Neighborhood.cpp
clean:
- rm -rf *o Simulator
\ No newline at end of file
+ rm -rf *o Simulator
diff --git a/Neighborhood.cpp b/Neighborhood.cpp
index b6d53b1..1cd3973 100755
--- a/Neighborhood.cpp
+++ b/Neighborhood.cpp
@@ -436,7 +436,8 @@ Neighbor* Neighborhood::anyNbr()
//
Neighbor* Neighborhood::firstNbr()
{
- if (getHead(Neighbor())) return &(*this)[0];
+ Neighbor n;
+ if (getHead(n)) return &(*this)[0];
return NULL;
} // firstNbr(Neighborhood &nh)
@@ -453,7 +454,8 @@ Neighbor* Neighborhood::firstNbr()
//
Neighbor* Neighborhood::secondNbr()
{
- if (getHeadNext(Neighbor())) return &(*this)[1];
+ Neighbor n;
+ if (getHeadNext(n)) return &(*this)[1];
return NULL;
} // secondNbr()
@@ -470,7 +472,8 @@ Neighbor* Neighborhood::secondNbr()
//
Neighbor* Neighborhood::lastNbr()
{
- if (getTail(Neighbor())) return &(*this)[getSize() - 1];
+ Neighbor n;
+ if (getTail(n)) return &(*this)[getSize() - 1];
return NULL;
} // lastNbr()
diff --git a/Queue.h b/Queue.h
index 5875233..e810b21 100755
--- a/Queue.h
+++ b/Queue.h
@@ -107,7 +107,8 @@ Queue<T>::Queue(const LinkedList<T> &list): LinkedList<T>(list)
template <class T>
Queue<T>::~Queue()
{
- LinkedList<T>::~LinkedList();
+ clear();
+ //LinkedList<T>::~LinkedList();
} // ~Queue()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment