Cairo support works, both to draw in the window and to write as a png image in a...
[universe.git] / hit_shape.cc
index 66cf76d..1663064 100644 (file)
@@ -1,19 +1,6 @@
 
 
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or              //
-// modify it under the terms of the GNU General Public License                //
-// version 2 as published by the Free Software Foundation.                    //
-//                                                                            //
-// This program is distributed in the hope that it will be useful, but        //
-// WITHOUT ANY WARRANTY; without even the implied warranty of                 //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU          //
-// General Public License for more details.                                   //
-//                                                                            //
-// Written and (C) by François Fleuret                                        //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports              //
-////////////////////////////////////////////////////////////////////////////////
-
-// $Id: hit_shape.cc,v 1.5 2006-07-23 21:14:42 fleuret Exp $
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
 
 #include "task.h"
 #include "universe.h"
 
 #include "task.h"
 #include "universe.h"
@@ -21,7 +8,7 @@
 
 class MoveSquare : public Task {
 
 
 class MoveSquare : public Task {
 
-  int _square_size;
+  scalar_t _square_size;
   int _nb_shapes;
   Polygon **_shapes;
   bool *_targets;
   int _nb_shapes;
   Polygon **_shapes;
   bool *_targets;
@@ -30,7 +17,7 @@ class MoveSquare : public Task {
 
 public:
 
 
 public:
 
-  virtual char *name() { return "HIT_SQUARE"; }
+  virtual const char *name() { return "HIT_SQUARE"; }
 
   virtual int nb_degrees() { return 1; }
 
 
   virtual int nb_degrees() { return 1; }
 
@@ -86,7 +73,7 @@ public:
     if(manipulator->grabbing()) {
       for(int k = 0; k < _nb_shapes; k++) if(_shapes[k] == manipulator->grabbing()) {
         bool hit = _targets[k];
     if(manipulator->grabbing()) {
       for(int k = 0; k < _nb_shapes; k++) if(_shapes[k] == manipulator->grabbing()) {
         bool hit = _targets[k];
-        if(hit & drand48() < 0.25) {
+        if(hit && (drand48() < 0.25)) {
           manipulator->force_release();
           scramble(universe);
           return  1.0;
           manipulator->force_release();
           scramble(universe);
           return  1.0;