diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/client.cc | 41 | ||||
-rw-r--r-- | src/client/client.h | 3 |
2 files changed, 42 insertions, 2 deletions
diff --git a/src/client/client.cc b/src/client/client.cc index 706634a..897ab41 100644 --- a/src/client/client.cc +++ b/src/client/client.cc @@ -20,6 +20,7 @@ #include "core/core.h" #include "core/loader.h" #include "core/zone.h" +#include "filesystem/filesystem.h" #include "render/render.h" #include "ui/ui.h" @@ -167,6 +168,12 @@ void Client::init(int count, char **arguments) func = core::Func::add("view", func_view); func->set_info("[command] view menu functions"); + + func = core::Func::add("loadgame", func_loadgame); + func->set_info("load game"); + + func = core::Func::add("savegame", func_savegame); + func->set_info("save game"); previous_timestamp = 0; } @@ -304,11 +311,14 @@ void Client::notify_connect() void Client::notify_disconnect() { + mainwindow()->gamewindow()->hide(); + mainwindow()->clear(); + + model::Material::clear(); audio::reset(); render::reset(); input::reset(); - - mainwindow()->clear(); + model::Material::init(); } void Client::notify_zonechange() @@ -632,4 +642,31 @@ void Client::func_testmodel(std::string const &args) } } +// quick load +void Client::func_loadgame(std::string const &args) +{ + std::string savegamepath(filesystem::writedir()); + savegamepath.append("savegames"); + + filesystem::Directory directory(savegamepath); + + for (filesystem::Directory::FileNames::const_iterator it = directory.filenames().begin(); + it != directory.filenames().end(); ++it) + { + con_print << (*it) << std::endl; + } +} + +// quik save +void Client::func_savegame(std::string const &args) +{ + // make sure the screenshots folder exists + std::string savegamepath(filesystem::writedir()); + savegamepath.append("savegames"); + + if (!sys::directory_exists(savegamepath)) { + sys::mkdir(savegamepath); + } +} + } // namespace client diff --git a/src/client/client.h b/src/client/client.h index e89abfa..6430753 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -83,6 +83,9 @@ protected: private: + static void func_loadgame(std::string const &args); + static void func_savegame(std::string const &args); + static void func_snd_restart(std::string const &args); static void func_r_restart(std::string const &args); static void func_list_ui(std::string const &args); |