* Move sDelete into local scope (was only used in one function anyway)

* Move sTemp into a __more__ local scope
 * Don't strip an extension from a string we aren't going to use anyway...


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2781 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2007-11-10 16:21:26 +00:00
parent caa5e02217
commit 45ea795b10
1 changed files with 7 additions and 9 deletions

View File

@ -105,7 +105,6 @@ static UDWORD chosenSlotId;
BOOL bLoadSaveUp = FALSE; // true when interface is up and should be run.
char saveGameName[256]; //the name of the save game to load from the front end
char sRequestResult[255]; // filename returned;
char sDelete[MAX_STR_LENGTH];
BOOL bRequestLoad = FALSE;
LOADSAVE_MODE bLoadSaveMode;
@ -396,7 +395,7 @@ static BOOL _runLoadSave(BOOL bResetMissionWidgets)
{
UDWORD id=0;
W_EDBINIT sEdInit;
char sTemp[MAX_STR_LENGTH];
char sDelete[MAX_STR_LENGTH];
UDWORD i;
W_CONTEXT context;
@ -450,17 +449,14 @@ static BOOL _runLoadSave(BOOL bResetMissionWidgets)
sEdInit.pBoxDisplay = displayLoadSaveEdit;
widgAddEditBox(psRequestScreen, &sEdInit);
sprintf(sTemp,"%s%s.%s",
sPath,
((W_BUTTON *)widgGetFromID(psRequestScreen,id))->pText ,
sExt);
snprintf(sDelete, sizeof(sDelete), "%s%s.%s",
sPath,
((W_BUTTON *)widgGetFromID(psRequestScreen,id))->pText ,
sExt);
widgHide(psRequestScreen,id); // hide the old button
chosenSlotId = id;
strlcpy(sDelete, sTemp, sizeof(sDelete)); // prepare the savegame name.
sTemp[strlen(sTemp)-4] = '\0'; // strip extension
// auto click in the edit box we just made.
context.psScreen = psRequestScreen;
context.psForm = (W_FORM *)psRequestScreen->psForm;
@ -480,6 +476,8 @@ static BOOL _runLoadSave(BOOL bResetMissionWidgets)
// finished entering a name.
if( id == SAVEENTRY_EDIT)
{
char sTemp[MAX_STR_LENGTH];
if(!keyPressed(KEY_RETURN)) // enter was not pushed, so not a vaild entry.
{
widgDelete(psRequestScreen,SAVEENTRY_EDIT); //unselect this box, and go back ..