comparison CyborgMMO7.lua @ 36:8fc4f8a25225

Properly iterate over all modes and buttons when saving the data.
author madcatzinc@35b17cf1-18cd-47ff-9ca3-31d6b526ef09
date Thu, 25 Apr 2013 18:15:46 +0000
parents 16b2ff47b6db
children 0734b90e605a
comparison
equal deleted inserted replaced
35:16b2ff47b6db 36:8fc4f8a25225
15 --~ GNU General Public License for more details. 15 --~ GNU General Public License for more details.
16 16
17 --~ You should have received a copy of the GNU General Public License 17 --~ You should have received a copy of the GNU General Public License
18 --~ along with this program; if not, write to the Free Software 18 --~ along with this program; if not, write to the Free Software
19 --~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 --~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
21 local RAT7 = {
22 BUTTONS = 13,
23 MODES = 3,
24 SHIFT = 0,
25 }
20 26
21 function CyborgMMO_LoadStrings(self) 27 function CyborgMMO_LoadStrings(self)
22 -- CyborgMMO_DPrint("LoadStrings("..self:GetName()..") = "..CyborgMMO_StringTable[self:GetName()]) 28 -- CyborgMMO_DPrint("LoadStrings("..self:GetName()..") = "..CyborgMMO_StringTable[self:GetName()])
23 self:SetText(CyborgMMO_StringTable[self:GetName()]) 29 self:SetText(CyborgMMO_StringTable[self:GetName()])
24 end 30 end
89 end 95 end
90 96
91 function CyborgMMO_SetRatSaveData(data) 97 function CyborgMMO_SetRatSaveData(data)
92 assert(VarsLoaded) 98 assert(VarsLoaded)
93 local saveData = {} 99 local saveData = {}
94 for mode=1,#data do 100 for mode=1,RAT7.MODES do
95 saveData[mode] = {} 101 saveData[mode] = {}
96 for button=1,#data[mode] do 102 for button=1,RAT7.BUTTONS do
97 if data[mode][button] then 103 if data[mode][button] then
98 saveData[mode][button] = data[mode][button]:SaveData() 104 saveData[mode][button] = data[mode][button]:SaveData()
99 end 105 end
100 end 106 end
101 end 107 end