-rw-r--r-- | noncore/games/sfcave/sfcave.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/noncore/games/sfcave/sfcave.cpp b/noncore/games/sfcave/sfcave.cpp index 93f5f82..d551afe 100644 --- a/noncore/games/sfcave/sfcave.cpp +++ b/noncore/games/sfcave/sfcave.cpp | |||
@@ -827,5 +827,5 @@ void SFCave :: keyPressEvent( QKeyEvent *e ) | |||
827 | case Qt::Key_F9: | 827 | case Qt::Key_F9: |
828 | case Qt::Key_Space: | 828 | case Qt::Key_Space: |
829 | if ( !press ) | 829 | if ( !replay && !press ) |
830 | { | 830 | { |
831 | press = true; | 831 | press = true; |
@@ -863,5 +863,5 @@ void SFCave :: keyReleaseEvent( QKeyEvent *e ) | |||
863 | case Qt::Key_Space: | 863 | case Qt::Key_Space: |
864 | case Qt::Key_Up: | 864 | case Qt::Key_Up: |
865 | if ( press ) | 865 | if ( !replay && press ) |
866 | { | 866 | { |
867 | press = false; | 867 | press = false; |
@@ -884,9 +884,11 @@ void SFCave :: keyReleaseEvent( QKeyEvent *e ) | |||
884 | 884 | ||
885 | case Qt::Key_S: | 885 | case Qt::Key_S: |
886 | saveReplay(); | 886 | if ( state == STATE_CRASHED ) |
887 | saveReplay(); | ||
887 | break; | 888 | break; |
888 | 889 | ||
889 | case Qt::Key_L: | 890 | case Qt::Key_L: |
890 | loadReplay(); | 891 | if ( state == STATE_CRASHED ) |
892 | loadReplay(); | ||
891 | break; | 893 | break; |
892 | default: | 894 | default: |
@@ -1066,4 +1068,9 @@ void SFCave :: loadReplay() | |||
1066 | FILE *in = fopen( (const char *)replayFile, "r" ); | 1068 | FILE *in = fopen( (const char *)replayFile, "r" ); |
1067 | 1069 | ||
1070 | if ( in == 0 ) | ||
1071 | { | ||
1072 | printf( "Couldn't load replay file!\n" ); | ||
1073 | return; | ||
1074 | } | ||
1068 | // Read size of next line | 1075 | // Read size of next line |
1069 | char line[10+1]; | 1076 | char line[10+1]; |
@@ -1094,3 +1101,5 @@ void SFCave :: loadReplay() | |||
1094 | 1101 | ||
1095 | fclose( in ); | 1102 | fclose( in ); |
1103 | |||
1104 | printf( "Replay loaded from %s\n", (const char *)replayFile ); | ||
1096 | } \ No newline at end of file | 1105 | } \ No newline at end of file |