Skip to content

Commit

Permalink
Fix issue #3 ; add methods declarations into robot.h
Browse files Browse the repository at this point in the history
  • Loading branch information
SmirnoffYM committed May 12, 2012
1 parent 2da4231 commit ff24c17
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 5 deletions.
24 changes: 24 additions & 0 deletions constants.h
@@ -0,0 +1,24 @@
#ifndef CONSTANTS_H
#define CONSTANTS_H

/*
Define all specific constants, like
number of robots, number of environment objects, etc.:
*/

#define PERFORM_ACTION_FREQUENCY 30 //how many times robot performs his actions per second
#define REAL_PIXEL_SIZE 60 //number of cells in real pixel
#define ENV_OBJECTS 255 //number of environment objects
#define CUSTOM_PARAMETERS_QUANTITY 16 //number of custom robot params

enum Intersection { Allowed, Denied, AllowedForSameColor };

/* Define some non-crossplatform math constants: */

#define PI 3.14159265358979323846

#endif // CONSTANTS_H

/* Limit line length to 100 characters; highlight 99th column
* vim: set textwidth=100 colorcolumn=-1:
*/
2 changes: 1 addition & 1 deletion example/environment/Environment.pro
Expand Up @@ -21,7 +21,7 @@ SOURCES += main.cpp \
HEADERS += \
manager.h \
envobject.h \
constants.h \
../../constants.h \
../../NetworkingManager.h \
../../messages.h \
../../messages-serializers.h
2 changes: 1 addition & 1 deletion example/robot/Robot.pro
Expand Up @@ -20,7 +20,7 @@ SOURCES += main.cpp \

HEADERS += \
robot.h \
constants.h \
../../constants.h \
manager.h \
../../NetworkingManager.h \
../../messages.h \
Expand Down
2 changes: 1 addition & 1 deletion example/robot/manager.h
Expand Up @@ -2,7 +2,7 @@
#define MANAGER_H

#include <QObject>
#include "constants.h"
#include "../../constants.h"
#include "robot.h"

class Manager : public QObject
Expand Down
2 changes: 1 addition & 1 deletion example/robot/robot.cpp
Expand Up @@ -64,7 +64,7 @@ void Robot::whoIsThere(unsigned int x, unsigned int y, unsigned int radius)
m.coordX = x;
m.coordY = y;
m.radius = radius;
network->move(&m);
network->send(&m);

// TODO: update robot's internal state

Expand Down
7 changes: 6 additions & 1 deletion example/robot/robot.h
Expand Up @@ -5,7 +5,7 @@
#include <QUdpSocket>
#include <QVariant>
#include "../../NetworkingManager.h"
#include "constants.h"
#include "../../constants.h"

class Robot
{
Expand All @@ -24,6 +24,11 @@ class Robot

public:
void move(int x, int y);
void turn(double degrees);
void changeDiameter(unsigned int diameter);
void changeColor(char red, char green, char blue);
void whoIsThere(unsigned int x, unsigned int y, unsigned int radius);
void reportParameter(char id, int integral, unsigned int real);

public:
// getters
Expand Down

0 comments on commit ff24c17

Please sign in to comment.