Anahkiasen/cookie-monster — pull request #49 by Qhorin (2014-04-24 17:09:02+00:00)
Title: Fixes issue #31 - Two season upgrades not being removed from store

This should resolve #31

Two Christmas upgrades were not being removed from the store after being clicked/purchased. They differ from other upgrades because they trigger a store Refresh (which is usually triggered by building purchases).
The upgrades 'Season savings' and 'Santa's dominion' reduce building costs and trigger a store Refresh which triggers CookieMonster simulateBuy() before Cookie Clicker code has removed the upgrade from the store. The simulateBuy() resets the upgrade's bought variable back to 0 so it stays in the store when upgrades are rebuilt.

To fix, I added a check in the isInStore() function to see if upgrade bought variable === 1. This prevents the simulateBuy() from executing for this upgrade (and some other functions in the stack that seems to be unnecessary for purchased upgrades e.g. tooltips).