diff --git a/CHANGELOG.md b/CHANGELOG.md index a2193d21..0a59a78f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# Version 0.12.2.1222 - 2017-11-29 + +## Fixes +- Fixed outdated save game versions crashing the game +- Fixed buttons not being set to inactive state correctly + + + + # Version 0.12.1.1218 - 2017-11-29 ## Fixes diff --git a/README.md b/README.md index 0bf79bac..da76c01a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # On The Roadside -[![Version](https://img.shields.io/badge/Version-0.12.1.1218-blue.svg)](https://github.com/rm-code/on-the-roadside/releases/latest) +[![Version](https://img.shields.io/badge/Version-0.12.2.1222-blue.svg)](https://github.com/rm-code/on-the-roadside/releases/latest) [![LOVE](https://img.shields.io/badge/L%C3%96VE-0.10.2-EA316E.svg)](http://love2d.org/) [![Build Status](https://travis-ci.com/rm-code/On-The-Roadside.svg?token=q3rLXeyGTBN9VB2zsWMr&branch=develop)](https://travis-ci.com/rm-code/On-The-Roadside) diff --git a/src/SaveHandler.lua b/src/SaveHandler.lua index e1c212d6..677f045f 100644 --- a/src/SaveHandler.lua +++ b/src/SaveHandler.lua @@ -63,7 +63,12 @@ function SaveHandler.load( path ) end function SaveHandler.loadVersion( path ) - return Compressor.load( path .. '/' .. VERSION_FILE ).version + local result, error = Compressor.load( path .. '/' .. VERSION_FILE ) + if not result then + Log.warn( error, 'SaveHandler' ) + return '' + end + return result.version end function SaveHandler.getSaveFolder() diff --git a/src/ui/elements/UIButton.lua b/src/ui/elements/UIButton.lua index 96ae884a..dd05daa9 100644 --- a/src/ui/elements/UIButton.lua +++ b/src/ui/elements/UIButton.lua @@ -41,13 +41,13 @@ end -- Public Methods -- ------------------------------------------------ -function UIButton:initialize( px, py, x, y, w, h, callback, text, alignMode, active ) +function UIButton:initialize( px, py, x, y, w, h, callback, text, alignMode ) UIElement.initialize( self, px, py, x, y, w, h ) self.callback = callback self.text = text self.alignMode = alignMode or 'center' - self.active = active or true + self.active = true end function UIButton:draw() diff --git a/src/ui/screens/SavegameScreen.lua b/src/ui/screens/SavegameScreen.lua index cc33f4ec..8437f117 100644 --- a/src/ui/screens/SavegameScreen.lua +++ b/src/ui/screens/SavegameScreen.lua @@ -111,7 +111,9 @@ function SavegameScreen.new() end end - return UIButton( lx, ly, 0, 0, BUTTON_LIST_WIDTH, 1, callback, str, 'center', version == getVersion() ) + local button = UIButton( lx, ly, 0, 0, BUTTON_LIST_WIDTH, 1, callback, str, 'center' ) + button:setActive( version == getVersion() ) + return button end diff --git a/src/util/Compressor.lua b/src/util/Compressor.lua index ebc88b19..88325bbb 100644 --- a/src/util/Compressor.lua +++ b/src/util/Compressor.lua @@ -31,6 +31,13 @@ function Compressor.load( path ) -- Decompress and return the loaded lua file. local rawstring = love.math.decompress( compressedData, 'lz4' ) + + -- Print a warning if it can't be loaded and return false. + local result, error = load( rawstring ) + if not result then + return result, error + end + return load( rawstring )() end diff --git a/version.lua b/version.lua index 611f83b4..5ac1f34f 100644 --- a/version.lua +++ b/version.lua @@ -1,8 +1,8 @@ local version = { major = 0, minor = 12, - patch = 1, - build = 1218, + patch = 2, + build = 1222, } return string.format( "%d.%d.%d.%d", version.major, version.minor, version.patch, version.build );