Kitteh6660 / Corruption-of-Champions-Mod

CoC source from fenoxo, modded by Kitteh6660
232 stars 97 forks source link

Fixed index out of bounds when growing pig cocks ... #1331

Closed Stadler76 closed 6 years ago

Stadler76 commented 6 years ago

... and added findFirstCockNotOfType for a bit more DRY-coding

brrritssocold commented 6 years ago

Why not create a function setFirstCockNotOfType(notThisType, setToType) with a Boolean return to indicate if a update was performed or not. Or return the Type replaced (Using Undefined or a new type None (Null object) if nothing was replaced)

Stadler76 commented 6 years ago

@brrritssocold: Did you mean this?

PS: If you want to, you could write a unit test, that checks, if Pig Truffle and Boar Truffle doesn't fail for players with multi cocks. I'm not in the mood to write tests for issues that may or may not fail due to randomness. You probably have to run 10 x 10 tests or so (10x set two or more cocks to non pig cocks and then eat 10 truffles) and check if none of them errors.