save commander string editor fixes

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@109 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Dylan Smith 2005-08-28 19:16:57 +00:00
parent c51ae31537
commit f33bf945d0
2 changed files with 7 additions and 7 deletions

View File

@ -148,14 +148,11 @@
{
[self handleGUIUpDownArrowKeys: gui :gameView];
commanderNameString=[gameView typedString];
if([commanderNameString length])
{
[gui setText:
[gui setText:
[NSString stringWithFormat:@"Commander name: %@", commanderNameString]
forRow: INPUTROW];
}
if([gameView isDown: 13])
if([gameView isDown: 13] && [commanderNameString length])
{
[self nativeSavePlayer: commanderNameString];
}

View File

@ -878,7 +878,10 @@ Your fair use and other rights are in no way affected by the above.
}
// keys 0-9, Space
if((key >= '0' && key <= '9') || key == ' ')
// TODO: Investigation.
// there seems to be some problem with '0' and '2' randomly popping
// up. Possible SDL fault? Not a big loss not to have them though.
if(/*(key >= '0' && key <= '9') || */key == ' ')
{
[typedString appendFormat:@"%c", key];
}
@ -886,7 +889,7 @@ Your fair use and other rights are in no way affected by the above.
// Del, Backspace
if(key == SDLK_BACKSPACE || key == SDLK_DELETE)
{
if([typedString length] > 1)
if([typedString length] >= 1)
{
[typedString deleteCharactersInRange:
NSMakeRange([typedString length]-1, 1)];