Exemplo n.º 1
0
/**
*\fn void Save(Player player, Tamagotchi tamagotchi, House maison)
*\brief function which allows to save the game
*\return Null
*/
void Save(Player player, Tamagotchi tamagotchi, House maison)
{
	string b = player.getPlayer();
	fstream fichier(b.c_str(), ios::out | ios::trunc);

	if(fichier)
	{
		Time a;
		fichier << a.getTime() << endl;
		fichier << tamagotchi.getName() << endl;
		fichier << tamagotchi.getHunger() << endl;
		fichier << tamagotchi.getCleanness() << endl;
		fichier << tamagotchi.getAge() << endl;
		fichier << tamagotchi.getHealth() << endl;
		fichier << tamagotchi.getWeight() << endl;
		fichier << tamagotchi.getGeneration() << endl;
		fichier << maison.getDirtiness() << endl;
		fichier.close();	
	}
	else
		cout << "une erreur s'est produite pendant l'ouverture du fichier" << endl;

}