home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Games / flying-6.11 / pocket.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-30  |  1023 b   |  54 lines

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