X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;ds=inline;f=hit_shape.cc;h=1663064fb72b023c4dc46f176d61b797db0055df;hb=18b655f5e908b7a57709b9dec9f00428ed339839;hp=12d45826902c2a46c6e070583d63867e78b9187c;hpb=5c68b9412710739cc0562ab296a9c8af13e9e71c;p=universe.git diff --git a/hit_shape.cc b/hit_shape.cc index 12d4582..1663064 100644 --- a/hit_shape.cc +++ b/hit_shape.cc @@ -1,17 +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 for comments & bug reports // -//////////////////////////////////////////////////////////////////////////////// +// Written and (C) by Francois Fleuret +// Contact for comments & bug reports #include "task.h" #include "universe.h" @@ -19,7 +8,7 @@ class MoveSquare : public Task { - int _square_size; + scalar_t _square_size; int _nb_shapes; Polygon **_shapes; bool *_targets; @@ -28,7 +17,7 @@ class MoveSquare : public Task { public: - virtual char *name() { return "HIT_SQUARE"; } + virtual const char *name() { return "HIT_SQUARE"; } virtual int nb_degrees() { return 1; } @@ -84,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(hit & drand48() < 0.25) { + if(hit && (drand48() < 0.25)) { manipulator->force_release(); scramble(universe); return 1.0;