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 / Player.h < prev    next >
C/C++ Source or Header  |  1992-02-27  |  2KB  |  75 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2.  
  3. //   Module      : Player.h   Version 1.2
  4. //   LastSCCS    : 2/26/92  16:38:44
  5. //   LastEdit    : "Tue Feb 25 10:32:48 1992"
  6. //   Description : 
  7. //   Author      : 
  8. //   Copyright   : GMD Schloss Birlinghoven
  9.  
  10. #ifndef Player_h
  11. #define Player_h
  12.  
  13. class Player : public GnObject {
  14.   protected:
  15.     char     *name;
  16.     int       position;
  17.     Boolean   selected;
  18.     Field    *fields[3][4][3];
  19.     CardList  owned_cards;
  20.     AxiomList axioms;
  21.   protected:
  22.     PlayerView                        *player_view;
  23.     GnScrollableMultipleSelectionList *axiom_list;
  24.     SleuthDocument                    *document;
  25.   public:
  26.     Player(SleuthDocument *doc, int pos);
  27.   public:
  28.     // Accessors and Modifiers
  29.     void SetView(PlayerView *view)
  30.     { player_view = view; }
  31.     PlayerView *GetView()
  32.     { return player_view; }
  33.     void SetAxiomList(GnScrollableMultipleSelectionList *p_axiom_list)
  34.     { axiom_list = p_axiom_list; }
  35.     GnScrollableMultipleSelectionList *GetAxiomList()
  36.     { return axiom_list; }
  37.     char *GetName()
  38.     { return document->PlayerName(position); }
  39.     int GetPosition()
  40.     { return position; }
  41.     SleuthDocument *GetDocument()
  42.     { return document; }
  43.     int NumberOfOwnedCards()
  44.     { return owned_cards.Length(); }
  45.     Boolean IsSelected()
  46.     { return selected; }
  47.     void SetSelected(Boolean state);
  48.   public:
  49.     Field *GetField(int shape, int color, int value)
  50.     { return fields[shape][color][value]; }
  51.     Field *GetField(Field *field)
  52.     { return fields[field->shape][field->color][field->value]; }
  53.     FieldStatus GetCard(int shape, int color, int value);
  54.     Boolean IsNeutral(int shape, int color, int value)
  55.     { return GetCard(shape, color, value) == eNeutral; }
  56.     Boolean IsNeutral(Field *field)
  57.     { return field->GetState() == eNeutral; }
  58.     Boolean IsOwned(int shape, int color, int value)
  59.     { return GetCard(shape, color, value) == eOwned; }
  60.     Boolean IsNotOwned(int shape, int color, int value)
  61.     { return GetCard(shape, color, value) == eNotOwned; }
  62.     void ChangeCard(Field *field, FieldStatus cv);
  63.     void Add(Axiom *p_axiom);
  64.     void Remove(Axiom *p_axiom);
  65.     void PrintAxioms(ostream &p_stream);
  66.   public:
  67.     Boolean write_to_stream(ostream &stream);
  68.     Boolean read_from_stream(istream &stream);
  69.     Axiom *FindAxiom(int p_shape, int p_color, int p_value, int p_how_many);
  70.   private:
  71.     FieldStatus SetCard(int shape, int color, int value, FieldStatus cv);
  72. };
  73.  
  74. #endif
  75.