Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-01-08 16:51:32 +0000
committerStijn Buys <ingar@osirion.org>2012-01-08 16:51:32 +0000
commit52fa591e4a7130bf1d3723874b9e09c9e782de55 (patch)
tree979f8a7753a856297261b13647953e21d1171d01 /src/client/client.cc
parentd3d50e3ba3b1b83b31dc54b2601176ccff20305c (diff)
Corrected a material cleanup bug in the disconnect cycle,
added loadgame/savegame function prototypes
Diffstat (limited to 'src/client/client.cc')
-rw-r--r--src/client/client.cc41
1 files changed, 39 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