(List<String> args)
| 1116 | } |
| 1117 | |
| 1118 | void SV_Loadgame_f(List<String> args) { |
| 1119 | |
| 1120 | if (args.size() != 2) { |
| 1121 | Com.Printf("USAGE: load <directory>\n"); |
| 1122 | return; |
| 1123 | } |
| 1124 | |
| 1125 | Com.Printf("Loading game...\n"); |
| 1126 | |
| 1127 | String saveGame = args.get(1); |
| 1128 | if (saveGame.contains("..") || saveGame.contains("/") || saveGame.contains("\\")) { |
| 1129 | Com.Printf("Bad save name.\n"); |
| 1130 | return; |
| 1131 | } |
| 1132 | |
| 1133 | // make sure the server.ssv file exists |
| 1134 | String name = FS.getWriteDir() + "/save/" + saveGame + "/server_mapcmd.ssv"; |
| 1135 | RandomAccessFile f; |
| 1136 | try { |
| 1137 | f = new RandomAccessFile(name, "r"); |
| 1138 | } |
| 1139 | catch (FileNotFoundException e) { |
| 1140 | Com.Printf("No such savegame: " + name + "\n"); |
| 1141 | return; |
| 1142 | } |
| 1143 | |
| 1144 | try { |
| 1145 | f.close(); |
| 1146 | } |
| 1147 | catch (IOException e1) { |
| 1148 | e1.printStackTrace(); |
| 1149 | } |
| 1150 | |
| 1151 | SV_CopySaveGame(saveGame, "current"); |
| 1152 | |
| 1153 | final String mapCommand = SV_ReadMapCommand(); |
| 1154 | |
| 1155 | // go to the map |
| 1156 | spawnServerInstance(new ChangeMapInfo(mapCommand, false, true), 0); |
| 1157 | } |
| 1158 | |
| 1159 | private String SV_ReadMapCommand() { |
| 1160 | Com.DPrintf("SV_ReadMapCommand()\n"); |
nothing calls this directly
no test coverage detected