Skip to content

Commit ac0b69e

Browse files
committed
Fix crash when creating a save game
This was caused by broken serialization functions which have been introduced by the big refactor from closure based oop to middleclass. Fixes #225.
1 parent e8834d8 commit ac0b69e

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/items/weapons/RangedWeapon.lua

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,10 @@ function RangedWeapon:attack()
3333
end
3434

3535
function RangedWeapon:serialize()
36-
local t = {
37-
['id'] = self.template.id,
38-
['itemType'] = self.template.itemType,
39-
['modeIndex'] = self:getAttackModeIndex()
40-
}
41-
36+
local t = RangedWeapon.super.serialize( self )
4237
if self.magazine then
4338
t['magazine'] = self.magazine:serialize()
4439
end
45-
4640
return t
4741
end
4842

src/items/weapons/Weapon.lua

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,8 @@ function Weapon:selectPrevFiringMode()
4242
end
4343

4444
function Weapon:serialize()
45-
local t = {
46-
['id'] = self.id,
47-
['itemType'] = self.itemType,
48-
['modeIndex'] = self.modeIndex
49-
}
45+
local t = Weapon.super.serialize( self )
46+
t['modeIndex'] = self.modeIndex
5047
return t
5148
end
5249

0 commit comments

Comments
 (0)