Avoid errors on loading screen when there are no saved games

This was SVN commit r10455.
This commit is contained in:
Ykkrosh 2011-10-30 00:37:00 +00:00
parent 7064565ff6
commit cf7aab4425
2 changed files with 10 additions and 2 deletions

View File

@ -21,12 +21,20 @@ function init()
{
var savedGames = Engine.GetSavedGames();
var gameSelection = getGUIObjectByName("gameSelection");
if (savedGames.length == 0)
{
gameSelection.list = [ "No saved games found" ];
getGUIObjectByName("loadGameButton").enabled = false;
return;
}
savedGames.sort(sortDecreasingDate);
var gameListIDs = [ game.id for each (game in savedGames) ];
var gameListLabels = [ generateLabel(game.metadata) for each (game in savedGames) ];
var gameSelection = getGUIObjectByName("gameSelection");
gameSelection.list = gameListLabels;
gameSelection.list_data = gameListIDs;
gameSelection.selected = 0;

View File

@ -19,7 +19,7 @@
size="24 24 100%-24 100%-100">
</object>
<object type="button" size="50%-144 100%-60 50%-16 100%-32" style="StoneButton">
<object name="loadGameButton" type="button" size="50%-144 100%-60 50%-16 100%-32" style="StoneButton">
Load Game
<action on="Press">loadGame();</action>
</object>