From ea22a23ab7b8763542750194cb8934675cea3336 Mon Sep 17 00:00:00 2001 From: Rose Date: Thu, 2 Feb 2023 13:06:14 -0800 Subject: [PATCH] Clean up autoclothing for release. --- docs/changelog.txt | 2 ++ plugins/autoclothing.cpp | 35 ++++++++++++++++------------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 1174508e2..4e8af42ed 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -40,6 +40,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: -@ ``Screen``: allow `gui/launcher` and `gui/quickcmd` to launch themselves without hanging the game -@ Fix issues with clicks "passing through" some DFHack window elements, like scrollbars - `getplants`: tree are now designated correctly +- `autoclothing`: fixed a crash that can happen when units are holding invalid items. ## Misc Improvements - A new cross-compile build script was added for building the Windows files from a Linux Docker builder (see the Compile instructions in the docs) @@ -52,6 +53,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - `overlay`: overlay widgets can now specify a default enabled state if they are not already set in the player's overlay config file - `getplants`: ID values will now be accepted regardless of case -@ New borders for DFHack tool windows -- tell us what you think! +- `autoclothing`: merged the two separate reports into the same command. ## Documentation diff --git a/plugins/autoclothing.cpp b/plugins/autoclothing.cpp index d7dee23ad..4aa835b8b 100644 --- a/plugins/autoclothing.cpp +++ b/plugins/autoclothing.cpp @@ -388,33 +388,30 @@ command_result autoclothing(color_ostream &out, vector & parameters) // be used by 'help your-command'. if (parameters.size() == 0) { + CoreSuspender suspend; out << "Currently set " << clothingOrders.size() << " automatic clothing orders" << endl; for (size_t i = 0; i < clothingOrders.size(); i++) { out << clothingOrders[i].ToReadableLabel() << endl; } - return CR_OK; - } - else if (parameters[0] == "strictness") - { - if (parameters.size() != 2) - { - out << "Wrong number of arguments." << endl; - return CR_WRONG_USAGE; - } - if (parameters[1] == "permissive") - strictnessSetting = STRICT_PERMISSIVE; - else if (parameters[1] == "type") - strictnessSetting = STRICT_TYPE; - else if (parameters[1] == "material") - strictnessSetting = STRICT_MATERIAL; - } - else if (parameters.size() == 1 && parameters[0] == "report") - { - CoreSuspender suspend; generate_report(out); return CR_OK; } + ////Disabled until I have time to fully implement it. + //else if (parameters[0] == "strictness") + //{ + // if (parameters.size() != 2) + // { + // out << "Wrong number of arguments." << endl; + // return CR_WRONG_USAGE; + // } + // if (parameters[1] == "permissive") + // strictnessSetting = STRICT_PERMISSIVE; + // else if (parameters[1] == "type") + // strictnessSetting = STRICT_TYPE; + // else if (parameters[1] == "material") + // strictnessSetting = STRICT_MATERIAL; + //} else if (parameters.size() < 2 || parameters.size() > 3) { out << "Wrong number of arguments." << endl;