Fixed bug with preloading the world replacing casting the same world if timing was wrong.

This commit is contained in:
Nick Winter 2014-05-19 20:12:08 -07:00
parent 39621d5282
commit b2cc3d0692
3 changed files with 8 additions and 2 deletions

View file

@ -113,6 +113,7 @@ module.exports = class Angel extends CocoClass
@doWork()
finalizePreload: ->
@say "Finalize preload."
@worker.postMessage func: 'finalizePreload'
infinitelyLooped: =>

View file

@ -54,7 +54,7 @@ module.exports = class God extends CocoClass
@createWorld e.spells, e.preload
createWorld: (spells, preload=false) ->
console.log "#{@nick}: Let there be light upon #{@level.name}!"
console.log "#{@nick}: Let there be light upon #{@level.name}! (preload: #{preload})"
userCodeMap = @getUserCodeMap spells
# We only want one world being simulated, so we abort other angels, unless we had one preloading this very code.
@ -66,6 +66,9 @@ module.exports = class God extends CocoClass
if not hadPreloader and isPreloading
angel.finalizePreload()
hadPreloader = true
else if preload and angel.running and not angel.work.preload
# It's still running for real, so let's not preload.
return
else
angel.abort()
return if hadPreloader

View file

@ -7,7 +7,9 @@ button.btn.btn-lg.btn-block.btn-success.rank-button
span(data-i18n="ladder.rank_being_ranked").ranking.secret Game Being Ranked
if lastSubmitted
.last-submitted.secret submitted #{lastSubmitted}
.last-submitted.secret
span(data-i18n="ladder.rank_last_submitted") submitted
| #{lastSubmitted}
a(href=simulateURL, data-i18n="ladder.help_simulate").help-simulate.secret Help simulate games?