Re: Help With Copy Constructor.
I am experimenting with different ways to do what I want. It is
tricky. I want the graphics data to be held in the objects on a grid
of space objects. That works. But what I want to do is to have
objects stored in those objects with graphic data and I want that that
data to be displayed on the screen. I got the program to run like I
would like but it the program is not written to be expanded. I want to
have variouse kinds of objects that contain graphics data later and I
don't want to keep updating my board object with new data. That is how
I made it work, I put the graphics data for my player on the map with
all the graphics for the map.
class board{
player * play;
static const int size = 30;
map<char, coord> keys;
space spaces[size][size];
coord n;
coord s;
coord e;
coord w;
ifstream& cfill(ifstream&, char&); /*Reads map from file */
void fill();
coord find();
void seeing(int, int);
public:
board();
void setPlayer(player*, int, int);
graphic& display(int, int);
int sze(){return size;}
void move(char);
};
There might or might not be a player in the map so I use a pointer. I
wand the graphics data from that player to be returned to the main
program for display.
graphic& space::graphicOut(){
if(play){
BYTE * cr = &play->GetData();
cgr = new graphic(cr);
//&play->GetData());
return *cgr; //I want to get the player's graphic data either the
bitmap array or
the graphic object and return it for display.
}
if(seen){return *gr;} //returns the graphic on the map (space or
wall)
else {return *grDefault;} //returns unseen space (blank)
}
This is the trick of what I am trying to do.