💿🐜 Antkeeper source code https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.7 KiB

  1. /*
  2. * Copyright (C) 2021 Christopher J. Howard
  3. *
  4. * This file is part of Antkeeper source code.
  5. *
  6. * Antkeeper source code is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Antkeeper source code is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include "game/ant/phenome.hpp"
  20. namespace game {
  21. namespace ant {
  22. phenome::phenome(const genome& genome, caste caste):
  23. phenome()
  24. {
  25. if (genome.antennae)
  26. if (auto it = genome.antennae->phenes.find(caste); it != genome.antennae->phenes.end())
  27. antennae = &it->second;
  28. if (genome.body_size)
  29. if (auto it = genome.body_size->phenes.find(caste); it != genome.body_size->phenes.end())
  30. body_size = &it->second;
  31. if (genome.cocoon)
  32. cocoon = &genome.cocoon->phene;
  33. if (genome.diet)
  34. diet = &genome.diet->phene;
  35. if (genome.egg)
  36. egg = &genome.egg->phene;
  37. if (genome.eyes)
  38. if (auto it = genome.eyes->phenes.find(caste); it != genome.eyes->phenes.end())
  39. eyes = &it->second;
  40. if (genome.foraging_time)
  41. foraging_time = &genome.foraging_time->phene;
  42. if (genome.founding_mode)
  43. founding_mode = &genome.founding_mode->phene;
  44. if (genome.gaster)
  45. if (auto it = genome.gaster->phenes.find(caste); it != genome.gaster->phenes.end())
  46. gaster = &it->second;
  47. if (genome.head)
  48. if (auto it = genome.head->phenes.find(caste); it != genome.head->phenes.end())
  49. head = &it->second;
  50. if (genome.larva)
  51. larva = &genome.larva->phene;
  52. if (genome.legs)
  53. if (auto it = genome.legs->phenes.find(caste); it != genome.legs->phenes.end())
  54. legs = &it->second;
  55. if (genome.mandibles)
  56. if (auto it = genome.mandibles->phenes.find(caste); it != genome.mandibles->phenes.end())
  57. mandibles = &it->second;
  58. if (genome.mesosoma)
  59. if (auto it = genome.mesosoma->phenes.find(caste); it != genome.mesosoma->phenes.end())
  60. mesosoma = &it->second;
  61. if (genome.nest_site)
  62. nest_site = &genome.nest_site->phene;
  63. if (genome.ocelli)
  64. if (auto it = genome.ocelli->phenes.find(caste); it != genome.ocelli->phenes.end())
  65. ocelli = &it->second;
  66. if (genome.pigmentation)
  67. if (auto it = genome.pigmentation->phenes.find(caste); it != genome.pigmentation->phenes.end())
  68. pigmentation = &it->second;
  69. if (genome.pilosity)
  70. if (auto it = genome.pilosity->phenes.find(caste); it != genome.pilosity->phenes.end())
  71. pilosity = &it->second;
  72. if (genome.sculpturing)
  73. if (auto it = genome.sculpturing->phenes.find(caste); it != genome.sculpturing->phenes.end())
  74. sculpturing = &it->second;
  75. if (genome.sting)
  76. if (auto it = genome.sting->phenes.find(caste); it != genome.sting->phenes.end())
  77. sting = &it->second;
  78. if (genome.waist)
  79. if (auto it = genome.waist->phenes.find(caste); it != genome.waist->phenes.end())
  80. waist = &it->second;
  81. if (genome.wings)
  82. if (auto it = genome.wings->phenes.find(caste); it != genome.wings->phenes.end())
  83. wings = &it->second;
  84. }
  85. phenome::phenome():
  86. antennae(nullptr),
  87. body_size(nullptr),
  88. cocoon(nullptr),
  89. diet(nullptr),
  90. egg(nullptr),
  91. eyes(nullptr),
  92. foraging_time(nullptr),
  93. founding_mode(nullptr),
  94. gaster(nullptr),
  95. head(nullptr),
  96. larva(nullptr),
  97. legs(nullptr),
  98. mandibles(nullptr),
  99. mesosoma(nullptr),
  100. nest_site(nullptr),
  101. ocelli(nullptr),
  102. pigmentation(nullptr),
  103. pilosity(nullptr),
  104. sculpturing(nullptr),
  105. sting(nullptr),
  106. waist(nullptr),
  107. wings(nullptr)
  108. {}
  109. } // namespace ant
  110. } // namespace game