Jump to content

Bad logic in Builder:RemoveRecipe


Hornete
  • Fixed
function Builder:AddRecipe(recname)
    if not table.contains(self.recipes, recname) then
        table.insert(self.recipes, recname)
    end
    self.inst.replica.builder:AddRecipe(recname)
end

function Builder:RemoveRecipe(recname)
	if table.contains(self.recipes, recname) then
		table.remove(self.recipes, recname)
	end
	self.inst.replica.builder:RemoveRecipe(recname)
end

self.recipes is an array containing recipe names. RemoveRecipe's logic tries to use table.remove passing in the recipe name but this logic is incorrect, it should take in a proper key index.

function Builder:RemoveRecipe(recname)
	table.removearrayvalue(self.recipes, recname)
	self.inst.replica.builder:RemoveRecipe(recname)
end

table.removearrayvalue should do great instead.


Steps to Reproduce

1. See awkward RemoveRecipe logic




User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...