Well that explains it, right now im just going to compile in release mode. hehe
However, how come I cant include the DarkGDK header file into any of my classes in my project? For example this gives out an error:
#ifndef CARDRIVER4GDK
#define CARDRIVER4GDK
#include <cstdlib>
#include <time.h>
#include "CarforGDK.h"
#include "DarkGDK.h"
using namespace std;
Car::Car(void)
{
this->location = Coord(100, 200);
this->doingDelivery = false;
}
void Car::setName(string &newname)
{
this->name = newname;
}
void Car::setDelivery(Delivery &cust)
{
this->doingDelivery = true;
this->delivery = cust;
}
void Car::setLocation(Coord &loc)
{
this->location = loc;
}
void Car::setDestination(Coord &dest)
{
this->destination = dest;
}
void Car::move()
{
Coord tempLoc = getLocation();
Coord tempDest = getDestination();
int loc_x = tempLoc.getX();
int loc_y = tempLoc.getY();
int dest_x = tempDest.getX();
int dest_y = tempDest.getY();
int rand_num;
srand(time(NULL));
if(loc_x == dest_x) // if x-coordinate is parallel to destination just move y-coordinate
{
if(loc_y < dest_y)
{
loc_y++;
tempLoc = Coord(loc_x, loc_y);
this->location = tempLoc;
}
else
{
loc_y--;
tempLoc = Coord(loc_x, loc_y);
this->location = tempLoc;
}
}
else if(loc_y == dest_y) // if y-coordinate is parallel to destination just move x-coordinate
{
if(loc_x < dest_x)
{
loc_x++;
tempLoc = Coord(loc_x, loc_y);
this->location = tempLoc;
}
else
{
loc_x--;
tempLoc = Coord(loc_x, loc_y);
this->location = tempLoc;
}
}
else //if neither is parallel, both coordinates can be moved, pick one randomly!
{
rand_num = rand() % 10 ;
if(rand_num < 5)
{
if(loc_y < dest_y)
{
loc_y++;
tempLoc = Coord(loc_x, loc_y);
this->location = tempLoc;
}
else
{
loc_y--;
tempLoc = Coord(loc_x, loc_y);
this->location = tempLoc;
}
}
else
{
if(loc_x < dest_x)
{
loc_x++;
tempLoc = Coord(loc_x, loc_y);
this->location = tempLoc;
}
else
{
loc_x--;
tempLoc = Coord(loc_x, loc_y);
this->location = tempLoc;
}
}
}
}
void Car::checkStatus()
{
Coord tempLoc = this->location;
Coord tempDest = this->destination;
int loc_x = tempLoc.getX();
int loc_y = tempLoc.getY();
int dest_x = tempDest.getX();
int dest_y = tempDest.getY();
if((loc_x == dest_x) && (loc_y == dest_y) && !(isAtHome()))
{
//cout << "Delivery: ";
//cout << this->delivery.getName();
//cout << "-- successful!" << endl;
this->delivery = Delivery();
this->destination = Coord(100, 200);
this->doingDelivery = false;
}
}
string Car::getName()
{
return this->name;
}
Delivery Car::getDelivery()
{
return this->delivery;
}
Coord Car::getLocation()
{
return this->location;
}
Coord Car::getDestination()
{
return this->destination;
}
bool Car::hasDelivery()
{
return this->doingDelivery;
}
bool Car::isAtHome()
{
Coord tempLoc = getLocation();
int loc_x = tempLoc.getX();
int loc_y = tempLoc.getY();
return ((loc_x == 100) && (loc_y == 200));
}
#endif
note that I havent added any methods calling on DarkGDK yet and it wont error if i comment out #include "DarkGDK.h"