Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 867da3e

Browse files
committed
tailor: fixes from testing
add missing binding for second config persistence item improve logging
1 parent 6febec7 commit 867da3e

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

plugins/tailor.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ class Tailor {
771771
else
772772
{
773773
skipped += count;
774-
INFO(cycle).print("tailor: material %s skipped due to lack of reserves, %d available\n", DF2CONSOLE(m.name).c_str(), supply[m]);
774+
DEBUG(cycle).print("tailor: material %s skipped due to lack of reserves, %d available\n", DF2CONSOLE(m.name).c_str(), supply[m]);
775775
}
776776

777777
}
@@ -786,15 +786,19 @@ class Tailor {
786786
{
787787
int available_dyes = count_dyes();
788788
int available_dyeable_cloth = count_dyeables(df::item_type::CLOTH);
789+
int dye_cloth_orders = count_dye_cloth_orders();
789790

790-
int to_dye = std::max(0, std::min(skipped, std::min(count_dyes(), available_dyeable_cloth)) - count_dye_cloth_orders());
791+
DEBUG(cycle).print("tailor: available dyes = %d, available dyeable cloth = %d, dye cloth orders = %d\n",
792+
available_dyes, available_dyeable_cloth, dye_cloth_orders);
793+
int to_dye = std::min(skipped, std::min(available_dyes, available_dyeable_cloth) - dye_cloth_orders);
794+
DEBUG(cycle).print("tailor: to dye = %d\n", to_dye);
791795
if (to_dye > 0)
792796
{
793797
INFO(cycle).print("tailor: dyeing %d cloth\n", to_dye);
794798
order_dye_cloth(to_dye);
795799
}
796800

797-
int dyes_to_make = std::max(0, skipped - available_dyes - to_dye);
801+
int dyes_to_make = available_dyes - to_dye;
798802
if (dyes_to_make > 0)
799803
{
800804
INFO(cycle).print("tailor: ordering up to %d dyes\n", dyes_to_make);
@@ -872,6 +876,7 @@ DFhackCExport command_result plugin_shutdown (color_ostream &out) {
872876
DFhackCExport command_result plugin_load_site_data (color_ostream &out) {
873877
cycle_timestamp = 0;
874878
config = World::GetPersistentSiteData(CONFIG_KEY);
879+
config2 = World::GetPersistentSiteData(CONFIG_KEY_2);
875880

876881
if (!config.isValid()) {
877882
DEBUG(control,out).print("no config found in this save; initializing\n");

0 commit comments

Comments
 (0)