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 / Field.C < prev    next >
Text File  |  1992-02-27  |  973b  |  37 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2.  
  3. //   Module      : Field.C   Version 1.2
  4. //   LastSCCS    : 2/26/92  16:37:54
  5. //   LastEdit    : "Fri Nov  8 13:40:45 1991"
  6. //   Description : 
  7. //   Author      : 
  8. //   Copyright   : GMD Schloss Birlinghoven
  9.  
  10. Field::
  11. Field(Player *p_player, Card *p_card, int p_shape, int p_color, int p_value)
  12. : PlayerLocation(p_player, p_shape, p_color, p_value)
  13. {
  14.     REQUIRE(p_shape >= 0 && p_shape <= 2, "Shape is 0, 1, or 2");
  15.     REQUIRE(p_color >= 0 && p_color <= 3, "Color is 0, 1, 2, or 3");
  16.     REQUIRE(p_value >= 0 && p_value <= 2, "Value is 0, 1, or 2");
  17.  
  18.     card         = p_card;
  19.     field_status = eNeutral;
  20. }
  21.  
  22. FieldStatus Field::
  23. SetState(FieldStatus p_field_status)
  24. {
  25.     FieldStatus old_state = field_status;
  26.     field_status = p_field_status;
  27.     return old_state;
  28. }
  29.  
  30. void Field::
  31. Change(FieldStatus status)
  32. {
  33.     player->ChangeCard(this, status);
  34. }
  35.  
  36. ImplGenericListWithIterator(FieldList,FieldListIterator);
  37.