So guys I'm making a computer game in university.. I'm having a trouble to make this working.. I have to make a game similar to Civilization, I've done some classes like this:
board - faction (vector) - cities - habitants
- artifacts (vector)
Basicaly my board includes some factions and artifacts.. My factions include some cities and habitants and then I've habitants outside the cities.. So I've done this..
That's my board:
my factionsCode:class tabuleiro { Consola c; // predefined to acess console functions vector <faccao> f; // factions vector <artefacto> a; // artifacts int posx, posy; int max_ox, max_oy; int fact_num; int dificuldade; string tipo; public: [....]cityCode:class faccao { string nome; int ouro, comida, id, cor; vector <cidade> city; // cities vector <habitante> hab; // habitants public: [...]In the begining of the game we have to create a faction.. That's done, and then assossiate a city to it.Code:class cidade { string nome; int posx, posy, id, cor; public: cidade(string nome2, int x, int y, int id2, int cor2); // constructor cidade(void); ~cidade(void); [...]
**Since I cannot use friend classes nor use public data how should I proceed?Code:cidade cidad(f[i].get_nome(), posx+posx+2, posy+posy+2, i+1, 13); // Construtor f[i].city.push_back(cidad); // The problem is here**
Thanks in advance,
George



LinkBack URL
About LinkBacks


