Update getplants to use Designations module

Fixes #531
Fixes #1014
Fixes #1018
develop
lethosor 2017-05-06 00:11:07 -04:00
parent 55931703ac
commit 3dc2c2259b
1 changed files with 10 additions and 13 deletions

@ -1,5 +1,7 @@
// (un)designate matching plants for gathering/cutting
#include <set>
#include "Core.h"
#include "Console.h"
#include "Export.h"
@ -7,18 +9,19 @@
#include "DataDefs.h"
#include "TileTypes.h"
#include "df/world.h"
#include "df/map_block.h"
#include "df/tile_dig_designation.h"
#include "df/plant_raw.h"
#include "df/plant.h"
#include "df/plant_raw.h"
#include "df/tile_dig_designation.h"
#include "df/world.h"
#include "modules/Designations.h"
#include "modules/Maps.h"
#include <set>
using std::string;
using std::vector;
using std::set;
using namespace DFHack;
using namespace df::enums;
@ -129,20 +132,14 @@ command_result df_getplants (color_ostream &out, vector <string> & parameters)
continue;
if (cur->designation[x][y].bits.hidden)
continue;
if (deselect && cur->designation[x][y].bits.dig == tile_dig_designation::Default)
if (deselect && Designations::unmarkPlant(plant))
{
cur->designation[x][y].bits.dig = tile_dig_designation::No;
dirty = true;
++count;
}
if (!deselect && cur->designation[x][y].bits.dig == tile_dig_designation::No)
if (!deselect && Designations::markPlant(plant))
{
cur->designation[x][y].bits.dig = tile_dig_designation::Default;
dirty = true;
++count;
}
if (dirty)
cur->flags.bits.designated = true;
}
if (count)
out.print("Updated %d plant designations.\n", count);