/*
    UltraSet (C) 2003 Jason Hunt
    huntjas2@msu.edu
*/


#include <vector.h>

#ifndef set_codeH
#define set_codeH


#define byte unsigned char

#define image Graphics::TBitmap

#define max_cards  21      // max number of positions on the board

#define x_pad   10      // horizontal space between cards
#define y_pad   10      // verdicle space between cards

#define empty   1
#define stripe  2
#define solid   3

#define red     1
#define green   2
#define purple  3

#define diamond 1
#define oval    2
#define squig   3



/* definition of a card position */
class card_class
{
  friend class board_class;

  public:

    card_class(void);
//    card_class(card_class nData);
    card_class(byte nNumber, byte fill, byte color, byte shape);
    void draw(byte position);

  private:

    byte number;
    byte fill;
    byte color;
    byte shape;

    bool selected;
    bool hint;

    image *base_image;          // pointer to the base card image
};
/* end of board_position_class */


class board_class
{
  friend class card_class;

  public:

    board_class();
    ~board_class();

    // basic class functions
    void reset(void);
    void make_deck(void);
    void draw(void);
    void erase_position( unsigned int pos_index );

    byte add_card(void);
    void remove_card( byte pos );    
    void add_three_cards( void );

    // game functions
    void card_click(int x, int y);
    void check_selected_cards( void );
    void set_on_board( void );

    void rearrange_board( void );

    byte locate_set( void );
    inline byte cards_are_set(card_class *cards[3]);

    byte get_cheat(void) {return cheat; };
    void set_cheat(byte newcheat) { cheat = newcheat; };

  private:

    card_class *positions[max_cards];
    vector <card_class> deck;

    image *images[27],          // card base images
          *card_base,           // unselected card backing
          *card_base_sel,       // selected card backing
          *card_base_che;       // cheat card backing

    byte x_size;                // the number of rows in the board

    byte card_x_size;           // set at startup based on card_base
    byte card_y_size;

    byte num_selected;
    byte cheat;

    byte num_cards;
};

#endif




