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]; [self handleGUIUpDownArrowKeys: gui :gameView];
commanderNameString=[gameView typedString]; commanderNameString=[gameView typedString];
if([commanderNameString length]) [gui setText:
{
[gui setText:
[NSString stringWithFormat:@"Commander name: %@", commanderNameString] [NSString stringWithFormat:@"Commander name: %@", commanderNameString]
forRow: INPUTROW]; forRow: INPUTROW];
}
if([gameView isDown: 13]) if([gameView isDown: 13] && [commanderNameString length])
{ {
[self nativeSavePlayer: commanderNameString]; [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 // 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]; [typedString appendFormat:@"%c", key];
} }
@ -886,7 +889,7 @@ Your fair use and other rights are in no way affected by the above.
// Del, Backspace // Del, Backspace
if(key == SDLK_BACKSPACE || key == SDLK_DELETE) if(key == SDLK_BACKSPACE || key == SDLK_DELETE)
{ {
if([typedString length] > 1) if([typedString length] >= 1)
{ {
[typedString deleteCharactersInRange: [typedString deleteCharactersInRange:
NSMakeRange([typedString length]-1, 1)]; NSMakeRange([typedString length]-1, 1)];