From 380977f7661119316247abe75fc8c24da8ff203a Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Mon, 20 Jun 2016 10:47:15 -0700 Subject: [PATCH] Fix #3744: course levels work with no hero selected --- app/lib/LevelLoader.coffee | 7 +++---- app/lib/world/world.coffee | 2 +- app/models/Level.coffee | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/lib/LevelLoader.coffee b/app/lib/LevelLoader.coffee index cbf7bc450..b277030e5 100644 --- a/app/lib/LevelLoader.coffee +++ b/app/lib/LevelLoader.coffee @@ -173,10 +173,9 @@ module.exports = class LevelLoader extends CocoClass else if session is @opponentSession @consolidateFlagHistory() if @session.loaded if @level.get('type', true) in ['course'] # course-ladder is hard to handle because there's 2 sessions - heroConfig = me.get('heroConfig') - console.log "Course mode, loading custom hero: ", heroConfig if LOG - return if not heroConfig - url = "/db/thang.type/#{heroConfig.thangType}/version" + heroThangType = me.get('heroConfig')?.thangType or ThangType.heroes.captain + console.log "Course mode, loading custom hero: ", heroThangType if LOG + url = "/db/thang.type/#{heroThangType}/version" if heroResource = @maybeLoadURL(url, ThangType, 'thang') console.log "Pushing resource: ", heroResource if LOG @worldNecessities.push heroResource diff --git a/app/lib/world/world.coffee b/app/lib/world/world.coffee index 070e9b143..af7e2b65b 100644 --- a/app/lib/world/world.coffee +++ b/app/lib/world/world.coffee @@ -166,7 +166,7 @@ module.exports = class World shouldUpdateProgress = @shouldUpdateRealTimePlayback t2 shouldDelayRealTimeSimulation = not shouldUpdateProgress and @shouldDelayRealTimeSimulation t2 else - shouldUpdateProgress = t2 - t1 > PROGRESS_UPDATE_INTERVAL + shouldUpdateProgress = t2 - t1 > PROGRESS_UPDATE_INTERVAL# and (@frames.length - @framesSerializedSoFar >= @frameRate or t2 - t1 > 1000) shouldDelayRealTimeSimulation = false return true unless shouldUpdateProgress or shouldDelayRealTimeSimulation # Stop loading frames for now; continue in a moment. diff --git a/app/models/Level.coffee b/app/models/Level.coffee index dad6f3106..13c8a66ff 100644 --- a/app/models/Level.coffee +++ b/app/models/Level.coffee @@ -147,7 +147,7 @@ module.exports = class Level extends CocoModel # Load the user's chosen hero AFTER getting stats from default char if /Hero Placeholder/.test(levelThang.id) and @get('type', true) in ['course'] - heroThangType = me.get('heroConfig')?.thangType + heroThangType = me.get('heroConfig')?.thangType or ThangType.heroes.captain levelThang.thangType = heroThangType if heroThangType sortSystems: (levelSystems, systemModels) ->