Subversion Repositories QTron

Compare Revisions

Regard whitespace Rev 6 → Rev 8

/bike.h
19,6 → 19,7
Bike(QTcpSocket *sock, int i);
void draw(QPainter *painter);
void run(QList<Bike *> bikes);
bool hasCollided();
void reset();
bool isReady;
bool dead;
33,6 → 34,7
bool isDisconnected;
bool hasHadGo;
QColor colour;
bool collided;
 
private:
QTcpSocket *socket;
/bike.cpp
21,6 → 21,7
isReady = false;
hadGo = false;
dead = false;
collided = false;
 
colour.setBlue(0);
colour.setRed(0);
60,6 → 61,10
painter->drawLine(point1, point2);
}
 
if (!collided)
{
collided = hasCollided();
 
if (angle == 0)
{
y -= velocity;
76,6 → 81,11
{
x -= velocity;
}
}
else
{
linePoints.clear();
}
 
if (angle == 0 || angle == 180)
{
152,6 → 162,14
hasHadGo = true;
}
 
bool Bike::hasCollided()
{
// Do collision detection here
// use linePoints
 
return false;
}
 
void Bike::reset()
{
x = rand() % 800;
166,6 → 184,7
isReady = true;
hadGo = false;
dead = false;
collided = false;
 
socket->write("RESET\n");
}
232,11 → 251,11
{
colour.setRed(list[1].toInt());
}
else if (list.count() >= 3)
if (list.count() >= 3)
{
colour.setGreen(list[2].toInt());
}
else if (list.count() >= 4)
if (list.count() >= 4)
{
colour.setBlue(list[3].toInt());
}