Kill the Kitchen module (which was never really a proper module to begin with)

develop
Quietust 2012-01-16 21:22:42 -06:00
parent a9eb555b99
commit 9d8c67b710
3 changed files with 213 additions and 266 deletions

@ -30,9 +30,9 @@ distribution.
#include "Module.h"
#include "Types.h"
#include "VersionInfo.h"
#include "modules/Materials.h"
#include "modules/Items.h"
#include "Core.h"
#include "modules/Items.h"
/**
* \defgroup grp_kitchen Kitchen settings
* @ingroup grp_modules
@ -40,6 +40,8 @@ distribution.
namespace DFHack
{
namespace Simple
{
namespace Kitchen
{
typedef uint8_t t_exclusionType;
@ -52,45 +54,33 @@ const t_itemSubtype limitSubtype = 0; // used to store limit as an entry in the
const t_exclusionType limitExclusion = 4; // used to store limit as an entry in the exclusion list
/**
* Kitchen exclusions manipulator class. Currently geared towards plants and seeds.
* @ingroup grp_kitchen
* Kitchen exclusions manipulator. Currently geared towards plants and seeds.
* \ingroup grp_modules
* \ingroup grp_kitchen
*/
class DFHACK_EXPORT Exclusions
{
public:
/// ctor
Exclusions(DFHack::Core& core_);
/// dtor
~Exclusions();
/// print the exclusion list, with the material index also translated into its token (for organics) - for debug really
void debug_print() const;
/// remove this material from the exclusion list if it is in it
void allowPlantSeedCookery(t_materialIndex materialIndex);
// print the exclusion list, with the material index also translated into its token (for organics) - for debug really
DFHACK_EXPORT void debug_print(Core &);
/// add this material to the exclusion list, if it is not already in it
void denyPlantSeedCookery(t_materialIndex materialIndex);
// remove this material from the exclusion list if it is in it
DFHACK_EXPORT void allowPlantSeedCookery(t_materialIndex materialIndex);
/// fills a map with info from the limit info storage entries in the exclusion list
void fillWatchMap(std::map<t_materialIndex, unsigned int>& watchMap) const;
// add this material to the exclusion list, if it is not already in it
DFHACK_EXPORT void denyPlantSeedCookery(t_materialIndex materialIndex);
/// removes a limit info storage entry from the exclusion list if it's present
void removeLimit(t_materialIndex materialIndex);
// fills a map with info from the limit info storage entries in the exclusion list
DFHACK_EXPORT void fillWatchMap(std::map<t_materialIndex, unsigned int>& watchMap);
/// add a limit info storage item to the exclusion list, or alters an existing one
void setLimit(t_materialIndex materialIndex, unsigned int limit);
// removes a limit info storage entry from the exclusion list if it's present
DFHACK_EXPORT void removeLimit(t_materialIndex materialIndex);
/// clears all limit info storage items from the exclusion list
void clearLimits();
// add a limit info storage item to the exclusion list, or alters an existing one
DFHACK_EXPORT void setLimit(t_materialIndex materialIndex, unsigned int limit);
/// the size of the exclusions vectors (they are all the same size - if not, there is a problem!)
std::size_t size() const;
private:
class Private;
Private* d;
};
// clears all limit info storage items from the exclusion list
DFHACK_EXPORT void clearLimits();
DFHACK_EXPORT std::size_t size();
}
}
}

