X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=hit_shape.cc;h=344e45ce4e1b5079db1dd0d838c27fa9447f3782;hb=3ea65d15a33cd73c71c0f9af0cc5d882ebd12265;hp=66cf76dc7e1583b8ebb3b1ec3064408e3fd88b1d;hpb=ba46b057f3e2613a86f2dea7fa8022990482c735;p=universe.git diff --git a/hit_shape.cc b/hit_shape.cc index 66cf76d..344e45c 100644 --- a/hit_shape.cc +++ b/hit_shape.cc @@ -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 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 for comments & bug reports #include "task.h" #include "universe.h" @@ -21,7 +8,7 @@ class MoveSquare : public Task { - int _square_size; + scalar_t _square_size; int _nb_shapes; Polygon **_shapes; bool *_targets; @@ -30,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; } @@ -60,7 +47,7 @@ public: margin + (world_height - 2 * margin) * drand48(), 2 * M_PI * drand48()); p->set_speed(0, 0, 0); - universe->initialize(p); + universe->initialize_polygon(p); p->_nailed = true; if(universe->collide(p)) delete p; else { @@ -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(hit & drand48() < 0.25) { + if(hit && (drand48() < 0.25)) { manipulator->force_release(); scramble(universe); return 1.0;