forked from 0ad/0ad
Avoid errors on loading screen when there are no saved games
This was SVN commit r10455.
This commit is contained in:
parent
7064565ff6
commit
cf7aab4425
@ -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;
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user