1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#ifndef _global_h
# include "global.h"
#endif
#ifndef _pocket_h
# include "pocket.h"
#endif
#ifndef _game_h
# include "game.h" // zum Ansprechen des Keepers
#endif
Pocket::Pocket(double x, double y, double r)
: StaticArc( x,y,r,0.0,360.0 ) {
type = PocketObj;
dyn_id = -2; // Kennzeichnung der Pockets fuer PreCalc des Pointers
}
Pocket::~Pocket() {}
void Pocket::Info() {
printf( "%02d: Pocket: %08lx: P()=(%4.1f,%4.1f), R()=%3.1f\n",
id, (unsigned long)this,
(double)PX(), (double)PY(), (double)R() );
}
Real Pocket::HitFromBall( Ball *b ) {
Real time;
if (b->IsIdle()) return MAX_TIME;
switch( HitFromBallTwice( 1, b, b->V(), R(), &time ) ) {
case 1: return NO_HIT;
#if (ABORT_CALC_BALL)
case 2:
#ifdef DEBUG
if (debug&AbortCalc) {
printf( " PocketHit from %d to %d aborted.\n", b->Object::id, id );
}
#endif
return NOT_REACHABLE;
#endif
default:
if (time>-EPS) return time;
else return NO_HIT;
}
}
void Pocket::CollideWithBall( Ball *b ) {
g->TakeOffBoard(b);
}
|