Hola, estoy intentado que el programa pueda grabar partidas con una GUI. He hecho el menú, pero resulta que no me graba el archivo. No sé que estoy haciendo mal, alguien puede ayudarme?
He puesto todo esto y no me funciona, agradecería mucho una respuesta, soy principiante.
Gracias
function btnConfirmSave_OnClick(GUIControl *control, MouseButton button)
{
int totalSaves = lstSaveGames.ItemCount; //number of saves on list
String saveName = txtSaveName.Text; //holds value of txtSaveName
//Check for a save name. If none, tell them. Else, go on.
if(saveName == "")
{
Display("Please enter a name for your saved game.");
return;
}
//If there is no saved games yet, just save it.
if(lstSaveGames.SelectedIndex == -1)
{
gSavegame.Visible = false;
SaveGameSlot(totalSaves+1, saveName);
}
else
{
int checkSave = 0; //runs through the list and checks for double entries
while(checkSave != totalSaves)
{
if(saveName == lstSaveGames.Items[checkSave]) // one matches, so overwrite it.
{
//if so, overwrite the selected save game
gSavegame.Visible = false;
SaveGameSlot(savegameindex[checkSave], saveName);
return;
}
checkSave++;
}
//if we've made it here, then there is no match; just save to a new slot.
if(totalSaves < 20)
{
gSavegame.Visible = false;
SaveGameSlot(totalSaves+1, saveName);
}
else
{
Display("The maximum number of saved games has been reached; overwrite or delete some old ones.");
}
}
}
He puesto todo esto y no me funciona, agradecería mucho una respuesta, soy principiante.
Gracias
function btnConfirmSave_OnClick(GUIControl *control, MouseButton button)
{
int totalSaves = lstSaveGames.ItemCount; //number of saves on list
String saveName = txtSaveName.Text; //holds value of txtSaveName
//Check for a save name. If none, tell them. Else, go on.
if(saveName == "")
{
Display("Please enter a name for your saved game.");
return;
}
//If there is no saved games yet, just save it.
if(lstSaveGames.SelectedIndex == -1)
{
gSavegame.Visible = false;
SaveGameSlot(totalSaves+1, saveName);
}
else
{
int checkSave = 0; //runs through the list and checks for double entries
while(checkSave != totalSaves)
{
if(saveName == lstSaveGames.Items[checkSave]) // one matches, so overwrite it.
{
//if so, overwrite the selected save game
gSavegame.Visible = false;
SaveGameSlot(savegameindex[checkSave], saveName);
return;
}
checkSave++;
}
//if we've made it here, then there is no match; just save to a new slot.
if(totalSaves < 20)
{
gSavegame.Visible = false;
SaveGameSlot(totalSaves+1, saveName);
}
else
{
Display("The maximum number of saved games has been reached; overwrite or delete some old ones.");
}
}
}