From 52fa591e4a7130bf1d3723874b9e09c9e782de55 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 8 Jan 2012 16:51:32 +0000 Subject: Corrected a material cleanup bug in the disconnect cycle, added loadgame/savegame function prototypes --- src/client/client.cc | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'src/client/client.cc') 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 -- cgit v1.2.3