18
17
// Hajodoc: Preferred height of this tree type
19
18
// Hajoval: int (useful range: 0-14)
19
climate_bits allowed_climates;
21
20
const char *climate_str = obj.get("climates");
23
besch.allowed_climates = get_climate_bits(climate_str);
22
allowed_climates = get_climate_bits(climate_str);
25
24
printf("WARNING: old syntax without climates!\n");
26
besch.allowed_climates = all_but_arctic_climate;
25
allowed_climates = all_but_arctic_climate;
28
27
// seasons = 1: no seasons
29
28
// seasons = 2: 0=summer, 1=winter
30
29
// seasons = 4, normal four seasons, starting with summer
31
30
// seasons = 5, normal for seasons and snowy image
32
besch.number_of_seasons = obj.get_int("seasons", 1);
33
besch.distribution_weight = obj.get_int("distributionweight", 3);
31
uint8 const number_of_seasons = obj.get_int("seasons", 1);
32
uint8 const distribution_weight = obj.get_int("distributionweight", 3);
35
34
slist_tpl<slist_tpl<string> > keys;
36
35
for (unsigned int age = 0; age < 5; age++) {
37
36
keys.append(slist_tpl<string>());
39
for (int seasons = 0; seasons < besch.number_of_seasons; seasons++) {
38
for (int seasons = 0; seasons < number_of_seasons; seasons++) {
42
41
// Images of the tree
44
43
sprintf(buf, "image[%d][%d]", age, seasons);
46
45
string str = obj.get(buf);
47
if (str.size() == 0) {
48
47
// else missing image
49
48
printf("*** FATAL ***:\nMissing %s!\n", buf); fflush(NULL);
55
54
imagelist2d_writer_t::instance()->write_obj(fp, node, keys);
57
56
// Hajo: write version data
58
node.write_uint16(fp, 0x8002, 0);
60
node.write_uint16(fp, (uint16) besch.allowed_climates, 2);
61
node.write_uint8 (fp, (uint8) besch.distribution_weight, 4);
62
node.write_uint8 (fp, (uint8) besch.number_of_seasons, 5);
57
node.write_uint16(fp, 0x8002, 0);
58
node.write_uint16(fp, allowed_climates, 2);
59
node.write_uint8( fp, distribution_weight, 4);
60
node.write_uint8( fp, number_of_seasons, 5);