13 #include "cellulevide.h" 17 #include "loadprogress.h" 31 std::time_t randomSeed;
34 std::vector< Essence > essences;
35 std::vector<std::vector< Cellule* > > matrix;
37 std::list< Arbre* > onFire;
38 std::list< Arbre* > uprooted;
39 std::list< Arbre* > delayed;
40 std::list< Arbre* > delayBurned;
41 std::list< Arbre* > burned;
42 std::list< Arbre* > carbonized;
58 Foret(
int _largeur,
int _hauteur,
float proba = 0.60,
float _coefFeu = 0.5, std::time_t graine=std::time(0));
80 Foret(
int _largeur,
int _hauteur, std::vector< std::vector< int > >* matrice,
float coef_brulure);
101 std::vector< std::string >& explode(
const std::string& str);
111 unsigned essenceRandom(
int col,
int row,
unsigned int distOthers);
121 void setValues(
int largeur,
int hauteur,
float coef);
128 void setWind(
int angle,
int vitesse);
131 int width()
const {
return colonnes; }
132 int height()
const {
return lignes; }
133 int nbEssences(){
return essences.size() ; }
134 const Vent* getVent()
const {
return wind; }
135 std::vector< Cellule* >* operator[](
int ligne) {
return &(matrix[ligne]); }
154 void create(
int largeur,
int hauteur, std::vector< std::vector< int > >* matrice);
168 const std::list< Arbre* >* getOnFire()
const {
return &onFire; }
169 std::list< Arbre* >* getUprooted() {
return &uprooted; }
170 std::list< Arbre* >* getDelayed() {
return &delayed; }
171 std::list< Arbre* >* getDelayBurned() {
return &delayBurned; }
172 std::list< Arbre* >* getCarbonized() {
return &carbonized; }
173 std::list< Arbre* >* getBurned() {
return &burned; }
180 std::list< std::list< Arbre* > >*
getChanged();
183 void clearUprooted() { uprooted.clear(); }
184 void clearDelayed() { delayed.clear(); }
185 void clearDelayBurned() { delayBurned.clear(); }
186 void clearCarbonized() { carbonized.clear(); }
187 void clearBurned() { burned.clear(); }
209 void plantTree(
int col,
int row,
unsigned int numEss,
int PdV,
float humidite,
float coef,
int etat);
222 void uproot(
int col,
int row);
242 void kindle(
int col,
int row);
267 void spark(
int col,
int row,
int intensite);
275 void cut(
int xDep,
int yDep,
int xArr,
int yArr);
280 void delay(
int xDep,
int yDep,
int xArr,
int yArr);
289 std::list< Arbre* >
adjacents(
int col,
int row,
int distance)
const;
297 std::list< Arbre* >
adjacents(
const Arbre * ab,
int distance)
const;
406 bool trySave(std::string filePath =
"save_forest");
414 bool trySaveSeed(std::string filePath =
"save_forest");
void cut(int xDep, int yDep, int xArr, int yArr)
Definition: foret.cpp:515
void delay(Arbre *ab, float coef=0.5)
Definition: foret.cpp:445
bool NextMove()
Definition: foret.cpp:698
void saveProperties(std::ofstream *file)
Definition: foret.cpp:843
void uproot(Arbre *ab)
Definition: foret.cpp:428
void clean()
Definition: foret.cpp:395
void plantTree(int col, int row)
Definition: foret.cpp:265
void initEmpty()
Definition: foret.cpp:77
void loadBurningCoef(std::ifstream *file)
Definition: foret.cpp:734
void loadSizes(std::ifstream *file)
Definition: foret.cpp:725
Foret(int _largeur, int _hauteur, float proba=0.60, float _coefFeu=0.5, std::time_t graine=std::time(0))
bool trySave(std::string filePath="save_forest")
Definition: foret.cpp:942
Definition: loadprogress.h:8
void transitionWind(Arbre *a, const Vent *vent)
Definition: foret.cpp:687
void transition(Arbre *ab)
Definition: foret.cpp:672
bool tryLoadEssences(const std::string &fileName)
Definition: foret.cpp:178
bool trySaveSeed(std::string filePath="save_forest")
Definition: foret.cpp:963
void kindle(Arbre *ab)
Definition: foret.cpp:452
void sparkAdjacentsWind(int posCol, int posRow, int hor, int vert)
Definition: foret.cpp:611
void saveMatrix(std::ofstream *file)
Definition: foret.cpp:891
void loadMatrix(std::ifstream *file, LoadProgress *progress)
Definition: foret.cpp:779
void spark(Arbre *ab, int intensite)
Definition: foret.cpp:480
void saveEssences(std::ofstream *file)
Definition: foret.cpp:851
void randomMatrix(float probabilite)
Definition: foret.cpp:339
void loadEssences(std::ifstream *file)
Definition: foret.cpp:742
bool tryLoad(std::ifstream *file, LoadProgress *progress)
Definition: foret.cpp:825
virtual ~Foret()
Definition: foret.cpp:54
std::list< std::list< Arbre * > > * getChanged()
Definition: foret.cpp:253
std::list< Arbre * > adjacents(int col, int row, int distance) const
Definition: foret.cpp:543
void blast(Arbre *ab)
Definition: foret.cpp:472
void create(int largeur, int hauteur, std::vector< std::vector< int > > *matrice)
Definition: foret.cpp:319
void showEssences() const
Definition: foret.cpp:990
void setWind(int angle, int vitesse)
Definition: foret.cpp:135
void setValues(int largeur, int hauteur, float coef)
Definition: foret.cpp:128
void clearChanged()
Definition: foret.cpp:412