vaults.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. #ifndef __VAULTS_H
  2. #define __VAULTS_H
  3. #include <set>
  4. #include <map>
  5. #include <string>
  6. #include <memory>
  7. struct Vault {
  8. tag_t tag;
  9. unsigned int level;
  10. unsigned int count;
  11. struct brush {
  12. bool is_blank;
  13. bool is_walk;
  14. bool is_water;
  15. tag_t terrain;
  16. struct design_t {
  17. enum class type_t : unsigned int {
  18. NONE,
  19. SPECIFIC,
  20. LEVEL,
  21. LEVEL_ANY
  22. };
  23. type_t type;
  24. tag_t tag;
  25. unsigned int level;
  26. design_t() : type(type_t::NONE), level(0) {}
  27. };
  28. design_t design;
  29. struct species_t {
  30. enum class type_t : unsigned int {
  31. NONE,
  32. SPECIFIC,
  33. GENUS,
  34. LEVEL
  35. };
  36. type_t type;
  37. tag_t tag;
  38. unsigned int level;
  39. species_t() : type(type_t::NONE), level(0) {}
  40. };
  41. species_t species;
  42. brush() : is_blank(false), is_walk(false), is_water(false) {}
  43. };
  44. typedef std::map<unsigned char, brush> brushes_t;
  45. brushes_t brushes;
  46. std::vector<std::string> pic;
  47. unsigned int ax;
  48. unsigned int ay;
  49. enum class placement_t : unsigned int {
  50. floor,
  51. water,
  52. corner,
  53. shoreline,
  54. lowlands,
  55. packing
  56. };
  57. placement_t placement;
  58. unsigned int w;
  59. unsigned int h;
  60. tag_t inherit;
  61. bool transpose;
  62. unsigned int priority;
  63. int px;
  64. int py;
  65. bool use_species_counts;
  66. enum class type_t : unsigned int {
  67. FIXED,
  68. SEMIRANDOM,
  69. RANDOM
  70. };
  71. type_t type;
  72. struct cloud_t {
  73. size_t n;
  74. mean_deviation_t distrib;
  75. std::vector<double> chances;
  76. std::vector<unsigned char> brushes;
  77. cloud_t() : n(0) {}
  78. };
  79. cloud_t cloud;
  80. struct blob_t {
  81. size_t n;
  82. placement_t placement;
  83. unsigned char brush;
  84. blob_t() : n(0), placement(placement_t::floor), brush(0) {}
  85. };
  86. blob_t blob;
  87. struct river_t {
  88. size_t n;
  89. unsigned char brush;
  90. mean_deviation_t angle;
  91. mean_deviation_t width;
  92. unsigned int splitchance;
  93. river_t() : n(0), brush(0), splitchance(0) {}
  94. };
  95. river_t river;
  96. struct room_t {
  97. unsigned int w1;
  98. unsigned int w2;
  99. unsigned int h1;
  100. unsigned int h2;
  101. unsigned char brush;
  102. room_t() : w1(0), w2(0), h1(0), h2(0), brush(0) {}
  103. };
  104. room_t room;
  105. struct tunnel_t {
  106. bool enabled;
  107. unsigned char plain_brush;
  108. unsigned char a_brush;
  109. unsigned char b_brush;
  110. tunnel_t() : enabled(false), plain_brush(0), a_brush(0), b_brush(0) {}
  111. };
  112. tunnel_t tunnel;
  113. Vault() : level(0), count(0), ax(0), ay(0), placement(placement_t::floor),
  114. w(0), h(0), transpose(false), priority(0), px(-1), py(-1),
  115. use_species_counts(false), type(type_t::FIXED) {}
  116. void postprocess() {
  117. unsigned int _h = pic.size();
  118. unsigned int _w = 0;
  119. for (const std::string& s : pic) {
  120. _w = std::max((unsigned int)s.size(), _w);
  121. }
  122. w = std::max(w, _w);
  123. h = std::max(h, _h);
  124. }
  125. };
  126. #endif