Now, will the merged stuff work?

This commit is contained in:
Jason Felds
2012-05-21 21:48:41 -04:00
3 changed files with 15 additions and 6 deletions
+12 -3
View File
@@ -2,6 +2,9 @@
--essentially a really chunky layer to make SetScore elegant(ish) --essentially a really chunky layer to make SetScore elegant(ish)
--arguments for scorekeepers: JudgmentMessageCommand,PlayerStageStats,PlayerNumber,State --arguments for scorekeepers: JudgmentMessageCommand,PlayerStageStats,PlayerNumber,State
--[[changelog --[[changelog
v1.42 21 May 2012
*Add more type checking.
*Don't crash on missing modes.
v1.41 6 May 2012 v1.41 6 May 2012
*Not really sure. *Not really sure.
*Included in SM5 for alpha 3. *Included in SM5 for alpha 3.
@@ -27,6 +30,8 @@ function GetNumReadiedScoreKeepers()
return table.itemcount(ReadiedScoreKeepers) return table.itemcount(ReadiedScoreKeepers)
end end
--InitScoreKeepers(string p1Mode, string p2Mode)
--Both are optional.
function InitScoreKeepers(p1Mode, p2Mode) function InitScoreKeepers(p1Mode, p2Mode)
local newStgK = {pcall(GameState.GetStageSeed,GAMESTATE)} local newStgK = {pcall(GameState.GetStageSeed,GAMESTATE)}
assert(newStgK[1], "it's too early to initialize the ScoreKeepers, the GameState isn't ready yet") assert(newStgK[1], "it's too early to initialize the ScoreKeepers, the GameState isn't ready yet")
@@ -34,6 +39,12 @@ function InitScoreKeepers(p1Mode, p2Mode)
Log "[InitScoreKeepers] unnecessary call" Log "[InitScoreKeepers] unnecessary call"
return true return true
end end
if p1Mode~=nil then
assert(type(p1Mode)=="string", "only pass string or nil")
end
if p2Mode~=nil then
assert(type(p2Mode)=="string", "only pass string or nil")
end
ReadiedScoreKeepers={} ReadiedScoreKeepers={}
JudgmentFilters={} JudgmentFilters={}
stageKey = newStgK stageKey = newStgK
@@ -47,9 +58,7 @@ function InitScoreKeepers(p1Mode, p2Mode)
assert(next(intab), "InitScoreKeepers didn't get any args") assert(next(intab), "InitScoreKeepers didn't get any args")
for k,v in pairs(intab) do for k,v in pairs(intab) do
if not ScoringModes[v] then if not ScoringModes[v] then
--SPOILER: UndocumentedFeature crashes the game intentionally. Warn(k.."'s scoring mode \""..v.."\" doesn't exist.")
-- UndocumentedFeature(k.."'s scoring mode \""..v.."\" doesn't exist.")
-- UndocumentedFeature(k.."'s scoring mode doesn't exist.")
else else
ReadiedScoreKeepers[k] = coroutine.create(ScoringModes[v]) ReadiedScoreKeepers[k] = coroutine.create(ScoringModes[v])
--call each scoring mode one time in init mode --call each scoring mode one time in init mode
@@ -80,8 +80,8 @@ t[#t+1] = Def.ActorFrame {
--Get scoring ready. --Get scoring ready.
if not GAMESTATE:IsCourseMode() then if not GAMESTATE:IsCourseMode() then
InitScoreKeepers( InitScoreKeepers(
GAMESTATE:IsSideJoined(PLAYER_1) and GetUserPref("UserPrefScoringMode"), GAMESTATE:IsSideJoined(PLAYER_1) and GetUserPref("UserPrefScoringMode") or nil,
GAMESTATE:IsSideJoined(PLAYER_2) and GetUserPref("UserPrefScoringMode") GAMESTATE:IsSideJoined(PLAYER_2) and GetUserPref("UserPrefScoringMode") or nil
) )
end end
+1 -1
View File
@@ -857,7 +857,7 @@ unsigned long NetworkSyncManager::GetCurrentSMBuild( LoadingWindow* ld )
const RString sHost = "aldo.mx"; const RString sHost = "aldo.mx";
const unsigned short uPort = 80; const unsigned short uPort = 80;
const RString sResource = "/stepmania/check_sm5.php"; const RString sResource = "/stepmania/check_sm5.php";
const RString sUserAgent = "StepMania AMX (+http://aldo.mx/stepmania/)"; const RString sUserAgent = PRODUCT_ID;
const RString sReferer = "http://aldo.mx/stepmania/"; const RString sReferer = "http://aldo.mx/stepmania/";
if( ld ) if( ld )