Merge pull request #3031 from myk002/myk_showmood

[showmood] properly count required bars/cloth
develop
Myk 2023-03-17 07:45:02 -07:00 committed by GitHub
commit d1c27072bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 18 deletions

@ -38,6 +38,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Fixes ## Fixes
-@ `buildingplan`: items are now attached correctly to screw pumps and other multi-item buildings -@ `buildingplan`: items are now attached correctly to screw pumps and other multi-item buildings
-@ `buildingplan`: buildings with different material filters will no longer get "stuck" if one of the filters currently matches no items -@ `buildingplan`: buildings with different material filters will no longer get "stuck" if one of the filters currently matches no items
- `showmood` properly count required number of bars and cloth when they aren't the main item for the strange mood
## Misc Improvements ## Misc Improvements
-@ `buildingplan`: can now filter by clay materials -@ `buildingplan`: can now filter by clay materials
@ -49,6 +50,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `blueprint`: now writes blueprints to the ``dfhack-config/blueprints`` directory - `blueprint`: now writes blueprints to the ``dfhack-config/blueprints`` directory
- `blueprint-library-guide`: library blueprints have moved from ``blueprints`` to ``hack/data/blueprints`` - `blueprint-library-guide`: library blueprints have moved from ``blueprints`` to ``hack/data/blueprints``
- player-created blueprints should now go in the ``dfhack-config/blueprints`` folder. please move your existing blueprints from ``blueprints`` to ``dfhack-config/blueprints``. you don't need to move the library blueprints -- those can be safely deleted from the old ``blueprints`` directory. - player-created blueprints should now go in the ``dfhack-config/blueprints`` folder. please move your existing blueprints from ``blueprints`` to ``dfhack-config/blueprints``. you don't need to move the library blueprints -- those can be safely deleted from the old ``blueprints`` directory.
-@ `showmood`: clarify how many bars and/or cloth items are actually needed for the mood
## Documentation ## Documentation

@ -275,29 +275,17 @@ command_result df_showmood (color_ostream &out, vector <string> & parameters)
// count how many items of this type the crafter already collected // count how many items of this type the crafter already collected
{ {
int count_got = 0; int count_got = 0;
int dimension_got = 0;
int divisor = 1; int divisor = 1;
bool has_dims = false; if (item->item_type == item_type::BAR)
if (item->item_type == item_type::BAR) {
divisor = 150; divisor = 150;
has_dims = true; else if (item->item_type == item_type::CLOTH)
} else if (item->item_type == item_type::CLOTH) {
divisor = 10000; divisor = 10000;
has_dims = true; for (size_t j = 0; j < job->items.size(); j++) {
}
for (size_t j = 0; j < job->items.size(); j++)
{
if (job->items[j]->job_item_idx == int32_t(i)) if (job->items[j]->job_item_idx == int32_t(i))
{
if (has_dims)
dimension_got += job->items[j]->item->getTotalDimension();
count_got += 1; count_got += 1;
} }
} out.print(", got %i of %i\n", count_got,
out.print(", got %i of %i", count_got, item->quantity/divisor); item->quantity < divisor ? item->quantity : item->quantity/divisor);
if (has_dims)
out.print(" (%i of %i sub-units)", dimension_got, item->quantity);
out.print("\n");
} }
} }
} }