Yeah, I was going to split them up after you'd had a look at it, and that
commented out section causes a loop which kills the browser; I forgot to
remove it. I'll get on that this afternoon.


On Fri, Nov 1, 2013 at 1:10 AM, Michael Townsend
<notifications@github.com>wrote:

> In script/prestige.js:
>
> > @@ -8,56 +8,64 @@ var Prestige = {
> >  		this.options = $.extend(this.options, options);
> >  	},
> >
> > -	save: function() {
> > +	saveStores: function(saveBool) {
>
> This function does too many things, I think. It's used to gather stores to
> feed into the calculateScore function, generate the collection of stores to
> persist for prestige, AND actually save the prestige stores to the
> GameState. It would probably make more sense to break it into three
> seperate functions and get rid of the saveBool parameter.
>
> Here's how I would architect it:
> 1. a gatherStores() function would grab the necessary values from the
> GameState and populate and return a stores object
> 2. a createPrestigeStores() function would take the stores object from
> gatherStores() and divide by the results of randGen
> 3. Space's complete callback could then call gatherStores(), pass it into
> createPrestigeStores() and then save it to the StateManager. No saving
> would occur in gatherStores().
> 4. calculateScore() would call gatherStores() and use that to add up a
> score value, just like it does now. It just wouldn't need to worry about
> passing a parameter to prevent dividing and saving.
>
> This keeps the purpose of each function singular and obvious, and removes
> the necessity for the saveBool parameter in both saveStores() and randGen.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/Continuities/adarkroom/pull/59/files#r7342270>
> .
>