MCPcopy Create free account
hub / github.com/demoth/jake2 / SV_Loadgame_f

Method SV_Loadgame_f

server/src/main/java/jake2/server/SV_MAIN.java:1118–1157  ·  view source on GitHub ↗
(List<String> args)

Source from the content-addressed store, hash-verified

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");

Callers

nothing calls this directly

Calls 7

PrintfMethod · 0.95
getWriteDirMethod · 0.95
SV_ReadMapCommandMethod · 0.95
spawnServerInstanceMethod · 0.95
sizeMethod · 0.80
SV_CopySaveGameMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected