Merge pull request #1047 from dorkster/fixes

Abstract similar code used when loading saves or loading classes
Check for undefined tiles when validating map tiles

Fixes #1051

We were only checking for tile indexes that were out of the tileset's
bounds. This overlooked tiles that were in bounds, but had no
definition. This commit remedies that.