@ -9,79 +9,46 @@
#include <set>
using namespace std;
#include "Types.h"
#include "VersionInfo.h"
#include "MemAccess.h"
#include "modules/Materials.h"
#include "modules/Items.h"
#include "modules/Units.h"
#include "Types.h"
#include "Error.h"
#include "modules/kitchen.h"
#include "ModuleFactory.h"
#include "Core.h"
#include "Virtual.h"
#include "df/item_type.h"
namespace DFHack
{
namespace Kitchen
{
class Exclusions::Private
{
public:
Private (DFHack::Core& core_)
: core(core_)
, itemTypes (*((std::vector<t_itemType >*)(addr(core_,0))))
, itemSubtypes (*((std::vector<t_itemSubtype >*)(addr(core_,1))))
, materialTypes (*((std::vector<t_materialType >*)(addr(core_,2))))
, materialIndices (*((std::vector<t_materialIndex>*)(addr(core_,3))))
, exclusionTypes (*((std::vector<t_exclusionType>*)(addr(core_,4))))
{
};
DFHack::Core& core;
std::vector<t_itemType>& itemTypes; // the item types vector of the kitchen exclusion list
std::vector<t_itemSubtype>& itemSubtypes; // the item subtype vector of the kitchen exclusion list
std::vector<t_materialType>& materialTypes; // the material subindex vector of the kitchen exclusion list
std::vector<t_materialIndex>& materialIndices; // the material index vector of the kitchen exclusion list
std::vector<t_exclusionType>& exclusionTypes; // the exclusion type vector of the kitchen excluions list
using namespace DFHack;
using namespace DFHack::Simple;
static void * addr(const DFHack::Core& core, int index)
{
static char * start = core.vinfo->getAddress("kitchen_limits");
return start + sizeof(std::vector<int>) * index;
};
};
#include "DataDefs.h"
#include "df/world.h"
#include "df/ui.h"
#include "df/item_type.h"
#include "df/plant_raw.h"
Exclusions::Exclusions(Core & c)
{
d = new Private(c);
};
using namespace df::enums;
using df::global::world;
using df::global::ui;
Exclusions::~Exclusions()
{
delete d;
};
void Exclusions::debug_print() const
{
d->core.con.print("Kitchen Exclusions\n");
Materials& materialsModule= *d->core.getMaterials();
void Kitchen::debug_print(Core &core)
{
core.con.print("Kitchen Exclusions\n");
for(std::size_t i = 0; i < size(); ++i)
{
d->core.con.print("%2u: IT:%2i IS:%i MT:%3i MI:%2i ET:%i %s\n",
core.con.print("%2u: IT:%2i IS:%i MT:%3i MI:%2i ET:%i %s\n",
i,
d->itemTypes[i],
d->itemSubtypes[i],
d->materialTypes[i],
d->materialIndices[i],
d->exclusionTypes[i],
materialsModule.df_organic->at(d->materialIndices[i])->ID.c_str()
ui->kitchen.item_types[i],
ui->kitchen.item_subtypes[i],
ui->kitchen.mat_types[i],
ui->kitchen.mat_indices[i],
ui->kitchen.exc_types[i],
(ui->kitchen.mat_types[i] >= 419 && ui->kitchen.mat_types[i] <= 618) ? world->raws.plants.all[ui->kitchen.mat_indices[i]]->id.c_str() : "n/a"
);
}
d->core.con.print("\n");
}
core.con.print("\n");
}
void Exclusions::allowPlantSeedCookery(t_materialIndex materialIndex)
{
void Kitchen::allowPlantSeedCookery(t_materialIndex materialIndex)
{
bool match = false;
do
{
@ -89,9 +56,9 @@ namespace Kitchen
std::size_t matchIndex = 0;
for(std::size_t i = 0; i < size(); ++i)
{
if(d->materialIndices[i] == materialIndex
&& (d->itemTypes[i] == df::item_type::SEEDS || d->itemTypes[i] == df::item_type::PLANT)
&& d->exclusionTypes[i] == cookingExclusion
if(ui->kitchen.mat_indices[i] == materialIndex
&& (ui->kitchen.item_types[i] == df::item_type::SEEDS || ui->kitchen.item_types[i] == df::item_type::PLANT)
&& ui->kitchen.exc_types[i] == cookingExclusion
)
{
match = true;
@ -100,64 +67,63 @@ namespace Kitchen
}
if(match)
{
d->itemTypes.erase(d->itemTypes.begin() + matchIndex);
d->itemSubtypes.erase(d->itemSubtypes.begin() + matchIndex);
d->materialIndices.erase(d->materialIndices.begin() + matchIndex);
d->materialTypes.erase(d->materialTypes.begin() + matchIndex);
d->exclusionTypes.erase(d->exclusionTypes.begin() + matchIndex);
ui->kitchen.item_types.erase(ui->kitchen.item_types.begin() + matchIndex);
ui->kitchen.item_subtypes.erase(ui->kitchen.item_subtypes.begin() + matchIndex);
ui->kitchen.mat_indices.erase(ui->kitchen.mat_indices.begin() + matchIndex);
ui->kitchen.mat_types.erase(ui->kitchen.mat_types.begin() + matchIndex);
ui->kitchen.exc_types.erase(ui->kitchen.exc_types.begin() + matchIndex);
}
} while(match);
};
};
void Exclusions::denyPlantSeedCookery(t_materialIndex materialIndex)
{
Materials *mats = d->core.getMaterials();
df_plant_type *type = mats->df_organic->at(materialIndex);
void Kitchen::denyPlantSeedCookery(t_materialIndex materialIndex)
{
df::plant_raw *type = world->raws.plants.all[materialIndex];
bool SeedAlreadyIn = false;
bool PlantAlreadyIn = false;
for(std::size_t i = 0; i < size(); ++i)
{
if(d->materialIndices[i] == materialIndex
&& d->exclusionTypes[i] == cookingExclusion)
if(ui->kitchen.mat_indices[i] == materialIndex
&& ui->kitchen.exc_types[i] == cookingExclusion)
{
if(d->itemTypes[i] == df::item_type::SEEDS)
if(ui->kitchen.item_types[i] == df::item_type::SEEDS)
SeedAlreadyIn = true;
else if (d->itemTypes[i] == df::item_type::PLANT)
else if (ui->kitchen.item_types[i] == df::item_type::PLANT)
PlantAlreadyIn = true;
}
}
if(!SeedAlreadyIn)
{
d->itemTypes.push_back(df::item_type::SEEDS);
d->itemSubtypes.push_back(organicSubtype);
d->materialTypes.push_back(type->material_type_seed);
d->materialIndices.push_back(materialIndex);
d->exclusionTypes.push_back(cookingExclusion);
ui->kitchen.item_types.push_back(df::item_type::SEEDS);
ui->kitchen.item_subtypes.push_back(organicSubtype);
ui->kitchen.mat_types.push_back(type->material_defs.type_seed);
ui->kitchen.mat_indices.push_back(materialIndex);
ui->kitchen.exc_types.push_back(cookingExclusion);
}
if(!PlantAlreadyIn)
{
d->itemTypes.push_back(df::item_type::PLANT);
d->itemSubtypes.push_back(organicSubtype);
d->materialTypes.push_back(type->material_type_basic_mat);
d->materialIndices.push_back(materialIndex);
d->exclusionTypes.push_back(cookingExclusion);
ui->kitchen.item_types.push_back(df::item_type::PLANT);
ui->kitchen.item_subtypes.push_back(organicSubtype);
ui->kitchen.mat_types.push_back(type->material_defs.type_basic_mat);
ui->kitchen.mat_indices.push_back(materialIndex);
ui->kitchen.exc_types.push_back(cookingExclusion);
}
};
};
void Exclusions::fillWatchMap(std::map<t_materialIndex, unsigned int>& watchMap) const
{
void Kitchen::fillWatchMap(std::map<t_materialIndex, unsigned int>& watchMap)
{
watchMap.clear();
for(std::size_t i = 0; i < size(); ++i)
{
if(d->itemTypes[i] == limitType && d->itemSubtypes[i] == limitSubtype && d->exclusionTypes[i] == limitExclusion)
if(ui->kitchen.item_subtypes[i] == limitType && ui->kitchen.item_subtypes[i] == limitSubtype && ui->kitchen.exc_types[i] == limitExclusion)
{
watchMap[d->materialIndices[i]] = (unsigned int) d->materialTypes[i];
watchMap[ui->kitchen.mat_indices[i]] = (unsigned int) ui->kitchen.mat_types[i];
}
}
};
};
void Exclusions::removeLimit(t_materialIndex materialIndex)
{
void Kitchen::removeLimit(t_materialIndex materialIndex)
{
bool match = false;
do
{
@ -165,10 +131,10 @@ namespace Kitchen
std::size_t matchIndex = 0;
for(std::size_t i = 0; i < size(); ++i)
{
if(d->itemTypes[i] == limitType
&& d->itemSubtypes[i] == limitSubtype
&& d->materialIndices[i] == materialIndex
&& d->exclusionTypes[i] == limitExclusion)
if(ui->kitchen.item_types[i] == limitType
&& ui->kitchen.item_subtypes[i] == limitSubtype
&& ui->kitchen.mat_indices[i] == materialIndex
&& ui->kitchen.exc_types[i] == limitExclusion)
{
match = true;
matchIndex = i;
@ -176,31 +142,31 @@ namespace Kitchen
}
if(match)
{
d->itemTypes.erase(d->itemTypes.begin() + matchIndex);
d->itemSubtypes.erase(d->itemSubtypes.begin() + matchIndex);
d->materialTypes.erase(d->materialTypes.begin() + matchIndex);
d->materialIndices.erase(d->materialIndices.begin() + matchIndex);
d->exclusionTypes.erase(d->exclusionTypes.begin() + matchIndex);
ui->kitchen.item_types.erase(ui->kitchen.item_types.begin() + matchIndex);
ui->kitchen.item_subtypes.erase(ui->kitchen.item_subtypes.begin() + matchIndex);
ui->kitchen.mat_types.erase(ui->kitchen.mat_types.begin() + matchIndex);
ui->kitchen.mat_indices.erase(ui->kitchen.mat_indices.begin() + matchIndex);
ui->kitchen.exc_types.erase(ui->kitchen.exc_types.begin() + matchIndex);
}
} while(match);
};
};
void Exclusions::setLimit(t_materialIndex materialIndex, unsigned int limit)
{
void Kitchen::setLimit(t_materialIndex materialIndex, unsigned int limit)
{
removeLimit(materialIndex);
if(limit > seedLimit)
{
limit = seedLimit;
}
d->itemTypes.push_back(limitType);
d->itemSubtypes.push_back(limitSubtype);
d->materialIndices.push_back(materialIndex);
d->materialTypes.push_back((t_materialType) (limit < seedLimit) ? limit : seedLimit);
d->exclusionTypes.push_back(limitExclusion);
};
ui->kitchen.item_types.push_back(limitType);
ui->kitchen.item_subtypes.push_back(limitSubtype);
ui->kitchen.mat_indices.push_back(materialIndex);
ui->kitchen.mat_types.push_back((t_materialType) (limit < seedLimit) ? limit : seedLimit);
ui->kitchen.exc_types.push_back(limitExclusion);
};
void Exclusions::clearLimits()
{
void Kitchen::clearLimits()
{
bool match = false;
do
{
@ -208,9 +174,9 @@ namespace Kitchen
std::size_t matchIndex;
for(std::size_t i = 0; i < size(); ++i)
{
if(d->itemTypes[i] == limitType
&& d->itemSubtypes[i] == limitSubtype
&& d->exclusionTypes[i] == limitExclusion)
if(ui->kitchen.item_types[i] == limitType
&& ui->kitchen.item_subtypes[i] == limitSubtype
&& ui->kitchen.exc_types[i] == limitExclusion)
{
match = true;
matchIndex = i;
@ -218,17 +184,16 @@ namespace Kitchen
}
if(match)
{
d->itemTypes.erase(d->itemTypes.begin() + matchIndex);
d->itemSubtypes.erase(d->itemSubtypes.begin() + matchIndex);
d->materialIndices.erase(d->materialIndices.begin() + matchIndex);
d->materialTypes.erase(d->materialTypes.begin() + matchIndex);
d->exclusionTypes.erase(d->exclusionTypes.begin() + matchIndex);
ui->kitchen.item_types.erase(ui->kitchen.item_types.begin() + matchIndex);
ui->kitchen.item_subtypes.erase(ui->kitchen.item_subtypes.begin() + matchIndex);
ui->kitchen.mat_indices.erase(ui->kitchen.mat_indices.begin() + matchIndex);
ui->kitchen.mat_types.erase(ui->kitchen.mat_types.begin() + matchIndex);
ui->kitchen.exc_types.erase(ui->kitchen.exc_types.begin() + matchIndex);
}
} while(match);
};
size_t Exclusions::size() const
{
return d->itemTypes.size();
};
}
};
size_t Kitchen::size()
{
return ui->kitchen.item_types.size();
};

@ -8,15 +8,14 @@
#include "Core.h"
#include "Export.h"
#include "PluginManager.h"
#include "modules/Materials.h"
#include "modules/Items.h"
#include "modules/World.h"
#include "modules/kitchen.h"
#include "VersionInfo.h"
#include "df/item_flags.h"
using DFHack::t_materialType;
using DFHack::t_materialIndex;
using namespace DFHack;
using namespace DFHack::Simple;
const int buffer = 20; // seed number buffer - 20 is reasonable
bool running = false; // whether seedwatch is counting the seeds or not
@ -39,7 +38,7 @@ bool ignoreSeeds(df::item_flags& f) // seeds with the following flags should not
f.bits.in_job;
};
void printHelp(DFHack::Core& core) // prints help
void printHelp(Core& core) // prints help
{
core.con.print(
"Watches the numbers of seeds available and enables/disables seed and plant cooking.\n"
@ -93,17 +92,17 @@ std::string searchAbbreviations(std::string in)
}
};
DFhackCExport DFHack::command_result df_seedwatch(DFHack::Core* pCore, std::vector<std::string>& parameters)
DFhackCExport command_result df_seedwatch(Core* pCore, std::vector<std::string>& parameters)
{
DFHack::Core& core = *pCore;
Core& core = *pCore;
if(!core.isValid())
{
return DFHack::CR_FAILURE;
return CR_FAILURE;
}
core.Suspend();
DFHack::Materials& materialsModule = *core.getMaterials();
std::vector<DFHack::t_matgloss> organics;
Materials& materialsModule = *core.getMaterials();
std::vector<t_matgloss> organics;
materialsModule.CopyOrganicMaterials(organics);
std::map<std::string, t_materialIndex> materialsReverser;
@ -112,17 +111,17 @@ DFhackCExport DFHack::command_result df_seedwatch(DFHack::Core* pCore, std::vect
materialsReverser[organics[i].id] = i;
}
DFHack::World *w = core.getWorld();
DFHack::t_gamemodes gm;
World *w = core.getWorld();
t_gamemodes gm;
w->ReadGameMode(gm);// FIXME: check return value
// if game mode isn't fortress mode
if(gm.g_mode != DFHack::GAMEMODE_DWARF || gm.g_type != DFHack::GAMETYPE_DWARF_MAIN)
if(gm.g_mode != GAMEMODE_DWARF || gm.g_type != GAMETYPE_DWARF_MAIN)
{
// just print the help
printHelp(core);
core.Resume();
return DFHack::CR_OK;
return CR_OK;
}
std::string par;
@ -148,8 +147,7 @@ DFhackCExport DFHack::command_result df_seedwatch(DFHack::Core* pCore, std::vect
}
else if(par == "clear")
{
DFHack::Kitchen::Exclusions kitchenExclusions(core);
kitchenExclusions.clearLimits();
Kitchen::clearLimits();
core.con.print("seedwatch watchlist cleared\n");
}
else if(par == "info")
@ -163,9 +161,8 @@ DFhackCExport DFHack::command_result df_seedwatch(DFHack::Core* pCore, std::vect
{
core.con.print("seedwatch is not supervising. Use 'seedwatch start' to start supervision.\n");
}
DFHack::Kitchen::Exclusions kitchenExclusions(core);
std::map<t_materialIndex, unsigned int> watchMap;
kitchenExclusions.fillWatchMap(watchMap);
Kitchen::fillWatchMap(watchMap);
if(watchMap.empty())
{
core.con.print("The watch list is empty.\n");
@ -181,10 +178,9 @@ DFhackCExport DFHack::command_result df_seedwatch(DFHack::Core* pCore, std::vect
}
else if(par == "debug")
{
DFHack::Kitchen::Exclusions kitchenExclusions(core);
std::map<t_materialIndex, unsigned int> watchMap;
kitchenExclusions.fillWatchMap(watchMap);
kitchenExclusions.debug_print();
Kitchen::fillWatchMap(watchMap);
Kitchen::debug_print(core);
}
/*
else if(par == "dumpmaps")
@ -209,8 +205,7 @@ DFhackCExport DFHack::command_result df_seedwatch(DFHack::Core* pCore, std::vect
std::string token = searchAbbreviations(par);
if(materialsReverser.count(token) > 0)
{
DFHack::Kitchen::Exclusions kitchenExclusions(core);
kitchenExclusions.removeLimit(materialsReverser[token]);
Kitchen::removeLimit(materialsReverser[token]);
core.con.print("%s is not being watched\n", token.c_str());
}
else
@ -226,8 +221,7 @@ DFhackCExport DFHack::command_result df_seedwatch(DFHack::Core* pCore, std::vect
{
for(std::map<std::string, std::string>::const_iterator i = abbreviations.begin(); i != abbreviations.end(); ++i)
{
DFHack::Kitchen::Exclusions kitchenExclusions(core);
if(materialsReverser.count(i->second) > 0) kitchenExclusions.setLimit(materialsReverser[i->second], limit);
if(materialsReverser.count(i->second) > 0) Kitchen::setLimit(materialsReverser[i->second], limit);
}
}
else
@ -235,8 +229,7 @@ DFhackCExport DFHack::command_result df_seedwatch(DFHack::Core* pCore, std::vect
std::string token = searchAbbreviations(parameters[0]);
if(materialsReverser.count(token) > 0)
{
DFHack::Kitchen::Exclusions kitchenExclusions(core);
kitchenExclusions.setLimit(materialsReverser[token], limit);
Kitchen::setLimit(materialsReverser[token], limit);
core.con.print("%s is being watched.\n", token.c_str());
}
else
@ -251,7 +244,7 @@ DFhackCExport DFHack::command_result df_seedwatch(DFHack::Core* pCore, std::vect
}
core.Resume();
return DFHack::CR_OK;
return CR_OK;
}
DFhackCExport const char* plugin_name(void)
@ -259,10 +252,10 @@ DFhackCExport const char* plugin_name(void)
return "seedwatch";
}
DFhackCExport DFHack::command_result plugin_init(DFHack::Core* pCore, std::vector<DFHack::PluginCommand>& commands)
DFhackCExport command_result plugin_init(Core* pCore, std::vector<PluginCommand>& commands)
{
commands.clear();
commands.push_back(DFHack::PluginCommand("seedwatch", "Switches cookery based on quantity of seeds, to keep reserves", df_seedwatch));
commands.push_back(PluginCommand("seedwatch", "Switches cookery based on quantity of seeds, to keep reserves", df_seedwatch));
// fill in the abbreviations map, with abbreviations for the standard plants
abbreviations["bs"] = "SLIVER_BARB";
abbreviations["bt"] = "TUBER_BLOATED";
@ -285,14 +278,14 @@ DFhackCExport DFHack::command_result plugin_init(DFHack::Core* pCore, std::vecto
abbreviations["vh"] = "HERB_VALLEY";
abbreviations["ws"] = "BERRIES_STRAW_WILD";
abbreviations["wv"] = "VINE_WHIP";
return DFHack::CR_OK;
return CR_OK;
}
DFhackCExport DFHack::command_result plugin_onstatechange(DFHack::Core* pCore, DFHack::state_change_event event)
DFhackCExport command_result plugin_onstatechange(Core* pCore, state_change_event event)
{
switch (event) {
case DFHack::SC_GAME_LOADED:
case DFHack::SC_GAME_UNLOADED:
case SC_GAME_LOADED:
case SC_GAME_UNLOADED:
if (running)
pCore->con.printerr("seedwatch deactivated due to game load/unload\n");
running = false;
@ -301,34 +294,34 @@ DFhackCExport DFHack::command_result plugin_onstatechange(DFHack::Core* pCore, D
break;
}
return DFHack::CR_OK;
return CR_OK;
}
DFhackCExport DFHack::command_result plugin_onupdate(DFHack::Core* pCore)
DFhackCExport command_result plugin_onupdate(Core* pCore)
{
if (running)
{
// reduce processing rate
static int counter = 0;
if (++counter < 500)
return DFHack::CR_OK;
return CR_OK;
counter = 0;
DFHack::Core& core = *pCore;
DFHack::World *w = core.getWorld();
DFHack::t_gamemodes gm;
Core& core = *pCore;
World *w = core.getWorld();
t_gamemodes gm;
w->ReadGameMode(gm);// FIXME: check return value
// if game mode isn't fortress mode
if(gm.g_mode != DFHack::GAMEMODE_DWARF || gm.g_type != DFHack::GAMETYPE_DWARF_MAIN)
if(gm.g_mode != GAMEMODE_DWARF || gm.g_type != GAMETYPE_DWARF_MAIN)
{
// stop running.
running = false;
core.con.printerr("seedwatch deactivated due to game mode switch\n");
return DFHack::CR_OK;
return CR_OK;
}
// this is dwarf mode, continue
std::map<t_materialIndex, unsigned int> seedCount; // the number of seeds
DFHack::Items& itemsModule = *core.getItems();
Items& itemsModule = *core.getItems();
itemsModule.Start();
std::vector<df::item*> items;
itemsModule.readItemVector(items);
@ -349,25 +342,24 @@ DFhackCExport DFHack::command_result plugin_onupdate(DFHack::Core* pCore)
}
itemsModule.Finish();
DFHack::Kitchen::Exclusions kitchenExclusions(core);
std::map<t_materialIndex, unsigned int> watchMap;
kitchenExclusions.fillWatchMap(watchMap);
Kitchen::fillWatchMap(watchMap);
for(auto i = watchMap.begin(); i != watchMap.end(); ++i)
{
if(seedCount[i->first] <= i->second)
{
kitchenExclusions.denyPlantSeedCookery(i->first);
Kitchen::denyPlantSeedCookery(i->first);
}
else if(i->second + buffer < seedCount[i->first])
{
kitchenExclusions.allowPlantSeedCookery(i->first);
Kitchen::allowPlantSeedCookery(i->first);
}
}
}
return DFHack::CR_OK;
return CR_OK;
}
DFhackCExport DFHack::command_result plugin_shutdown(DFHack::Core* pCore)
DFhackCExport command_result plugin_shutdown(Core* pCore)
{
return DFHack::CR_OK;
return CR_OK;
}