[CustomSpeedMods] If a player decides to remove 1x from the machine profile's custom speed mods, re-add it back in to avoid crashes.

This commit is contained in:
AJ Kelly
2012-05-03 20:04:49 -05:00
parent 967237d881
commit 0e867243be
2 changed files with 20 additions and 5 deletions
+2
View File
@@ -13,6 +13,8 @@ StepMania 5.0 alpha 2 | 201205??
---------- ----------
* Add Var "Player" and Var "Controller" for NoteSkin. [hanubeki] * Add Var "Player" and Var "Controller" for NoteSkin. [hanubeki]
Sourced from http://code.google.com/r/hanubeki-modified-sm-ssc/source/detail?r=824cff29912d1c29a667046ba463d195e81c524a Sourced from http://code.google.com/r/hanubeki-modified-sm-ssc/source/detail?r=824cff29912d1c29a667046ba463d195e81c524a
* [CustomSpeedMods] If a player decides to remove 1x from the machine profile's
custom speed mods, re-add it back in to avoid crashes. [AJ]
2012/05/02 2012/05/02
---------- ----------
@@ -1,9 +1,13 @@
--[[ --[[
Custom Speed Mods v2.2 (for StepMania 5) Custom Speed Mods v2.3 (for StepMania 5/SM5TE)
by AJ Kelly of KKI Labs ( http://kki.ajworld.net/ ) by AJ Kelly of KKI Labs ( http://kki.ajworld.net/ )
changelog: changelog:
v2.3 (StepMania 5 a2/SM5TE)
* If someone has decided to remove 1x from the machine profile's speed mods,
silently fix it.
v2.2 (StepMania 5 alpha 2) [by FSX] v2.2 (StepMania 5 alpha 2) [by FSX]
* Rewrite table management code. * Rewrite table management code.
* Add code to make sure that there are speed mods and that they are correct. * Add code to make sure that there are speed mods and that they are correct.
@@ -174,11 +178,20 @@ local function GetSpeedMods()
PlayerNumber_P2 = ProfileDir('ProfileSlot_Player2') PlayerNumber_P2 = ProfileDir('ProfileSlot_Player2')
} }
-- figure out how many players we have to deal with. -- if someone is trying to be "smart" and removes 1x from the machine
local numPlayers = GAMESTATE:GetNumPlayersEnabled() -- profile's custom speed mods, re-add it to prevent crashes.
local machineMods = ParseSpeedModFile(profileDirs.Machine..baseFilename)
if machineMods then
local found1X = false
for k,v in pairs(machineMods) do found1X = (v == "1x") end
if not found1X then table.insert(machineMods,"1x") end
end
-- load machine to finalMods -- load machine to finalMods
finalMods = InvertTable(ParseSpeedModFile(profileDirs.Machine..baseFilename)) finalMods = InvertTable(machineMods)
-- figure out how many players we have to deal with.
local numPlayers = GAMESTATE:GetNumPlayersEnabled()
local playerMods = {} local playerMods = {}
for pn in ivalues(GAMESTATE:GetHumanPlayers()) do for pn in ivalues(GAMESTATE:GetHumanPlayers()) do
@@ -253,7 +266,7 @@ function SpeedMods()
end end
--[[ --[[
Copyright © 2008-2011 AJ Kelly/KKI Labs. Copyright © 2008-2012 AJ Kelly/KKI Labs.
Use freely, so long this notice and the above documentation remains. Use freely, so long this notice and the above documentation remains.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"