Looks in the local creation zone's picked growths vector to see if a matching growth has been marked as picked.
| 224 | |
| 225 | // Looks in the local creation zone's picked growths vector to see if a matching growth has been marked as picked. |
| 226 | bool picked(const df::plant* plant, int32_t growth_subtype, int32_t growth_density) { |
| 227 | int32_t pos_x = plant->pos.x / 48 + world->map.region_x; |
| 228 | int32_t pos_y = plant->pos.y / 48 + world->map.region_y; |
| 229 | size_t cz_id = pos_x + pos_y * 16 * world->world_data->world_width; |
| 230 | auto cz = df::world_object_data::find(cz_id); |
| 231 | if (!cz) { |
| 232 | return false; |
| 233 | } |
| 234 | |
| 235 | for (size_t i = 0; i < cz->picked_growths.x.size(); i++) { |
| 236 | if (cz->picked_growths.x[i] == (plant->pos.x % 48) && |
| 237 | cz->picked_growths.y[i] == (plant->pos.y % 48) && |
| 238 | cz->picked_growths.z[i] == (plant->pos.z + world->map.region_z) && |
| 239 | cz->picked_growths.density[i] >= growth_density && |
| 240 | cz->picked_growths.subtype[i] == growth_subtype && |
| 241 | cz->picked_growths.year[i] == *cur_year) { |
| 242 | return true; |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | return false; |
| 247 | } |
| 248 | |
| 249 | bool designate(color_ostream& out, const df::plant* plant, bool farming) { |
| 250 | TRACE(log, out).print("Attempting to designate {} at ({}, {}, {})\n", world->raws.plants.all[plant->material]->id, plant->pos.x, plant->pos.y, plant->pos.z); |