Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add result for "no seed" farm zone type to avoid invalid recipe error #34890

Merged
merged 2 commits into from Oct 22, 2019
Merged

Add result for "no seed" farm zone type to avoid invalid recipe error #34890

merged 2 commits into from Oct 22, 2019

Conversation

ghost
Copy link

@ghost ghost commented Oct 20, 2019

Summary

SUMMARY: Bugfixes "Add result for "no seed" farm zone type to avoid invalid recipe error"

Purpose of change

Fixes #34780

Describe the solution

Adds an if clause if the farm zone has "no seed" type, if so, it then returns that no further work can be done there.

Describe alternatives you've considered

N/A

Testing

Before this change : create farm zone with "no seed" as the type., get an error about invalid recipe id.
After this change : the error no longer pops up.

Additional context

N/A

@@ -1489,6 +1489,11 @@ static activity_reason_info can_do_activity_there( const activity_id &act, playe
// do we have the required seed on our person?
const auto options = dynamic_cast<const plot_options &>( zone.get_options() );
const std::string seed = options.get_seed();
// If its a farm zone with no specified seed, and we've checked for tilling and harvesting.
// then it means no further work can be done here.
if( seed == "No seed" ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we check for something like itype_id( "null" ) instead of plain string?

Copy link
Author

@ghost ghost Oct 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The zone "options" are setup to store it as "No seed" which is what options.get_seed() outputs as, it dosnt output with an itype_id.

see in clzones.cpp get_seed() just returns seed which is a string of "No seed" when no seed itype has been specified, though I guess that area could be changed, to return something other than the string of the seed name/ "No seed".

std::vector<seed_tuple> seed_entries = iexamine::get_seed_entries( seed_inv ); seed_entries.emplace( seed_entries.begin(), seed_tuple( itype_id( "null" ), _( "No seed" ), 0 ) );

@ZhilkinSerg ZhilkinSerg added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Inventory / AIM / Zones Inventory, Advanced Inventory Management or Zones labels Oct 20, 2019
@ZhilkinSerg ZhilkinSerg merged commit b37e5a2 into CleverRaven:master Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Inventory / AIM / Zones Inventory, Advanced Inventory Management or Zones
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"invalid recipe id " when Farming Plots (PR 9766)
2 participants