author | erik <erik> | 2007-01-10 17:31:08 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-10 17:31:08 (UTC) |
commit | 6825f30b665952864dbe35fe8329a0e4c264d4b8 (patch) (unidiff) | |
tree | 7c8d178f835d4a7d294b6ef65e0040c40579e84e /noncore/games/sfcave | |
parent | d8e580a239ab84fbe063b2f3779d417598d5ca0a (diff) | |
download | opie-6825f30b665952864dbe35fe8329a0e4c264d4b8.zip opie-6825f30b665952864dbe35fe8329a0e4c264d4b8.tar.gz opie-6825f30b665952864dbe35fe8329a0e4c264d4b8.tar.bz2 |
All of the files included have instances where an array is new'ed but
the corresponding delete does not have the corresponding [] argument.
-rw-r--r-- | noncore/games/sfcave/sfcave.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/games/sfcave/sfcave.cpp b/noncore/games/sfcave/sfcave.cpp index a6c92a0..516dc93 100644 --- a/noncore/games/sfcave/sfcave.cpp +++ b/noncore/games/sfcave/sfcave.cpp | |||
@@ -953,97 +953,97 @@ void SFCave :: saveReplay() | |||
953 | fwrite( (const char *)val, 1, val.length(), out ); | 953 | fwrite( (const char *)val, 1, val.length(), out ); |
954 | 954 | ||
955 | fclose( out ); | 955 | fclose( out ); |
956 | 956 | ||
957 | printf( "Replay saved to %s\n", QFile::encodeName(replayFile).data() ); | 957 | printf( "Replay saved to %s\n", QFile::encodeName(replayFile).data() ); |
958 | 958 | ||
959 | } | 959 | } |
960 | 960 | ||
961 | void SFCave :: loadReplay() | 961 | void SFCave :: loadReplay() |
962 | { | 962 | { |
963 | FILE *in = fopen( QFile::encodeName(replayFile).data() , "r" ); | 963 | FILE *in = fopen( QFile::encodeName(replayFile).data() , "r" ); |
964 | 964 | ||
965 | if ( in == 0 ) | 965 | if ( in == 0 ) |
966 | { | 966 | { |
967 | printf( "Couldn't load replay file!\n" ); | 967 | printf( "Couldn't load replay file!\n" ); |
968 | return; | 968 | return; |
969 | } | 969 | } |
970 | 970 | ||
971 | // Read next line - contains the size of the options | 971 | // Read next line - contains the size of the options |
972 | char line[10+1]; | 972 | char line[10+1]; |
973 | fgets( line, 10, in ); | 973 | fgets( line, 10, in ); |
974 | 974 | ||
975 | int length = -1; | 975 | int length = -1; |
976 | sscanf( line, "%d", &length ); | 976 | sscanf( line, "%d", &length ); |
977 | char *data = new char[length+1]; | 977 | char *data = new char[length+1]; |
978 | 978 | ||
979 | fread( data, 1, length, in ); | 979 | fread( data, 1, length, in ); |
980 | // printf( "data - %s", data ); | 980 | // printf( "data - %s", data ); |
981 | 981 | ||
982 | QString sep = " "; | 982 | QString sep = " "; |
983 | QStringList list = QStringList::split( sep, QString( data ) ); | 983 | QStringList list = QStringList::split( sep, QString( data ) ); |
984 | 984 | ||
985 | // print it out | 985 | // print it out |
986 | QStringList::Iterator it = list.begin(); | 986 | QStringList::Iterator it = list.begin(); |
987 | currentSeed = (*it).toInt(); | 987 | currentSeed = (*it).toInt(); |
988 | ++it; | 988 | ++it; |
989 | currentGameType = (*it).toInt(); | 989 | currentGameType = (*it).toInt(); |
990 | ++it; | 990 | ++it; |
991 | currentGameDifficulty = (*it).toInt(); | 991 | currentGameDifficulty = (*it).toInt(); |
992 | ++it; | 992 | ++it; |
993 | 993 | ||
994 | replayList.clear(); | 994 | replayList.clear(); |
995 | for ( ; it != list.end(); ++it ) | 995 | for ( ; it != list.end(); ++it ) |
996 | { | 996 | { |
997 | int v = (*it).toInt(); | 997 | int v = (*it).toInt(); |
998 | replayList.append( new int( v ) ); | 998 | replayList.append( new int( v ) ); |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | delete data; | 1001 | delete [] data; |
1002 | 1002 | ||
1003 | fclose( in ); | 1003 | fclose( in ); |
1004 | 1004 | ||
1005 | printf( "Replay loaded from %s\n", QFile::encodeName(replayFile).data() ); | 1005 | printf( "Replay loaded from %s\n", QFile::encodeName(replayFile).data() ); |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | 1008 | ||
1009 | //--------------- MENU CODE --------------------- | 1009 | //--------------- MENU CODE --------------------- |
1010 | void SFCave :: handleMenuKeys( QKeyEvent *e ) | 1010 | void SFCave :: handleMenuKeys( QKeyEvent *e ) |
1011 | { | 1011 | { |
1012 | switch( e->key() ) | 1012 | switch( e->key() ) |
1013 | { | 1013 | { |
1014 | case Qt::Key_Down: | 1014 | case Qt::Key_Down: |
1015 | currentMenuOption[currentMenuNr] ++; | 1015 | currentMenuOption[currentMenuNr] ++; |
1016 | if ( menuOptions[currentMenuNr][currentMenuOption[currentMenuNr]] == "" ) | 1016 | if ( menuOptions[currentMenuNr][currentMenuOption[currentMenuNr]] == "" ) |
1017 | currentMenuOption[currentMenuNr] = 0; | 1017 | currentMenuOption[currentMenuNr] = 0; |
1018 | break; | 1018 | break; |
1019 | case Qt::Key_Up: | 1019 | case Qt::Key_Up: |
1020 | currentMenuOption[currentMenuNr] --; | 1020 | currentMenuOption[currentMenuNr] --; |
1021 | if ( currentMenuOption[currentMenuNr] < 0 ) | 1021 | if ( currentMenuOption[currentMenuNr] < 0 ) |
1022 | currentMenuOption[currentMenuNr] = nrMenuOptions[currentMenuNr]-1; | 1022 | currentMenuOption[currentMenuNr] = nrMenuOptions[currentMenuNr]-1; |
1023 | break; | 1023 | break; |
1024 | 1024 | ||
1025 | case Qt::Key_Left: | 1025 | case Qt::Key_Left: |
1026 | if ( currentMenuNr == MENU_OPTIONS_MENU ) | 1026 | if ( currentMenuNr == MENU_OPTIONS_MENU ) |
1027 | { | 1027 | { |
1028 | if ( currentMenuOption[currentMenuNr] == MENU_GAME_TYPE ) | 1028 | if ( currentMenuOption[currentMenuNr] == MENU_GAME_TYPE ) |
1029 | { | 1029 | { |
1030 | currentGameType --; | 1030 | currentGameType --; |
1031 | if ( currentGameType < 0 ) | 1031 | if ( currentGameType < 0 ) |
1032 | currentGameType = NR_GAME_TYPES - 1; | 1032 | currentGameType = NR_GAME_TYPES - 1; |
1033 | } | 1033 | } |
1034 | else if ( currentMenuOption[currentMenuNr] == MENU_GAME_DIFFICULTY ) | 1034 | else if ( currentMenuOption[currentMenuNr] == MENU_GAME_DIFFICULTY ) |
1035 | { | 1035 | { |
1036 | currentGameDifficulty --; | 1036 | currentGameDifficulty --; |
1037 | if ( currentGameDifficulty < 0 ) | 1037 | if ( currentGameDifficulty < 0 ) |
1038 | currentGameDifficulty = NR_GAME_DIFFICULTIES - 1; | 1038 | currentGameDifficulty = NR_GAME_DIFFICULTIES - 1; |
1039 | } | 1039 | } |
1040 | } | 1040 | } |
1041 | break; | 1041 | break; |
1042 | 1042 | ||
1043 | case Qt::Key_Right: | 1043 | case Qt::Key_Right: |
1044 | if ( currentMenuNr == MENU_OPTIONS_MENU ) | 1044 | if ( currentMenuNr == MENU_OPTIONS_MENU ) |
1045 | { | 1045 | { |
1046 | if ( currentMenuOption[currentMenuNr] == MENU_GAME_TYPE ) | 1046 | if ( currentMenuOption[currentMenuNr] == MENU_GAME_TYPE ) |
1047 | { | 1047 | { |
1048 | currentGameType ++; | 1048 | currentGameType ++; |
1049 | if ( currentGameType == NR_GAME_TYPES ) | 1049 | if ( currentGameType == NR_GAME_TYPES ) |