Subversion Repositories public iLand

Rev

Rev 1165 | Rev 1175 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1165 Rev 1174
Line 3... Line 3...
3
#define SAPLINGS_H
3
#define SAPLINGS_H
4
4
5
#include "grid.h"
5
#include "grid.h"
6
#include "snag.h"
6
#include "snag.h"
7
#include <QRectF>
7
#include <QRectF>
8
-
 
-
 
8
class ResourceUnitSpecies; // forward
-
 
9
class ResourceUnit; // forward
9
10
10
struct SaplingTree {
11
struct SaplingTree {
11
    SaplingTree() { clear(); }
12
    SaplingTree() { clear(); }
12
    short unsigned int age;  // number of consectuive years the sapling suffers from dire conditions
13
    short unsigned int age;  // number of consectuive years the sapling suffers from dire conditions
13
    short signed int species_index; // index of the species within the resource-unit-species container
14
    short signed int species_index; // index of the species within the resource-unit-species container
Line 18... Line 19...
18
    void clear()  {  age=0; species_index=-1; stress_years=0; flags=0; height=0.f;  }
19
    void clear()  {  age=0; species_index=-1; stress_years=0; flags=0; height=0.f;  }
19
    void setSapling(const float h_m, const int age_yrs, const int species_idx) { height=h_m; age=static_cast<short unsigned int>(age_yrs); stress_years=0; species_index=static_cast<short signed int>(species_idx); }
20
    void setSapling(const float h_m, const int age_yrs, const int species_idx) { height=h_m; age=static_cast<short unsigned int>(age_yrs); stress_years=0; species_index=static_cast<short signed int>(species_idx); }
20
    // flags
21
    // flags
21
    bool is_sprout() const { return flags & 1; }
22
    bool is_sprout() const { return flags & 1; }
22
    void set_sprout(const bool sprout) {if (sprout) flags |= 1; else flags &= (1 ^ 0xffffff ); }
23
    void set_sprout(const bool sprout) {if (sprout) flags |= 1; else flags &= (1 ^ 0xffffff ); }
-
 
24
    // get resource unit species of the sapling tree
-
 
25
    ResourceUnitSpecies *resourceUnitSpecies(const ResourceUnit *ru);
23
};
26
};
24
#define NSAPCELLS 5
27
#define NSAPCELLS 5
25
struct SaplingCell {
28
struct SaplingCell {
26
    enum ECellState { CellInvalid=0, CellFree=1, CellFull=2};
29
    enum ECellState { CellInvalid=0, CellFree=1, CellFull=2};
27
    SaplingCell() {
30
    SaplingCell() {