Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upBatchCraft #8808
Conversation
This comment has been minimized.
This comment has been minimized.
|
Seems like you've got some unused parameters present, but if you fix them (and this works, obviously) then I'm behind this totally. Batch crafting would be awesome. |
This comment has been minimized.
This comment has been minimized.
|
Yes! I like the sound of this a lot. |
This comment has been minimized.
This comment has been minimized.
|
Working on these usused params, will have to break some template methods to avoid them. |
This comment has been minimized.
This comment has been minimized.
|
Couldn't you just (void) them in the function? That works to suppress that particular warning without needing to break the template apart for everything else. |
This comment has been minimized.
This comment has been minimized.
|
One last thing: make a note in the UI that pressing Batch again will cancel out of batch selection, please? Explanations of new features make good additions great! |
This comment has been minimized.
This comment has been minimized.
|
Done. In case of bugs, I will swat them tomorrow. Need some sleeping :) |
This comment has been minimized.
This comment has been minimized.
|
Schlaf gut. Since this is a great place for new bugs to crop up, gonna merge it separately. |
kevingranade
added
the
in progress
label
Sep 4, 2014
This comment has been minimized.
This comment has been minimized.
|
YEEAH! |
KA101
self-assigned this
Sep 4, 2014
kevingranade
reviewed
Sep 5, 2014
| @@ -265,7 +269,7 @@ bool game::check_eligible_containers_for_crafting(recipe *making) | |||
| // we go trough empty containers if we need | |||
| if (charges_to_store > 0) { | |||
| std::vector<item>::iterator iter; | |||
| for(iter = conts.begin(); iter != conts.end(); ++iter) { | |||
| for(iter = conts.begin(); iter != conts.end();) { | |||
| if (iter->is_container_empty()) { | |||
This comment has been minimized.
This comment has been minimized.
kevingranade
Sep 5, 2014
Member
Looks like this was broken before, but this doesn't fix it. What you want is something like:
for( iter = conts.begin(); iter != conts.end() ) {
if( iter->is_container_empty ) {
// Do stuff
iter = conts.erase( iter );
} else {
iter++;
}
}
This comment has been minimized.
This comment has been minimized.
Robik81
Sep 5, 2014
Author
Contributor
I will check it out. While I was debugging it, it seemed to work just fine. It did not end in endless loop or something.
kevingranade
reviewed
Sep 5, 2014
| @@ -689,6 +716,19 @@ recipe *game::select_crafting_recipe() | |||
| } else if (action == "RESET_FILTER") { | |||
| filterstring = ""; | |||
| redraw = true; | |||
| } else if (action == "CYCLE_BATCH") { | |||
| if (current[line]->reversible) { | |||
| popup(_("Batch crafting is not available for reversible items!")); | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Robik81
Sep 5, 2014
Author
Contributor
Mostly because it is paint in the ass to implement and it is fringe case. In function
void game::complete_craft()
calling consume_items(&u, *it, making->batch); returns list of used component, which is later used to populate component list in reversible items. Problem is, that in batch crafting, the consumed list is populated with all component for entire batch, which I cannot add to each result, obviously. And while I was thinking about how to separate it, I got a headache from it.
So, I thought that as long as I disable batch craft for these cases, it can be implemented later - if ever, to be honest. Reversible items are not typical examples of items you need to craft in bulk anyway.
KA101
removed their assignment
Sep 5, 2014
This comment has been minimized.
This comment has been minimized.
|
Didn't have the time to give this the attention it needs, but fortunately Kevin's on the case. Thanks, Kevin. |
This comment has been minimized.
This comment has been minimized.
|
Depending on your containers, that code could indeed end in infinite loop. Thanks for catching it, Kevin. Question: |
This comment has been minimized.
This comment has been minimized.
|
No, that's an ok reason to put that off, and the error should result in |
This comment has been minimized.
This comment has been minimized.
|
So this could get merged in, and reversible items could get added by another PR? |
Robik81 commentedSep 3, 2014
Adds feature of batch crafting into crafting menu.
open craft menu and select recipe

press [b]atch to generate batch screen for selected recipe

either select one of batch recipes, or return to previous screen by pressing [b]atch again