MCPcopy Create free account
hub / github.com/DFHack/dfhack / process_embark_incursion

Function process_embark_incursion

plugins/embark-assistant/matcher.cpp:73–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 //=======================================================================================
72
73 void process_embark_incursion(matcher_info *result,
74 embark_assist::defs::world_tile_data *survey_results,
75 embark_assist::defs::mid_level_tile_incursion_base *mlt, // Note this is a single tile, as opposed to most usages of this variable name.
76 embark_assist::defs::finders *finder,
77 int16_t elevation,
78 uint16_t x,
79 uint16_t y,
80 bool *failed_match) {
81
82 df::world_data *world_data = world->world_data;
83
84 // Savagery & Evilness
85 {
86 result->savagery_found[mlt->savagery_level] = true;
87 result->evilness_found[mlt->evilness_level] = true;
88
89 embark_assist::defs::evil_savagery_ranges l = embark_assist::defs::evil_savagery_ranges::Low;
90 while (true) {
91 if (mlt->savagery_level == static_cast<uint8_t>(l)) {
92 if (finder->savagery[static_cast <int>(l)] ==
93 embark_assist::defs::evil_savagery_values::Absent) {
94 *failed_match = true;
95 return;
96 }
97 }
98 else {
99 if (finder->savagery[static_cast <int>(l)] ==
100 embark_assist::defs::evil_savagery_values::All) {
101 *failed_match = true;
102 return;
103 }
104 }
105
106 if (mlt->evilness_level == static_cast<uint8_t>(l)) {
107 if (finder->evilness[static_cast <int>(l)] ==
108 embark_assist::defs::evil_savagery_values::Absent) {
109 *failed_match = true;
110 return;
111 }
112 }
113 else {
114 if (finder->evilness[static_cast <int>(l)] ==
115 embark_assist::defs::evil_savagery_values::All) {
116 *failed_match = true;
117 return;
118 }
119 }
120
121 if (l == embark_assist::defs::evil_savagery_ranges::High) break;
122 l = static_cast <embark_assist::defs::evil_savagery_ranges>(static_cast<int8_t>(l) + 1);
123 }
124 }
125
126 // Aquifer
127 result->aquifer |= mlt->aquifer;
128
129 switch (finder->aquifer) {
130 case embark_assist::defs::aquifer_ranges::NA:

Calls

no outgoing calls

Tested by

no test coverage detected