64,648
社区成员
发帖
与我相关
我的任务
分享
class Chessman {
friend class Gameboard;
public:
Chessman(int i, int j, bool col);
Chessman& operator = (Chessman& c);
void change_icon(const string& image_name); //choose or unchoose one chessman then change icon
virtual bool move_valid(int i, int j, Gameboard& g) { return 0; }; //check if the move target is valid
virtual bool eat_valid(int i, int j, Gameboard& g) { return 0; }; //check if the eat behavior is valid
protected:
Chessman() { };
int init_i; //initial position
int init_j; //initial position
int cur_i; //current position
int cur_j; //current position
Image* icon; //icon
bool turn; //mark the turn of the play
bool choosed; //mark if the chessman has been choosed
bool color; //1 for red,0 for black
vector< vector<string> > image_name; //store the names of four images:black&&unchoosed,black&&choosed,red&&unchoosed,red&&choosed
};
board_chess[last_p][last_q] = new Chessman(changed_orig->cur_i,changed_orig->cur_j,changed_orig->color);
*board_chess[last_p][last_q] = *changed_orig;