171 } |
172 } |
172 |
173 |
173 return false; |
174 return false; |
174 } |
175 } |
175 |
176 |
176 extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm); |
|
177 extern void BuildFileList(); |
177 extern void BuildFileList(); |
178 extern void SetFiosType(const byte fiostype); |
178 extern void SetFiosType(const byte fiostype); |
179 |
179 |
180 /* Save the map to a file */ |
180 /* Save the map to a file */ |
181 DEF_CONSOLE_CMD(ConSave) |
181 DEF_CONSOLE_CMD(ConSave) |
184 IConsoleHelp("Save the current game. Usage: 'save <filename>'"); |
184 IConsoleHelp("Save the current game. Usage: 'save <filename>'"); |
185 return true; |
185 return true; |
186 } |
186 } |
187 |
187 |
188 if (argc == 2) { |
188 if (argc == 2) { |
189 char buf[200]; |
189 char *filename = str_fmt("%s.sav", argv[1]); |
190 |
|
191 snprintf(buf, lengthof(buf), "%s%s%s.sav", _paths.save_dir, PATHSEP, argv[1]); |
|
192 IConsolePrint(_icolour_def, "Saving map..."); |
190 IConsolePrint(_icolour_def, "Saving map..."); |
193 |
191 |
194 if (SaveOrLoad(buf, SL_SAVE) != SL_OK) { |
192 if (SaveOrLoad(filename, SL_SAVE, SAVE_DIR) != SL_OK) { |
195 IConsolePrint(_icolour_err, "SaveMap failed"); |
193 IConsolePrint(_icolour_err, "Saving map failed"); |
196 } else { |
194 } else { |
197 IConsolePrintF(_icolour_def, "Map sucessfully saved to %s", buf); |
195 IConsolePrintF(_icolour_def, "Map sucessfully saved to %s", filename); |
198 } |
196 } |
|
197 free(filename); |
199 return true; |
198 return true; |
200 } |
199 } |
201 |
200 |
202 return false; |
201 return false; |
203 } |
202 } |
938 } |
937 } |
939 |
938 |
940 IConsolePrintF(_icolour_def, "Generation Seed: %u", _patches.generation_seed); |
939 IConsolePrintF(_icolour_def, "Generation Seed: %u", _patches.generation_seed); |
941 return true; |
940 return true; |
942 } |
941 } |
|
942 |
|
943 DEF_CONSOLE_CMD(ConGetDate) |
|
944 { |
|
945 if (argc == 0) { |
|
946 IConsoleHelp("Returns the current date (day-month-year) of the game. Usage: 'getdate'"); |
|
947 return true; |
|
948 } |
|
949 |
|
950 YearMonthDay ymd; |
|
951 ConvertDateToYMD(_date, &ymd); |
|
952 IConsolePrintF(_icolour_def, "Date: %d-%d-%d", ymd.day, ymd.month + 1, ymd.year); |
|
953 return true; |
|
954 } |
|
955 |
943 |
956 |
944 DEF_CONSOLE_CMD(ConAlias) |
957 DEF_CONSOLE_CMD(ConAlias) |
945 { |
958 { |
946 IConsoleAlias *alias; |
959 IConsoleAlias *alias; |
947 |
960 |
1494 IConsoleCmdRegister("list_vars", ConListVariables); |
1507 IConsoleCmdRegister("list_vars", ConListVariables); |
1495 IConsoleCmdRegister("list_aliases", ConListAliases); |
1508 IConsoleCmdRegister("list_aliases", ConListAliases); |
1496 IConsoleCmdRegister("newgame", ConNewGame); |
1509 IConsoleCmdRegister("newgame", ConNewGame); |
1497 IConsoleCmdRegister("restart", ConRestart); |
1510 IConsoleCmdRegister("restart", ConRestart); |
1498 IConsoleCmdRegister("getseed", ConGetSeed); |
1511 IConsoleCmdRegister("getseed", ConGetSeed); |
|
1512 IConsoleCmdRegister("getdate", ConGetDate); |
1499 IConsoleCmdRegister("quit", ConExit); |
1513 IConsoleCmdRegister("quit", ConExit); |
1500 IConsoleCmdRegister("resetengines", ConResetEngines); |
1514 IConsoleCmdRegister("resetengines", ConResetEngines); |
1501 IConsoleCmdRegister("return", ConReturn); |
1515 IConsoleCmdRegister("return", ConReturn); |
1502 IConsoleCmdRegister("screenshot", ConScreenShot); |
1516 IConsoleCmdRegister("screenshot", ConScreenShot); |
1503 IConsoleCmdRegister("script", ConScript); |
1517 IConsoleCmdRegister("script", ConScript); |