home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / ARASAN_S.ZIP / OPTIONS.H < prev    next >
C/C++ Source or Header  |  1994-07-16  |  2KB  |  92 lines

  1. // Copyright 1993 by Jon Dart.  All Rights Reserved.
  2.  
  3. #ifndef _OPTIONS_H
  4. #define _OPTIONS_H
  5.  
  6. #include "search.h"
  7. #include "timectrl.h"
  8. #include "types.h"
  9. #include <string.h>
  10.  
  11. #define Max_Time_Controls 2
  12.  
  13. struct Preferences
  14. {
  15.    Boolean beep_after_move;
  16.    Boolean beep_on_error;
  17.    Boolean can_resign;
  18.    Boolean randomize_moves;
  19.    Boolean use_book;
  20.    Boolean think_when_idle;
  21. };
  22.  
  23. class Options
  24. {
  25. public:    
  26.    Options();
  27.    
  28.    virtual ~Options();
  29.    
  30.    const Time_Control &get_time_control( 
  31.     Control c = First ) const
  32.    {
  33.       return tc[c];       
  34.    }
  35.  
  36.    void set_time_control( const Time_Control &t,
  37.        Control c = First )
  38.    {
  39.       tc[c] = t;
  40.    }
  41.     
  42.    Boolean beep_after_move() const
  43.    {
  44.       return prefs.beep_after_move;       
  45.    }
  46.     
  47.    Boolean beep_on_error() const
  48.    {
  49.       return prefs.beep_on_error;
  50.    }
  51.     
  52.    Boolean can_resign() const
  53.    {
  54.       return prefs.can_resign;
  55.    }
  56.     
  57.    Boolean use_book() const
  58.    {
  59.       return prefs.use_book;
  60.    }
  61.    
  62.    Boolean randomize_moves() const
  63.    {
  64.       return prefs.randomize_moves;       
  65.    }
  66.    
  67.    Boolean think_when_idle() const
  68.    {
  69.       return prefs.think_when_idle;
  70.    }
  71.    
  72.    void update_preferences( const Preferences &p );
  73.    
  74.    void get_preferences( Preferences &p );
  75.    
  76.    void save();
  77.    
  78. private:    
  79.     Time_Control tc[2];
  80.     Preferences prefs;
  81.     void get_src_opts( const Control c,
  82.        Search_Type &my_search_type, Search_Limit &my_search_limit);
  83.     void set_src_opts( const Control c,
  84.        const Search_Type my_search_type,
  85.        const Search_Limit &my_search_limit);
  86.     
  87. };
  88.  
  89. #endif
  90.  
  91.  
  92.