diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index 21e7edb6875ce..d227534322215 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -57,6 +57,7 @@ byte _trees_tick_ctr; static const uint16 DEFAULT_TREE_STEPS = 1000; ///< Default number of attempts for placing trees. static const uint16 DEFAULT_RAINFOREST_TREE_STEPS = 15000; ///< Default number of attempts for placing extra trees at rainforest in tropic. static const uint16 EDITOR_TREE_DIV = 5; ///< Game editor tree generation divisor factor. +static const uint8 RANDOM_GROWTH[] = {15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 34, 6, 10, 14, 46, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 36, 4, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 47, 15, 15, 15, 47, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 20, 20, 28, 15, 47, 47, 15, 19, 23, 27, 14, 46, 14, 46, 14, 14, 14, 14, 14, 46, 14, 14, 46, 14, 14, 14, 18, 22, 26, 13, 13, 45, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 47, 47, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 44, 12, 44, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 47, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 17, 21, 25, 12, 15, 47, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 14, 14, 18, 22, 26, 13, 13, 13, 45, 13, 13, 45, 13, 13, 13, 13, 34, 6, 10, 14, 18, 22, 26, 13, 45, 17, 21, 25, 12, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 36, 4, 12, 12, 44, 44, 12, 20, 20, 28, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 44, 12, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 46, 35, 7, 11, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 47, 15, 15, 15, 47, 19, 23, 27, 14, 14, 14, 46, 35, 7, 11, 15, 47, 36, 4, 12, 12, 12, 44, 12, 20, 20, 28, 15, 19, 23, 27, 14, 46, 14, 46, 35, 7, 11, 15, 47, 36, 4, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 13, 13, 13, 13, 13, 13, 13, 45, 17, 21, 25, 12, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 47, 15, 15, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 34, 6, 10, 14, 14, 18, 22, 26, 13, 13, 13, 17, 21, 25, 12, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 47, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 34, 6, 10, 14, 14, 35, 7, 11, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 47, 19, 23, 27, 14, 14, 18, 22, 26, 13, 34, 6, 10, 14, 14, 46, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 47, 47, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 47, 47, 15, 15, 15, 15, 47, 19, 23, 27, 14, 14, 14, 35, 7, 11, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 44, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 36, 4, 12, 12, 12, 44, 12, 44, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 35, 7, 11, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 44, 20, 20, 28, 15, 47, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 44, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 44, 12, 44, 44, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 15, 47, 15, 47, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 47, 47, 15, 15, 47, 47, 15, 15, 47, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 46, 14, 14, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 47, 19, 23, 27, 14, 14, 14, 46, 46, 14, 46, 14, 35, 7, 11, 15, 36, 4, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 20, 20, 28, 15, 15, 15, 19, 23, 27, 14, 14, 46, 35, 7, 11, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 47, 47, 36, 4, 12, 12, 12, 44, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 46, 14, 35, 7, 11, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 47, 47, 19, 23, 27, 14, 14, 14, 14, 18, 22, 26, 13, 45, 13, 13, 13, 13, 13, 45, 13, 13, 13, 13, 13, 45, 13, 13, 17, 21, 25, 12, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 46, 14, 14, 14, 14, 14, 46, 14, 14, 14, 14, 14, 18, 22, 26, 13, 13, 13, 45, 13, 13, 17, 21, 25, 12, 15, 47, 15, 15, 19, 23, 27, 14, 46, 14, 14, 14, 46, 35, 7, 11, 15, 15, 15, 15, 15, 47, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 13, 34, 6, 10, 14, 35, 7, 11, 15, 47, 19, 23, 27, 14, 14, 14, 35, 7, 11, 15, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 15, 47, 15, 36, 4, 12, 12, 12, 12, 44, 44, 12, 12, 12, 12, 20, 20, 28, 15, 47, 15, 36, 4, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 46, 46, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 13, 13, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 44, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 12, 12, 44, 12, 12, 20, 20, 28, 15, 47, 15, 15, 15, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 44, 12, 12, 20, 20, 28, 15, 15, 15, 15, 47, 19, 23, 27, 14, 46, 14, 14, 14, 14, 46, 18, 22, 26, 13, 13, 13, 13, 13, 13, 13, 13, 45, 13, 13, 45, 13, 13, 34, 6, 10, 14, 14, 14, 14, 35, 7, 11, 15, 15, 19, 23, 27, 14, 14, 14, 46, 14, 14, 14, 46, 14, 14, 14, 14, 18, 22, 26, 13, 13, 13, 13, 13, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 12, 44, 44, 12, 12, 12, 12, 44, 44, 12, 12, 12, 12, 12, 12, 44, 44, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 44, 12, 12, 20, 20, 28, 15, 47, 15, 15, 15, 15, 15, 47, 15, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 13, 13, 13, 17, 21, 25, 12, 15, 47, 15, 47, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 35, 7, 11, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 13, 13, 13, 13, 45, 13, 13, 34, 6, 10, 14, 14, 35, 7, 11, 15, 36, 4, 12, 12, 44, 20, 20, 28, 15, 47, 15, 15, 15, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 47, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 44, 12, 12, 12, 12, 44, 12, 44, 12, 12, 12, 44, 44, 12, 12, 12, 44, 12, 20, 20, 28, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 45, 13, 13, 13, 17, 21, 25, 12, 15, 15, 47, 47, 36, 4, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 14, 14, 18, 22, 26, 13, 13, 45, 34, 6, 10, 14, 14, 14, 14, 46, 14, 14, 14, 18, 22, 26, 13, 13, 13, 13, 13, 17, 21, 25, 12, 15, 15, 15, 36, 4, 12, 12, 12, 44, 12, 12, 12, 12, 12, 44, 12, 20, 20, 28, 15, 15, 15, 36, 4, 12, 12, 12, 12, 44, 44, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 44, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 13, 17, 21, 25, 12, 15, 36, 4, 12, 12, 12, 44, 12, 12, 20, 20, 28, 15, 15, 15, 15, 47, 19, 23, 27, 14, 35, 7, 11, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 44, 12, 12, 12, 12, 12, 44, 12, 12, 12, 44, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 47, 15, 19, 23, 27, 14, 14, 14, 14, 46, 14, 14, 35, 7, 11, 15, 15, 36, 4, 12, 12, 12, 44, 12, 44, 44, 12, 20, 20, 28, 15, 15, 15, 15, 47, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 47, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 46, 18, 22, 26, 13, 13, 13, 45, 17, 21, 25, 12, 15, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 47, 19, 23, 27, 14, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 44, 44, 20, 20, 28, 15, 47, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 45, 13, 13, 13, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 15, 15, 19, 23, 27, 14, 14, 46, 35, 7, 11, 15, 47, 15, 36, 4, 12, 12, 44, 12, 44, 12, 12, 20, 20, 28, 15, 15, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 15, 19, 23, 27, 14, 14, 46, 14, 14, 18, 22, 26, 13, 13, 45, 13, 13, 17, 21, 25, 12, 15, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 44, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 44, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 46, 35, 7, 11, 15, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 15, 15, 15, 47, 15, 15, 36, 4, 12, 12, 12, 44, 12, 12, 12, 20, 20, 28, 15, 15, 47, 15, 15, 15, 15, 47, 15, 15, 47, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 47, 15, 47, 15, 15, 15, 15, 15, 15, 15, 47, 36, 4, 12, 12, 44, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 46, 46, 35, 7, 11, 15, 15, 47, 47, 15, 15, 15, 36, 4, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 14, 46, 14, 46, 46, 14, 14, 18, 22, 26, 13, 13, 13, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 46, 14, 14, 14, 14, 46, 46, 14, 14, 18, 22, 26, 13, 34, 6, 10, 14, 46, 14, 46, 14, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 46, 46, 14, 14, 14, 14, 14, 18, 22, 26, 13, 13, 13, 45, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 44, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 46, 35, 7, 11, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 44, 20, 20, 28, 15, 47, 15, 47, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 46, 35, 7, 11, 15, 15, 15, 19, 23, 27, 14, 14, 14, 46, 14, 46, 35, 7, 11, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 44, 12, 12, 44, 44, 12, 12, 12, 44, 12, 44, 12, 12, 12, 12, 12, 20, 20, 28, 15, 47, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 47, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 34, 6, 10, 14, 46, 18, 22, 26, 13, 34, 6, 10, 14, 14, 46, 14, 14, 46, 35, 7, 11, 15, 36, 4, 12, 12, 12, 44, 12, 44, 12, 12, 12, 20, 20, 28, 15, 15, 15, 47, 15, 15, 15, 15, 15, 47, 15, 15, 15, 15, 47, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 34, 6, 10, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 44, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 19, 23, 27, 14, 14, 46, 14, 14, 14, 35, 7, 11, 15, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 15, 47, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 12, 44, 12, 20, 20, 28, 15, 15, 15, 15, 47, 47, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 18, 22, 26, 13, 13, 13, 13, 13, 13, 13, 34, 6, 10, 14, 14, 35, 7, 11, 15, 47, 47, 19, 23, 27, 14, 46, 14, 18, 22, 26, 13, 34, 6, 10, 14, 14, 35, 7, 11, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 46, 14, 35, 7, 11, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 47, 15, 47, 15, 47, 15, 15, 19, 23, 27, 14, 14, 46, 14, 14, 18, 22, 26, 13, 13, 13, 17, 21, 25, 12, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 47, 47, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 47, 47, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 47, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 47, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 44, 20, 20, 28, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 45, 13, 45, 13, 13, 13, 17, 21, 25, 12, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 15, 47, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 44, 12, 44, 12, 20, 20, 28, 15, 15, 15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 13, 13, 13, 34, 6, 10, 14, 14, 18, 22, 26, 13, 45, 13, 17, 21, 25, 12, 15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 17, 21, 25, 12, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 47, 15, 15, 15, 15, 47, 19, 23, 27, 14, 46, 14, 14, 35, 7, 11, 15, 19, 23, 27, 14, 46, 14, 14, 35, 7, 11, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 18, 22, 26, 13, 34, 6, 10, 14, 14, 14, 14, 14, 46, 14, 46, 14, 18, 22, 26, 13, 34, 6, 10, 14, 35, 7, 11, 15, 15, 15, 15, 15, 47, 15, 15, 15, 15, 15, 47, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 46, 14, 14, 18, 22, 26, 13, 13, 34, 6, 10, 14, 18, 22, 26, 13, 13, 13, 13, 17, 21, 25, 12, 15, 47, 15, 36, 4, 12, 12, 12, 12, 12, 44, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 46, 14, 14, 14, 35, 7, 11, 15, 19, 23, 27, 14, 14, 46, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 47, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 36, 4, 12, 12, 12, 12, 44, 20, 20, 28, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 34, 6, 10, 14, 14, 14, 18, 22, 26, 13, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 46, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 34, 6, 10, 14, 35, 7, 11, 15, 15, 15, 15, 47, 15, 19, 23, 27, 14, 46, 14, 14, 35, 7, 11, 15, 15, 47, 15, 15, 15, 47, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 17, 21, 25, 12, 15, 15, 19, 23, 27, 14, 14, 14, 46, 35, 7, 11, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 13, 45, 13, 34, 6, 10, 14, 46, 18, 22, 26, 13, 13, 13, 13, 17, 21, 25, 12, 15, 47, 15, 15, 47, 47, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 47, 19, 23, 27, 14, 14, 18, 22, 26, 13, 13, 13, 45, 34, 6, 10, 14, 14, 14, 18, 22, 26, 13, 45, 13, 13, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 44, 12, 44, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 15, 47, 15, 47, 19, 23, 27, 14, 46, 14, 35, 7, 11, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 46, 14, 14, 18, 22, 26, 13, 13, 45, 13, 17, 21, 25, 12, 15, 19, 23, 27, 14, 14, 14, 18, 22, 26, 13, 13, 45, 34, 6, 10, 14, 35, 7, 11, 15, 15, 15, 15, 15, 47, 19, 23, 27, 14, 35, 7, 11, 15, 15, 15, 36, 4, 12, 12, 44, 20, 20, 28, 15, 15, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 45, 17, 21, 25, 12, 15, 15, 47, 36, 4, 12, 12, 44, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 12, 44, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 46, 46, 14, 14, 35, 7, 11, 15, 19, 23, 27, 14, 14, 46, 35, 7, 11, 15, 15, 15, 15, 47, 36, 4, 12, 12, 44, 44, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 46, 14, 46, 14, 46, 14, 14, 14, 46, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 47, 15, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 44, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 19, 23, 27, 14, 14, 14, 35, 7, 11, 15, 15, 47, 47, 15, 19, 23, 27, 14, 46, 14, 14, 14, 14, 18, 22, 26, 13, 13, 34, 6, 10, 14, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 15, 47, 19, 23, 27, 14, 14, 14, 18, 22, 26, 13, 13, 13, 45, 34, 6, 10, 14, 14, 46, 46, 14, 14, 46, 14, 14, 46, 46, 14, 14, 35, 7, 11, 15, 47, 47, 15, 19, 23, 27, 14, 46, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 15, 15, 15, 15, 47, 15, 15, 15, 47, 15, 36, 4, 12, 12, 12, 12, 44, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 34, 6, 10, 14, 14, 14, 46, 46, 35, 7, 11, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 15, 47, 15, 15, 19, 23, 27, 14, 46, 46, 14, 14, 18, 22, 26, 13, 13, 13, 13, 13, 13, 17, 21, 25, 12, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 18, 22, 26, 13, 13, 13, 34, 6, 10, 14, 14, 18, 22, 26, 13, 13, 13, 13, 17, 21, 25, 12, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 46, 14, 14, 35, 7, 11, 15, 47, 15, 47, 15, 36, 4, 12, 12, 12, 44, 20, 20, 28, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 45, 13, 13, 45, 13, 45, 13, 13, 17, 21, 25, 12, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 15, 15, 19, 23, 27, 14, 14, 46, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 47, 15, 47, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 44, 20, 20, 28, 15, 15, 15, 15, 15, 47, 15, 15, 15, 19, 23, 27, 14, 14, 46, 14, 14, 14, 35, 7, 11, 15, 47, 15, 15, 15, 47, 47, 15, 47, 36, 4, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 44, 12, 12, 20, 20, 28, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 15, 15, 36, 4, 12, 12, 44, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 47, 15, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 44, 20, 20, 28, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 36, 4, 12, 12, 44, 44, 12, 12, 44, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 15, 47, 15, 19, 23, 27, 14, 14, 14, 46, 14, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 47, 19, 23, 27, 14, 35, 7, 11, 15, 15, 15, 15, 15, 47, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 44, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 35, 7, 11, 15, 15, 47, 47, 15, 15, 47, 36, 4, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 47, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 44, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 14, 46, 46, 14, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 15, 15, 36, 4, 12, 12, 12, 44, 20, 20, 28, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 47, 15, 19, 23, 27, 14, 35, 7, 11, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 44, 20, 20, 28, 15, 15, 47, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 13, 13, 34, 6, 10, 14, 46, 46, 14, 35, 7, 11, 15, 15, 47, 15, 15, 15, 15, 15, 15, 47, 15, 47, 15, 15, 15, 15, 47, 15, 15, 15, 15, 47, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 20, 20, 28, 15, 15, 47, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 46, 14, 14, 14, 35, 7, 11, 15, 15, 19, 23, 27, 14, 46, 14, 14, 14, 18, 22, 26, 13, 13, 13, 13, 13, 13, 13, 45, 13, 17, 21, 25, 12, 15, 47, 15, 36, 4, 12, 12, 12, 12, 12, 12, 44, 20, 20, 28, 15, 15, 15, 47, 15, 15, 47, 36, 4, 12, 12, 44, 12, 12, 12, 12, 44, 12, 44, 12, 12, 12, 44, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 18, 22, 26, 13, 13, 13, 34, 6, 10, 14, 14, 14, 46, 14, 14, 14, 14, 46, 14, 18, 22, 26, 13, 13, 13, 13, 13, 45, 13, 13, 13, 34, 6, 10, 14, 46, 14, 14, 46, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 44, 12, 12, 12, 44, 44, 12, 12, 44, 20, 20, 28, 15, 15, 19, 23, 27, 14, 14, 14, 14, 46, 14, 14, 14, 14, 14, 46, 14, 14, 14, 14, 14, 14, 14, 18, 22, 26, 13, 13, 34, 6, 10, 14, 18, 22, 26, 13, 13, 13, 13, 17, 21, 25, 12, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 47, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 47, 36, 4, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 19, 23, 27, 14, 46, 18, 22, 26, 13, 13, 13, 45, 13, 13, 13, 17, 21, 25, 12, 15, 47, 36, 4, 12, 12, 12, 44, 12, 12, 12, 12, 44, 12, 20, 20, 28, 15, 47, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 18, 22, 26, 13, 13, 13, 13, 34, 6, 10, 14, 35, 7, 11, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 15, 19, 23, 27, 14, 14, 46, 14, 14, 14, 46, 14, 14, 14, 18, 22, 26, 13, 13, 13, 34, 6, 10, 14, 14, 14, 14, 46, 14, 14, 46, 14, 35, 7, 11, 15, 15, 19, 23, 27, 14, 14, 14, 14, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 46, 46, 14, 14, 14, 18, 22, 26, 13, 13, 45, 45, 13, 34, 6, 10, 14, 35, 7, 11, 15, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 44, 12, 20, 20, 28, 15, 47, 15, 15, 36, 4, 12, 12, 12, 12, 44, 44, 12, 12, 44, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 19, 23, 27, 14, 14, 14, 35, 7, 11, 15, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 19, 23, 27, 14, 46, 14, 35, 7, 11, 15, 15, 15, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 47, 15, 47, 15, 19, 23, 27, 14, 14, 46, 14, 14, 14, 14, 14, 46, 35, 7, 11, 15, 15, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 45, 13, 17, 21, 25, 12, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 47, 15, 15, 15, 15, 15, 47, 15, 47, 47, 15, 47, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 47, 47, 36, 4, 12, 12, 20, 20, 28, 15, 15, 47, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 44, 12, 12, 20, 20, 28, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 19, 23, 27, 14, 46, 14, 14, 14, 35, 7, 11, 15, 19, 23, 27, 14, 14, 14, 18, 22, 26, 13, 13, 13, 13, 45, 13, 13, 17, 21, 25, 12, 15, 15, 19, 23, 27, 14, 14, 46, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 47, 19, 23, 27, 14, 14, 46, 14, 18, 22, 26, 13, 34, 6, 10, 14, 14, 18, 22, 26, 13, 34, 6, 10, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 15, 47, 19, 23, 27, 14, 14, 14, 14, 14, 46, 14, 14, 46, 46, 14, 14, 18, 22, 26, 13, 13, 13, 13, 13, 45, 13, 34, 6, 10, 14, 14, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 47, 36, 4, 12, 12, 44, 44, 12, 44, 12, 44, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 47, 15, 36, 4, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 35, 7, 11, 15, 15, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 15, 15, 15, 15, 15, 15, 47, 19, 23, 27, 14, 14, 14, 46, 14, 14, 14, 14, 14, 14, 14, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 15, 19, 23, 27, 14, 14, 14, 46, 14, 14, 14, 14, 14, 35, 7, 11, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 47, 47, 15, 36, 4, 12, 12, 12, 12, 44, 12, 12, 12, 44, 12, 44, 12, 12, 44, 12, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 44, 44, 12, 44, 12, 12, 20, 20, 28, 15, 47, 19, 23, 27, 14, 46, 46, 14, 35, 7, 11, 15, 15, 15, 15, 47, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 47, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 35, 7, 11, 15, 47, 15, 15, 15, 15, 15, 15, 47, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 47, 15, 47, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 46, 18, 22, 26, 13, 34, 6, 10, 14, 35, 7, 11, 15, 15, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 14, 46, 14, 18, 22, 26, 13, 45, 13, 34, 6, 10, 14, 14, 14, 14, 14, 18, 22, 26, 13, 13, 13, 13, 13, 13, 45, 17, 21, 25, 12, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 47, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 47, 15, 36, 4, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 44, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 14, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 35, 7, 11, 15, 47, 15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 34, 6, 10, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 15, 15, 47, 19, 23, 27, 14, 14, 14, 14, 14, 14, 14, 35, 7, 11, 15, 47, 15, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 46, 14, 14, 18, 22, 26, 13, 13, 13, 13, 45, 17, 21, 25, 12, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 35, 7, 11, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 15, 47, 15, 47, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 47, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 44, 12, 12, 12, 20, 20, 28, 15, 47, 15, 15, 47, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 46, 35, 7, 11, 15, 36, 4, 12, 12, 12, 44, 12, 44, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 19, 23, 27, 14, 14, 14, 46, 14, 14, 18, 22, 26, 13, 13, 13, 13, 45, 13, 13, 17, 21, 25, 12, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 19, 23, 27, 14, 18, 22, 26, 13, 45, 13, 13, 13, 13, 34, 6, 10, 14, 35, 7, 11, 15, 36, 4, 12, 12, 12, 12, 44, 12, 20, 20, 28, 15, 47, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 47, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 47, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 44, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 47, 15, 47, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 47, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 14, 46, 14, 14, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 47, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 44, 12, 20, 20, 28, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 47, 19, 23, 27, 14, 46, 14, 14, 14, 46, 14, 46, 14, 46, 14, 46, 14, 46, 14, 14, 46, 14, 46, 14, 46, 14, 14, 14, 18, 22, 26, 13, 34, 6, 10, 14, 14, 14, 46, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 12, 12, 44, 44, 20, 20, 28, 15, 15, 15, 19, 23, 27, 14, 46, 46, 14, 14, 18, 22, 26, 13, 13, 13, 13, 17, 21, 25, 12, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 47, 15, 47, 15, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 19, 23, 27, 14, 46, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 19, 23, 27, 14, 14, 46, 14, 18, 22, 26, 13, 13, 45, 13, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 46, 14, 14, 14, 14, 35, 7, 11, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 13, 13, 45, 34, 6, 10, 14, 14, 14, 14, 14, 18, 22, 26, 13, 13, 45, 13, 13, 13, 34, 6, 10, 14, 14, 35, 7, 11, 15, 15, 15, 15, 47, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 44, 20, 20, 28, 15, 36, 4, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 47, 19, 23, 27, 14, 14, 14, 14, 14, 18, 22, 26, 13, 13, 34, 6, 10, 14, 14, 14, 18, 22, 26, 13, 13, 13, 45, 13, 17, 21, 25, 12, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 19, 23, 27, 14, 14, 14, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 12, 12, 44, 20, 20, 28, 15, 15, 19, 23, 27, 14, 14, 46, 46, 14, 14, 14, 46, 35, 7, 11, 15, 47, 19, 23, 27, 14, 35, 7, 11, 15, 15, 15, 15, 15, 47, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 15, 47, 15, 15, 15, 15, 15, 36, 4, 12, 12, 44, 12, 12, 20, 20, 28, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 14, 14, 35, 7, 11, 15, 15, 47, 19, 23, 27, 14, 14, 14, 35, 7, 11, 15, 15, 15, 36, 4, 12, 12, 12, 44, 44, 12, 12, 44, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 46, 14, 18, 22, 26, 13, 13, 13, 34, 6, 10, 14, 14, 14, 14, 35, 7, 11, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 47, 15, 15, 15, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 44, 44, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 47, 19, 23, 27, 14, 14, 14, 14, 18, 22, 26, 13, 13, 13, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 19, 23, 27, 14, 46, 35, 7, 11, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 18, 22, 26, 13, 13, 34, 6, 10, 14, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 47, 47, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 34, 6, 10, 14, 14, 46, 14, 14, 14, 14, 14, 14, 14, 14, 14, 46, 14, 14, 14, 14, 35, 7, 11, 15, 15, 47, 15, 15, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 44, 44, 12, 20, 20, 28, 15, 15, 15, 15, 47, 15, 47, 47, 15, 15, 15, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 15, 47, 15, 36, 4, 12, 12, 44, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 47, 15, 15, 15, 47, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 46, 35, 7, 11, 15, 36, 4, 12, 12, 44, 44, 44, 44, 12, 44, 12, 12, 12, 44, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 35, 7, 11, 15, 47, 15, 15, 19, 23, 27, 14, 14, 14, 46, 35, 7, 11, 15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 34, 6, 10, 14, 14, 14, 46, 14, 14, 35, 7, 11, 15, 15, 15, 47, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 44, 44, 20, 20, 28, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 18, 22, 26, 13, 45, 17, 21, 25, 12, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 47, 15, 15, 15, 15, 15, 19, 23, 27, 14, 46, 14, 14, 46, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 47, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 45, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 47, 19, 23, 27, 14, 14, 35, 7, 11, 15, 15, 15, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 36, 4, 12, 12, 12, 44, 20, 20, 28, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 34, 6, 10, 14, 35, 7, 11, 15, 15, 19, 23, 27, 14, 46, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 15, 47, 15, 15, 15, 47, 15, 19, 23, 27, 14, 46, 18, 22, 26, 13, 13, 13, 13, 13, 13, 34, 6, 10, 14, 14, 46, 14, 14, 35, 7, 11, 15, 47, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 46, 14, 14, 14, 14, 18, 22, 26, 13, 13, 13, 13, 45, 13, 13, 34, 6, 10, 14, 35, 7, 11, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 44, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 15, 15, 47, 47, 15, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 36, 4, 12, 12, 12, 12, 12, 44, 12, 44, 20, 20, 28, 15, 47, 15, 19, 23, 27, 14, 46, 14, 14, 14, 46, 14, 35, 7, 11, 15, 47, 15, 36, 4, 12, 12, 12, 12, 44, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 14, 14, 46, 35, 7, 11, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 36, 4, 12, 12, 44, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 36, 4, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 46, 14, 14, 46, 14, 14, 14, 14, 18, 22, 26, 13, 13, 13, 45, 13, 13, 13, 13, 45, 34, 6, 10, 14, 14, 14, 14, 14, 14, 18, 22, 26, 13, 45, 17, 21, 25, 12, 15, 47, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 44, 12, 44, 44, 20, 20, 28, 15, 47, 47, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 15, 15, 47, 47, 47, 15, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 47, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 36, 4, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 44, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 14, 14, 46, 14, 18, 22, 26, 13, 45, 34, 6, 10, 14, 14, 14, 14, 46, 18, 22, 26, 13, 34, 6, 10, 14, 14, 18, 22, 26, 13, 34, 6, 10, 14, 18, 22, 26, 13, 13, 17, 21, 25, 12, 15, 15, 15, 15, 15, 15, 47, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 47, 15, 15, 15, 15, 15, 15, 47, 15, 15, 19, 23, 27, 14, 14, 14, 35, 7, 11, 15, 47, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 45, 13, 13, 17, 21, 25, 12, 15, 15, 47, 36, 4, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 19, 23, 27, 14, 14, 14, 18, 22, 26, 13, 45, 13, 13, 45, 17, 21, 25, 12, 15, 36, 4, 12, 12, 12, 12, 44, 12, 12, 20, 20, 28, 15, 15, 15, 47, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 34, 6, 10, 14, 14, 46, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 44, 20, 20, 28, 15, 15, 15, 47, 36, 4, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 15, 15, 15, 47, 36, 4, 12, 12, 12, 12, 44, 12, 12, 12, 20, 20, 28, 15, 15, 47, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 47, 15, 15, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 47, 15, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 47, 15, 15, 36, 4, 12, 12, 44, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 18, 22, 26, 13, 13, 13, 13, 45, 17, 21, 25, 12, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 20, 20, 28, 15, 15, 15, 19, 23, 27, 14, 14, 46, 18, 22, 26, 13, 34, 6, 10, 14, 35, 7, 11, 15, 15, 15, 15, 47, 19, 23, 27, 14, 46, 14, 14, 14, 18, 22, 26, 13, 13, 13, 13, 17, 21, 25, 12, 15, 19, 23, 27, 14, 46, 18, 22, 26, 13, 17, 21, 25, 12, 15, 47, 15, 19, 23, 27, 14, 46, 46, 46, 14, 14, 35, 7, 11, 15, 47, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 44, 44, 44, 44, 12, 20, 20, 28, 15, 15, 47, 15, 15, 47, 19, 23, 27, 14, 14, 14, 14, 14, 14, 14, 46, 14, 14, 14, 35, 7, 11, 15, 19, 23, 27, 14, 14, 14, 46, 46, 35, 7, 11, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 14, 14, 46, 14, 14, 14, 46, 14, 14, 14, 14, 35, 7, 11, 15, 15, 19, 23, 27, 14, 35, 7, 11, 15, 15, 47, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 13, 34, 6, 10, 14, 14, 35, 7, 11, 15, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 47, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 35, 7, 11, 15, 15, 15, 15, 19, 23, 27, 14, 14, 14, 46, 14, 14, 14, 46, 14, 14, 35, 7, 11, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 19, 23, 27, 14, 18, 22, 26, 13, 13, 13, 17, 21, 25, 12, 15, 47, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 15, 36, 4, 12, 12, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15, 15, 15, 36, 4, 12, 12, 12, 44, 20, 20, 28, 15, 15, 15, 47, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 36, 4, 12, 12, 12, 12, 12, 44, 12, 20, 20, 28, 15, 15, 15, 36, 4, 12, 12, 12, 44, 44, 44, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 28, 15, 36, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 44, 44, 44, 12, 12, 44, 12, 12, 12, 12, 12, 12, 12, 44, 12, 12, 12, 12, 44, 12, 12, 20, 20, 28, 15, 15, 15, 15, 15, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 15, 19, 23, 27, 14, 46, 46, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 46, 14, 46, 14, 14, 14, 35, 7, 11, 15, 47, 15, 15, 19, 23, 27, 14, 14, 35, 7, 11, 15, 15, 15, 15, 15, 15, 15, 47, 47, 15, 47, 15, 15, 19, 23, 27, 14, 18, 22, 26, 13, 34, 6, 10, 14, 14, 14, 35, 7, 11, 15, 47, 47, 15, 15, 15, 15, 47, 15, 15, 15, 36, 4, 12, 12, 12, 20, 20, 28, 15, 19, 23, 27, 14, 14, 14, 14, 14, 14, 46, 18, 22, 26, 13, 34, 6, 10, 14, 35, 7, 11, 15, 15, 15, 19, 23, 27, 14, 14, 14, 14, 14, 18, 22, 26, 13, 17, 21, 25, 12, 15}; /** * Tests if a tile can be converted to MP_TREES @@ -134,24 +135,37 @@ static void PlantTreesOnTile(TileIndex tile, TreeType treetype, uint count, uint static TreeType GetRandomTreeType(TileIndex tile, uint seed) { switch (_settings_game.game_creation.landscape) { - case LT_TEMPERATE: - return (TreeType)(seed * TREE_COUNT_TEMPERATE / 256 + TREE_TEMPERATE); - - case LT_ARCTIC: - return (TreeType)(seed * TREE_COUNT_SUB_ARCTIC / 256 + TREE_SUB_ARCTIC); - + case LT_TEMPERATE: return TREE_RANDOM_TEMPERATE; + case LT_ARCTIC: return TREE_RANDOM_ARCTIC; case LT_TROPIC: switch (GetTropicZone(tile)) { - case TROPICZONE_NORMAL: return (TreeType)(seed * TREE_COUNT_SUB_TROPICAL / 256 + TREE_SUB_TROPICAL); - case TROPICZONE_DESERT: return (TreeType)((seed > 12) ? TREE_INVALID : TREE_CACTUS); - default: return (TreeType)(seed * TREE_COUNT_RAINFOREST / 256 + TREE_RAINFOREST); + case TROPICZONE_NORMAL: return TREE_RANDOM_TROPIC_NORMAL; + case TROPICZONE_DESERT: return ((seed > 12) ? TREE_INVALID : TREE_CACTUS); + default: return TREE_RANDOM_TROPIC_RAINFOREST; } + default: return TREE_RANDOM_TOYLAND; + } +} +static TreeType GetProceduralTreeType(TileIndex tile) +{ + TreeType type = GetTreeType(tile); + uint seed = (uint)tile; + switch (type) { + case TREE_RANDOM_TEMPERATE: + return (TreeType)(seed % TREE_COUNT_TEMPERATE + TREE_TEMPERATE); + case TREE_RANDOM_ARCTIC: + return (TreeType)(seed % TREE_COUNT_SUB_ARCTIC + TREE_SUB_ARCTIC); + case TREE_RANDOM_TROPIC_NORMAL: + return (TreeType)(seed % TREE_COUNT_SUB_TROPICAL + TREE_SUB_TROPICAL); + case TREE_RANDOM_TROPIC_RAINFOREST: + return (TreeType)(seed % TREE_COUNT_RAINFOREST + TREE_RAINFOREST); + case TREE_RANDOM_TOYLAND: + return (TreeType)(seed % TREE_COUNT_TOYLAND + TREE_TOYLAND); default: - return (TreeType)(seed * TREE_COUNT_TOYLAND / 256 + TREE_TOYLAND); + return type; } } - /** * Make a random tree tile of the given tile * @@ -166,7 +180,7 @@ static void PlaceTree(TileIndex tile, uint32 r) TreeType tree = GetRandomTreeType(tile, GB(r, 24, 8)); if (tree != TREE_INVALID) { - PlantTreesOnTile(tile, tree, GB(r, 22, 2), std::min(GB(r, 16, 3), 6)); + PlantTreesOnTile(tile, tree, 0, 7); MarkTileDirtyByTile(tile); /* Rerandomize ground, if neither snow nor shore */ @@ -525,11 +539,14 @@ static void DrawTile_Trees(TileInfo *ti) if (IsInvisibilitySet(TO_TREES)) return; uint tmp = CountBits(static_cast(ti->tile + ti->x + ti->y)); - uint index = GB(tmp, 0, 2) + (GetTreeType(ti->tile) << 2); + auto tt = GetProceduralTreeType(ti->tile); + uint index = GB(tmp, 0, 2) + (tt << 2); + // bool is_procedural = (GetTreeType(tile) >= TREE_RANDOM_BEGIN); + uint density = GetTreeDensity(ti->tile); /* different tree styles above one of the grounds */ if ((GetTreeGround(ti->tile) == TREE_GROUND_SNOW_DESERT || GetTreeGround(ti->tile) == TREE_GROUND_ROUGH_SNOW) && - GetTreeDensity(ti->tile) >= 2 && + density >= 2 && IsInsideMM(index, TREE_SUB_ARCTIC << 2, TREE_RAINFOREST << 2)) { index += 164 - (TREE_SUB_ARCTIC << 2); } @@ -546,9 +563,16 @@ static void DrawTile_Trees(TileInfo *ti) /* put the trees to draw in a list */ uint trees = GetTreeCount(ti->tile); + uint growth = GetTreeGrowth(ti->tile); + if (growth == 7) { + uint32 cycle = (uint32)ti->tile * 5147 + (_tick_counter >> 8); + auto proc_value = RANDOM_GROWTH[(cycle >> 4) % lengthof(RANDOM_GROWTH)]; + growth = GB(proc_value, 2, 3); + trees = GB(proc_value, 0, 2); + } for (uint i = 0; i < trees; i++) { - SpriteID sprite = s[0].sprite + (i == trees - 1 ? GetTreeGrowth(ti->tile) : 3); + SpriteID sprite = s[0].sprite + (i == trees - 1 ? growth : 3); PaletteID pal = s[0].pal; te[i].sprite = sprite; @@ -606,7 +630,8 @@ static CommandCost ClearTile_Trees(TileIndex tile, DoCommandFlag flags) } num = GetTreeCount(tile); - if (IsInsideMM(GetTreeType(tile), TREE_RAINFOREST, TREE_CACTUS)) num *= 4; + auto tt = GetProceduralTreeType(tile); + if (IsInsideMM(tt, TREE_RAINFOREST, TREE_CACTUS)) num *= 4; if (flags & DC_EXEC) DoClearSquare(tile); @@ -615,7 +640,7 @@ static CommandCost ClearTile_Trees(TileIndex tile, DoCommandFlag flags) static void GetTileDesc_Trees(TileIndex tile, TileDesc *td) { - TreeType tt = GetTreeType(tile); + TreeType tt = GetProceduralTreeType(tile); if (IsInsideMM(tt, TREE_RAINFOREST, TREE_CACTUS)) { td->str = STR_LAI_TREE_NAME_RAINFOREST; @@ -707,7 +732,7 @@ static void TileLoop_Trees(TileIndex tile) /* _tick_couter is incremented by 256 between each call, so ignore lower 8 bits. * Also, we add tile % 31 to spread the updates evenly over the map, * where 31 is just some prime number that looks ok. */ - uint32 cycle = (uint32)tile % 31 + (_tick_counter >> 8); + uint32 cycle = (uint32)tile * 5147 + (_tick_counter >> 8); /* Handle growth of grass (under trees/on MP_TREES tiles) at every 8th processings, like it's done for grass on MP_CLEAR tiles. */ if ((cycle & 7) == 7 && GetTreeGround(tile) == TREE_GROUND_GRASS) { @@ -722,86 +747,119 @@ static void TileLoop_Trees(TileIndex tile) if ((cycle & 15) < 15) return; - switch (GetTreeGrowth(tile)) { - case 3: // regular sized tree - if (_settings_game.game_creation.landscape == LT_TROPIC && - GetTreeType(tile) != TREE_CACTUS && - GetTropicZone(tile) == TROPICZONE_DESERT) { - AddTreeGrowth(tile, 1); - } else { - switch (GB(Random(), 0, 3)) { - case 0: // start destructing - AddTreeGrowth(tile, 1); - break; - - case 1: // add a tree - if (GetTreeCount(tile) < 4 && CanPlantExtraTrees(tile)) { - AddTreeCount(tile, 1); - SetTreeGrowth(tile, 0); + // bool is_procedural = (GetTreeType(tile) >= TREE_RANDOM_BEGIN); + + uint growth = GetTreeGrowth(tile); + uint count = GetTreeCount(tile); + auto proc_value = RANDOM_GROWTH[(cycle >> 4) % lengthof(RANDOM_GROWTH)]; + auto proc_growth = GB(proc_value, 2, 3); + auto proc_count = GB(proc_value, 0, 2); + bool spread = false; + bool clear = false; + + /* Check if the growth state matches procedural growth so we can switch to it. */ + if (growth == proc_growth && count == proc_count) { + growth = 7; + SetTreeGrowth(tile, growth); + SetTreeCount(tile, 0); + } + + if (growth == 7) { + /* Procedural growth */ + spread = HasBit(proc_value, 6); + clear = (proc_count == 0); + } else { + /* Custom growth */ + switch (growth) { + case 3: // regular sized tree + if (_settings_game.game_creation.landscape == LT_TROPIC && + GetTreeType(tile) != TREE_CACTUS && + GetTropicZone(tile) == TROPICZONE_DESERT) { + AddTreeGrowth(tile, 1); + } else { + switch (GB(Random(), 0, 3)) { + case 0: // start destructing + AddTreeGrowth(tile, 1); + break; + + case 1: // add a tree + spread = CanPlantExtraTrees(tile); + if (count < 4 && spread) { + AddTreeCount(tile, 1); + SetTreeGrowth(tile, 0); + spread = false; + } + break; + + case 2: { // add a neighbouring tree + spread = CanPlantExtraTrees(tile); break; } - FALLTHROUGH; - case 2: { // add a neighbouring tree - if (!CanPlantExtraTrees(tile)) break; + default: + return; + } + } + break; - TreeType treetype = GetTreeType(tile); + case 6: // final stage of tree destruction + if (!CanPlantExtraTrees(tile)) { + /* if trees can't spread just plant a new one to prevent deforestation */ + SetTreeGrowth(tile, 0); + } else if (count > 1) { + /* more than one tree, delete it */ + AddTreeCount(tile, -1); + SetTreeGrowth(tile, 3); + } else { + /* no more trees, mark the tile for clearing */ + clear = true; + } + break; - tile += TileOffsByDir((Direction)(Random() & 7)); + default: + AddTreeGrowth(tile, 1); + break; + } - /* Cacti don't spread */ - if (!CanPlantTreesOnTile(tile, false)) return; + } - /* Don't plant trees, if ground was freshly cleared */ - if (IsTileType(tile, MP_CLEAR) && GetClearGround(tile) == CLEAR_GRASS && GetClearDensity(tile) != 3) return; + if (clear) { + /* All trees died, change type into MP_CLEAR */ + switch (GetTreeGround(tile)) { + case TREE_GROUND_SHORE: MakeShore(tile); break; + case TREE_GROUND_GRASS: MakeClear(tile, CLEAR_GRASS, GetTreeDensity(tile)); break; + case TREE_GROUND_ROUGH: MakeClear(tile, CLEAR_ROUGH, 3); break; + case TREE_GROUND_ROUGH_SNOW: { + uint density = GetTreeDensity(tile); + MakeClear(tile, CLEAR_ROUGH, 3); + MakeSnow(tile, density); + break; + } + default: // snow or desert + if (_settings_game.game_creation.landscape == LT_TROPIC) { + MakeClear(tile, CLEAR_DESERT, GetTreeDensity(tile)); + } else { + uint density = GetTreeDensity(tile); + MakeClear(tile, CLEAR_GRASS, 3); + MakeSnow(tile, density); + } + break; + } + } - PlantTreesOnTile(tile, treetype, 0, 0); + if (spread) { + TreeType treetype = GetTreeType(tile); - break; - } + /* We never spread while changing the current tile so it's ok to overwrite and only mark the new tile dirty later. */ + tile += TileOffsByDir((Direction)(Random() & 7)); - default: - return; - } - } - break; + /* Cacti don't spread */ + if (!CanPlantTreesOnTile(tile, false)) return; - case 6: // final stage of tree destruction - if (!CanPlantExtraTrees(tile)) { - /* if trees can't spread just plant a new one to prevent deforestation */ - SetTreeGrowth(tile, 0); - } else if (GetTreeCount(tile) > 1) { - /* more than one tree, delete it */ - AddTreeCount(tile, -1); - SetTreeGrowth(tile, 3); - } else { - /* just one tree, change type into MP_CLEAR */ - switch (GetTreeGround(tile)) { - case TREE_GROUND_SHORE: MakeShore(tile); break; - case TREE_GROUND_GRASS: MakeClear(tile, CLEAR_GRASS, GetTreeDensity(tile)); break; - case TREE_GROUND_ROUGH: MakeClear(tile, CLEAR_ROUGH, 3); break; - case TREE_GROUND_ROUGH_SNOW: { - uint density = GetTreeDensity(tile); - MakeClear(tile, CLEAR_ROUGH, 3); - MakeSnow(tile, density); - break; - } - default: // snow or desert - if (_settings_game.game_creation.landscape == LT_TROPIC) { - MakeClear(tile, CLEAR_DESERT, GetTreeDensity(tile)); - } else { - uint density = GetTreeDensity(tile); - MakeClear(tile, CLEAR_GRASS, 3); - MakeSnow(tile, density); - } - break; - } - } - break; + /* Don't plant trees, if ground was freshly cleared */ + if (IsTileType(tile, MP_CLEAR) && GetClearGround(tile) == CLEAR_GRASS && GetClearDensity(tile) != 3) return; - default: - AddTreeGrowth(tile, 1); - break; + PlantTreesOnTile(tile, treetype, 0, 0); } MarkTileDirtyByTile(tile); diff --git a/src/tree_map.h b/src/tree_map.h index a01968f08fc5b..3f1a111e62d11 100644 --- a/src/tree_map.h +++ b/src/tree_map.h @@ -29,7 +29,14 @@ enum TreeType { TREE_CACTUS = 0x1B, ///< a cactus for the 'desert part' on a sub-tropical map TREE_SUB_TROPICAL = 0x1C, ///< tree on a sub-tropical map, non-rainforest, non-desert TREE_TOYLAND = 0x20, ///< tree on a toyland map + TREE_RANDOM_TEMPERATE = 0xf0, // TODO + TREE_RANDOM_BEGIN = TREE_RANDOM_TEMPERATE, + TREE_RANDOM_ARCTIC = 0xf1, + TREE_RANDOM_TROPIC_NORMAL = 0xf2, + TREE_RANDOM_TROPIC_RAINFOREST = 0xf3, + TREE_RANDOM_TOYLAND = 0xf6, TREE_INVALID = 0xFF, ///< An invalid tree + TREE_RANDOM_END = TREE_INVALID, }; /* Counts the number of tree types for each landscape. @@ -169,6 +176,12 @@ static inline void AddTreeCount(TileIndex t, int c) _m[t].m5 += c << 6; } +static inline void SetTreeCount(TileIndex t, int c) +{ + assert(IsTileType(t, MP_TREES)); + SB(_m[t].m5, 6, 2, c); +} + /** * Returns the tree growth status. * @@ -232,7 +245,8 @@ static inline void MakeTree(TileIndex t, TreeType type, uint count, uint growth, SetTileType(t, MP_TREES); SetTileOwner(t, OWNER_NONE); SetWaterClass(t, ground == TREE_GROUND_SHORE ? WATER_CLASS_SEA : WATER_CLASS_INVALID); - _m[t].m2 = ground << 6 | density << 4 | 0; + _m[t].m2 = ground << 6 | density << 4 | 0; + // _m[t].m2 = ground << 6 | 0 << 4 | 0; _m[t].m3 = type; _m[t].m4 = 0 << 5 | 0 << 2; _m[t].m5 = count << 6 | growth;