From 652c9154959e672893f30337ac149428bd70fa0b Mon Sep 17 00:00:00 2001 From: chaoskagami Date: Mon, 22 Sep 2014 23:40:18 -0400 Subject: [PATCH] Made op_save, a way to call DumpSave in-game. More checks will be necessary since this is an extension, but meh. I may actually remove the whole concept of extensions since it seems rather pointless. --- vndc/include/Funcs.hpp | 3 +++ vndc/include/gitrev.hpp | 2 +- vndc/src/Parse.cpp | 4 +++- vndc/src/op_save.cpp | 12 ++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 vndc/src/op_save.cpp diff --git a/vndc/include/Funcs.hpp b/vndc/include/Funcs.hpp index 4153a6f..3ae17ba 100644 --- a/vndc/include/Funcs.hpp +++ b/vndc/include/Funcs.hpp @@ -37,4 +37,7 @@ void op_jump(char* file, int* lineTo, bool isSave); void op_goto(char* label); void op_choice(char* choices); +// Extensions. +void op_save(char* file); + #endif diff --git a/vndc/include/gitrev.hpp b/vndc/include/gitrev.hpp index fde0a33..d15b922 100644 --- a/vndc/include/gitrev.hpp +++ b/vndc/include/gitrev.hpp @@ -1,5 +1,5 @@ #ifndef GIT_REV_HDR #define GIT_REV_HDR -#define GIT_REV "5ffbbb9138bc91e95291e2f89f3fbf30e8b33d91" +#define GIT_REV "600f8372132a379e10f46584bba06b5013e8bf05" #endif diff --git a/vndc/src/Parse.cpp b/vndc/src/Parse.cpp index 880c978..2effdac 100644 --- a/vndc/src/Parse.cpp +++ b/vndc/src/Parse.cpp @@ -142,6 +142,8 @@ void ParseCmd(char* line) { op_goto(tokens[1]); else if(!strcmp(tokens[0], "cleartext")) op_cleartext(); + else if(!strcmp(tokens[0], "save") && num == 2) + op_save(tokens[1]); free(tokens); free(passthru_line); @@ -193,7 +195,7 @@ void ParseShell() { DebugContinue = false; GetData()->wait_input = true; } - else if (!strncmp(buffer, "save", 4)) { + else if (!strncmp(buffer, "debugsave", 4)) { char* savefile = &buffer[5]; printf("[debug] Saving to file '%s' NOW.\n", savefile); DumpSave(savefile); diff --git a/vndc/src/op_save.cpp b/vndc/src/op_save.cpp new file mode 100644 index 0000000..cda54e9 --- /dev/null +++ b/vndc/src/op_save.cpp @@ -0,0 +1,12 @@ +/* op_save - saves the game to a save. + Params; name. + */ + +#include "Zero.hpp" +#include "Funcs.hpp" + +void op_save(char* name) { + DumpSave(name); // Just a wrapper. No harm done. + // TODO - Replace all dumpsave calls with this and move function here +} + -- 2.39.5