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

Method unmarkPlant

library/modules/Designations.cpp:120–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120bool Designations::unmarkPlant(const df::plant *plant)
121{
122 CHECK_NULL_POINTER(plant);
123
124 if (canUnmarkPlant(plant))
125 {
126 df::coord des_pos = getPlantDesignationTile(plant);
127 df::map_block *block = Maps::getTileBlock(des_pos);
128 block->designation[des_pos.x % 16][des_pos.y % 16].bits.dig = tile_dig_designation::No;
129 block->flags.bits.designated = true;
130
131 auto *link = world->jobs.list.next;
132 while (link)
133 {
134 auto *next = link->next;
135 df::job *job = link->item;
136
137 if (job &&
138 (job->job_type == job_type::FellTree || job->job_type == job_type::GatherPlants) &&
139 job->pos == des_pos)
140 {
141 Job::removeJob(job);
142 }
143
144 link = next;
145 }
146
147 return true;
148 }
149 else
150 {
151 return false;
152 }
153}

Callers

nothing calls this directly

Calls 1

getTileBlockFunction · 0.85

Tested by

no test coverage detected