home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / g / gina15.zip / demos / sleuth / PlayerLocation < prev    next >
Text File  |  1992-02-27  |  2KB  |  59 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2.  
  3. //   Module      : PlayerLocation.h   Version 1.2
  4. //   LastSCCS    : 2/26/92  16:38:56
  5. //   LastEdit    : "Mon Jan 27 13:17:57 1992"
  6. //   Description : 
  7. //   Author      : 
  8. //   Copyright   : GMD Schloss Birlinghoven
  9.  
  10. #ifndef Playerlocation_h
  11. #define Playerlocation_h
  12.  
  13. const int UndefShape = 3;
  14. const int UndefColor = 4;
  15. const int UndefValue = 3;
  16.  
  17. inline int IsUndefShape(int shape) { return shape == UndefShape; }
  18. inline int IsUndefColor(int color) { return color == UndefColor; }
  19. inline int IsUndefValue(int value) { return value == UndefValue; }
  20.  
  21. inline int IsShape(int shape) { return shape >= 0 && shape <= UndefShape; }
  22. inline int IsColor(int color) { return color >= 0 && color <= UndefColor; }
  23. inline int IsValue(int value) { return value >= 0 && value <= UndefValue; }
  24.  
  25. inline int IsTrueShape(int shape) { return shape >= 0 && shape < UndefShape; }
  26. inline int IsTrueColor(int color) { return color >= 0 && color < UndefColor; }
  27. inline int IsTrueValue(int value) { return value >= 0 && value < UndefValue; }
  28.  
  29. inline int AllUndef(int shape, int color, int value)
  30. { return IsUndefShape(shape) && IsUndefColor(color) && IsUndefValue(value); }
  31.  
  32. inline int AllDef(int shape, int color, int value)
  33. { return IsTrueShape(shape) && IsTrueColor(color) && IsTrueValue(value); }
  34.  
  35. class Player;
  36.  
  37. class PlayerLocation : public GnPresentable {
  38.   protected:
  39.     PlayerLocation(Player *p_player, int p_shape, int p_color, int p_value);
  40.   public:
  41.     int GetColor()
  42.     { return color; }
  43.     int GetShape()
  44.     { return shape; }
  45.     int GetValue()
  46.     { return value; }
  47.     Player *GetPlayer()
  48.     { return player; }
  49.   public:
  50.      virtual char *PrintOn(char *buffer, unsigned int length);
  51.   protected:
  52.     int          color;
  53.     int          shape;
  54.     int          value;
  55.     Player      *player;
  56. };
  57.  
  58. #endif
  59.