Subversion Repositories QTron

Compare Revisions

Ignore whitespace Rev 14 → Rev 16

/bike.cpp
189,11 → 189,14
{
if(!(bike->linePoints[j].x() == bike->linePoints[j+1].x() && linePoints[i].x() == linePoints[i-1].x()) && !(bike->linePoints[j].y() == bike->linePoints[j+1].y() && linePoints[i].y() == linePoints[i-1].y()))
{
 
// If not parallel
if(bike->linePoints[j].x() == bike->linePoints[j+1].x())
{
// x equal
if(linePoints[i-1].x() > bike->linePoints[j].x() && linePoints[i].x() < bike->linePoints[j].x() || linePoints[i-1].x() < bike->linePoints[j].x() && linePoints[i].x() > bike->linePoints[j].x()){
 
if(linePoints[i-1].x() > bike->linePoints[j].x() && linePoints[i].x() < bike->linePoints[j].x() || linePoints[i-1].x() < bike->linePoints[j].x() && linePoints[i].x() > bike->linePoints[j].x())
{
if((sign(linePoints[i-1].y() - bike->linePoints[j].y()) != sign(linePoints[i-1].y() - bike->linePoints[j+1].y())))
return true;
}
200,6 → 203,7
}
else if(bike->linePoints[j].y() == bike->linePoints[j+1].y())
{
 
if(linePoints[i-1].y() > bike->linePoints[j].y() && linePoints[i].y() < bike->linePoints[j].y() || linePoints[i-1].y() < bike->linePoints[j].y() && linePoints[i].y() > bike->linePoints[j].y())
{
if((sign(linePoints[i-1].x() - bike->linePoints[j].x()) != sign(linePoints[i-1].x() - bike->linePoints[j+1].x())))
/bike.h
17,9 → 17,9
 
public:
Bike(QTcpSocket *sock, int i);
void draw(QPainter *painter);
void draw(QPainter *painter,QList<Bike *> bikes);
void run(QList<Bike *> bikes);
bool hasCollided();
bool hasCollided(QList<Bike *> bikes);
void reset();
bool isReady;
bool dead;